Re: [PATCH v3 1/3] powerpc/powernv: convert codes returned by OPAL calls
On 03/30/2015 04:05 AM, Michael Ellerman wrote: On Fri, 2015-03-27 at 17:39 +0100, Cédric Le Goater wrote: OPAL has its own list of return codes. The patch provides a translation of such codes in errnos for the opal_sensor_read call, and possibly others if needed. Index: linux.git/arch/powerpc/platforms/powernv/opal.c === --- linux.git.orig/arch/powerpc/platforms/powernv/opal.c +++ linux.git/arch/powerpc/platforms/powernv/opal.c @@ -894,6 +894,23 @@ void opal_free_sg_list(struct opal_sg_li } } +int opal_error_code(int rc) +{ +switch (rc) { +case OPAL_SUCCESS: return 0; Obviously correct. He. Initially, I didn't put a case for SUCCESS, but we have code doing : ret = be64_to_cpu(msg.params[1]); +case OPAL_PARAMETER:return -EINVAL; Yep. +case OPAL_UNSUPPORTED: return -ENOSYS; You shouldn't use ENOSYS here, that should only ever mean no such syscall, otherwise you get very confusing results like read() returning ENOSYS. Indeed. How about ENODEV then ? +case OPAL_ASYNC_COMPLETION: return -EAGAIN; EAGAIN means try what you did again, I don't think that's what ASYNC_COMPLETION means, is it? It looks like it means, don't try again, but you need to wait for the result to be ready. I'm not sure it maps well to any of the Linux codes, maybe EINPROGRESS ? Yes. This is better. +case OPAL_BUSY_EVENT: return -EBUSY; Yep. +case OPAL_NO_MEM: return -ENOMEM; Yep. +case OPAL_HARDWARE: return -ENOENT; This is another one which I think you shouldn't use as it can lead to confusing results at user level. eg: $ cat /sysfs/some/file Error: No such file or directory Huh? Looking at the skiboot code this looks like EIO is a good match. ok. +case OPAL_INTERNAL_ERROR: return -EIO; Yeah as good as anything I guess. +default: +pr_err(%s: unexpected OPAL error %d\n, __func__, rc); +return -ERANGE; I'm not sure about this one honestly, it means Math result not representable. I suspect the reason RTAS chose it was just that it's not EINVAL. This should probably also just be EIO. ok. I will change it. Thanks, C. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 3/3] powerpc/powernv: remove opal_sensor_mutex
On Mon, 2015-03-30 at 08:51 +0200, Cedric Le Goater wrote: On 03/30/2015 04:09 AM, Michael Ellerman wrote: On Fri, 2015-03-27 at 17:39 +0100, Cédric Le Goater wrote: The opal sensor mutex protects the opal_sensor_read call which can return a OPAL_BUSY code on IBM Power systems if a previous request is in progress. This can be handled at user level with a retry. It can, but how does it actually look in practice? It looks like the only use of opal_get_sensor_data() is show_sensor() in drivers/hwmon/ibmpowernv.c. Because that's a sysfs attribute folks will be generally just dumping that with cat, or reading it in a shell script, neither of which will cope nicely with EBUSY I think? It won't, I agree but it should only happen when running concurrent cat commands on the hwmon sysfs files. The event should be rare enough. Rare enough maybe, but a real pain in the .. to cope with in a shell script if you're trying to automate something. Anyhow, this is not a big issue. We can drop that patch. The real issue is the time it takes to get some values back from the FSP. This is what user space has been most surprised about. OK. The other option would be to move the mutex into the sysfs show routine, so only that is synchronous. That would give you nice behaviour from cat, ie. it would sleep on contention but still be killable with ctrl-c. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 1/3] powerpc/powernv: convert codes returned by OPAL calls
On Mon, 2015-03-30 at 08:37 +0200, Cedric Le Goater wrote: On 03/30/2015 04:05 AM, Michael Ellerman wrote: On Fri, 2015-03-27 at 17:39 +0100, Cédric Le Goater wrote: OPAL has its own list of return codes. The patch provides a translation of such codes in errnos for the opal_sensor_read call, and possibly others if needed. + case OPAL_UNSUPPORTED: return -ENOSYS; You shouldn't use ENOSYS here, that should only ever mean no such syscall, otherwise you get very confusing results like read() returning ENOSYS. Indeed. How about ENODEV then ? That can also be confusing from userspace. I think it's probably best just to use EIO, as far as userspace is concerned if the kernel lets it call an unsupported OPAL routine that is more or less a kernel bug. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 1/3] powerpc/powernv: convert codes returned by OPAL calls
On 03/30/2015 08:54 AM, Michael Ellerman wrote: On Mon, 2015-03-30 at 08:37 +0200, Cedric Le Goater wrote: On 03/30/2015 04:05 AM, Michael Ellerman wrote: On Fri, 2015-03-27 at 17:39 +0100, Cédric Le Goater wrote: OPAL has its own list of return codes. The patch provides a translation of such codes in errnos for the opal_sensor_read call, and possibly others if needed. + case OPAL_UNSUPPORTED: return -ENOSYS; You shouldn't use ENOSYS here, that should only ever mean no such syscall, otherwise you get very confusing results like read() returning ENOSYS. Indeed. How about ENODEV then ? That can also be confusing from userspace. I think it's probably best just to use EIO, as far as userspace is concerned if the kernel lets it call an unsupported OPAL routine that is more or less a kernel bug. OK. Will do. Thanks, C. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc: Reword the returning from prom_init message
We get way too many bug reports that say the kernel is hung in prom_init, which stems from the fact that the last piece of output people see is returning from prom_init. The kernel is almost never hung in prom_init(), it's just that it's crashed somewhere after prom_init() but prior to the console coming up. The existing message should give a clue to that, ie. returning from indicates that prom_init() has finished, but it doesn't seem to work. Let's try something different. This prints: Quiescing Open Firmware ... Booting Linux via __start() ... Which hopefully makes it clear that prom_init() is not the problem, and although __start() probably isn't either, it's at least the right place to begin looking. Signed-off-by: Michael Ellerman m...@ellerman.id.au --- arch/powerpc/kernel/prom_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 1a85d8f96739..fd1fe4c37599 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2898,7 +2898,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, * Call OF quiesce method to shut down pending DMA's from * devices etc... */ - prom_printf(Calling quiesce...\n); + prom_printf(Quiescing Open Firmware ...\n); call_prom(quiesce, 0, 0); /* @@ -2910,7 +2910,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, /* Don't print anything after quiesce under OPAL, it crashes OFW */ if (of_platform != PLATFORM_OPAL) { - prom_printf(returning from prom_init\n); + prom_printf(Booting Linux via __start() ...\n); prom_debug(-dt_header_start=0x%x\n, hdr); } -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 3/3] powerpc/powernv: remove opal_sensor_mutex
On 03/30/2015 04:09 AM, Michael Ellerman wrote: On Fri, 2015-03-27 at 17:39 +0100, Cédric Le Goater wrote: The opal sensor mutex protects the opal_sensor_read call which can return a OPAL_BUSY code on IBM Power systems if a previous request is in progress. This can be handled at user level with a retry. It can, but how does it actually look in practice? It looks like the only use of opal_get_sensor_data() is show_sensor() in drivers/hwmon/ibmpowernv.c. Because that's a sysfs attribute folks will be generally just dumping that with cat, or reading it in a shell script, neither of which will cope nicely with EBUSY I think? It won't, I agree but it should only happen when running concurrent cat commands on the hwmon sysfs files. The event should be rare enough. Anyhow, this is not a big issue. We can drop that patch. The real issue is the time it takes to get some values back from the FSP. This is what user space has been most surprised about. Thanks, C. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH V2] clockevents: Fix cpu down race for hrtimer based broadcasting
It was found when doing a hotplug stress test on POWER, that the machine either hit softlockups or rcu_sched stall warnings. The issue was traced to commit 7cba160ad789a powernv/cpuidle: Redesign idle states management, which exposed the cpu down race with hrtimer based broadcast mode(Commit 5d1638acb9f6(tick: Introduce hrtimer based broadcast). This is explained below. Assume CPU1 is the CPU which holds the hrtimer broadcasting duty before it is taken down. CPU0CPU1 cpu_down() take_cpu_down() disable_interrupts() cpu_die() while(CPU1 != CPU_DEAD) { msleep(100); switch_to_idle(); stop_cpu_timer(); schedule_broadcast(); } tick_cleanup_cpu_dead() take_over_broadcast() So after CPU1 disabled interrupts it cannot handle the broadcast hrtimer anymore, so CPU0 will be stuck forever. Fix this by explicitly taking over broadcast duty before cpu_die(). This is a temporary workaround. What we really want is a callback in the clockevent device which allows us to do that from the dying CPU by pushing the hrtimer onto a different cpu. That might involve an IPI and is definitely more complex than this immediate fix. Fixes: http://linuxppc.10917.n7.nabble.com/offlining-cpus-breakage-td88619.html Suggested-by: Thomas Gleixner t...@linutronix.de Signed-off-by: Preeti U. Murthy pre...@linux.vnet.ibm.com [Changelog drawn from: https://lkml.org/lkml/2015/2/16/213] --- Change from V1: https://lkml.org/lkml/2015/2/26/11 1. Decoupled this fix from the kernel/time cleanup patches. V1 had a fail related to the cleanup which needs to be fixed. But since this bug fix is independent of this and needs to go in quickly, the patch is being posted out separately to be merged. include/linux/tick.h | 10 +++--- kernel/cpu.c |2 ++ kernel/time/tick-broadcast.c | 19 +++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 9c085dc..3069256 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -94,14 +94,18 @@ extern void tick_cancel_sched_timer(int cpu); static inline void tick_cancel_sched_timer(int cpu) { } # endif -# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST +# if defined CONFIG_GENERIC_CLOCKEVENTS_BROADCAST extern struct tick_device *tick_get_broadcast_device(void); extern struct cpumask *tick_get_broadcast_mask(void); -# ifdef CONFIG_TICK_ONESHOT +# if defined CONFIG_TICK_ONESHOT extern struct cpumask *tick_get_broadcast_oneshot_mask(void); +extern void tick_takeover(int deadcpu); +# else +static inline void tick_takeover(int deadcpu) {} # endif - +# else +static inline void tick_takeover(int deadcpu) {} # endif /* BROADCAST */ # ifdef CONFIG_TICK_ONESHOT diff --git a/kernel/cpu.c b/kernel/cpu.c index 1972b16..f9ca351 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -20,6 +20,7 @@ #include linux/gfp.h #include linux/suspend.h #include linux/lockdep.h +#include linux/tick.h #include trace/events/power.h #include smpboot.h @@ -411,6 +412,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) while (!idle_cpu(cpu)) cpu_relax(); + tick_takeover(cpu); /* This actually kills the CPU. */ __cpu_die(cpu); diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 066f0ec..0fd6634 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -669,14 +669,19 @@ static void broadcast_shutdown_local(struct clock_event_device *bc, clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN); } -static void broadcast_move_bc(int deadcpu) +void tick_takeover(int deadcpu) { - struct clock_event_device *bc = tick_broadcast_device.evtdev; + struct clock_event_device *bc; + unsigned long flags; - if (!bc || !broadcast_needs_cpu(bc, deadcpu)) - return; - /* This moves the broadcast assignment to this cpu */ - clockevents_program_event(bc, bc-next_event, 1); + raw_spin_lock_irqsave(tick_broadcast_lock, flags); + bc = tick_broadcast_device.evtdev; + + if (bc broadcast_needs_cpu(bc, deadcpu)) { + /* This moves the broadcast assignment to this cpu */ + clockevents_program_event(bc, bc-next_event, 1); + } + raw_spin_unlock_irqrestore(tick_broadcast_lock, flags); } /* @@ -913,8 +918,6 @@ void tick_shutdown_broadcast_oneshot(unsigned int *cpup) cpumask_clear_cpu(cpu, tick_broadcast_pending_mask); cpumask_clear_cpu(cpu, tick_broadcast_force_mask); - broadcast_move_bc(cpu); - raw_spin_unlock_irqrestore(tick_broadcast_lock, flags); } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: Export __spin_yield
Hi Ben, On Fri, Mar 20, 2015 at 12:08 AM, Paul Mackerras pau...@samba.org wrote: On Wed, Feb 25, 2015 at 05:23:53PM -0600, Suresh E. Warrier wrote: Export __spin_yield so that the arch_spin_unlock() function can be invoked from a module. This will be required for modules where we want to take a lock that is also is acquired in hypervisor real mode. Because we want to avoid running any lockdep code (which may not be safe in real mode), this lock needs to be an arch_spinlock_t instead of a normal spinlock. Signed-off-by: Suresh Warrier warr...@linux.vnet.ibm.com Acked-by: Paul Mackerras pau...@samba.org Something went wrong when applying this, as it ended up as: commit 1f8c82ab1b0bc7e24601c0fca411fd27b9c883ef Author: Geert Uytterhoeven geert+rene...@glider.be Date: Wed Mar 4 12:56:20 2015 +0100 cpufreq/ppc: Add missing #include asm/smp.h If CONFIG_SMP=n, linux/smp.h does not include asm/smp.h, causing: drivers/cpufreq/ppc-corenet-cpufreq.c: In function 'corenet_cpufreq_cpu_init drivers/cpufreq/ppc-corenet-cpufreq.c:173:3: error: implicit declaration of X-Patchwork-Id: 443703 Message-Id: 54ee5989.7010...@linux.vnet.ibm.com To: linuxppc-...@ozlabs.org Date: Wed, 25 Feb 2015 17:23:53 -0600 Export __spin_yield so that the arch_spin_unlock() function can be invoked from a module. This will be required for modules where we want to take a lock that is also is acquired in hypervisor real mode. Because we want to avoid running any lockdep code (which may not be safe in real mode), this lock needs to be an arch_spinlock_t instead of a normal spinlock. Signed-off-by: Suresh Warrier warr...@linux.vnet.ibm.com Acked-by: Paul Mackerras pau...@samba.org Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v3, 1/3] powerpc: Fix cpu_online_cores_map to return only online threads mask
On Sun, 2015-22-03 at 04:42:57 UTC, Shreyas B. Prabhu wrote: Currently, cpu_online_cores_map returns a mask, which for every core that has atleast one online thread, has the first-cpu-of-that-core's bit set. ... which for every core with at least one online thread, has the bit for thread 0 of the core set to 1, and the bits for all other threads of the core set to 0. Maybe that's clearer? But the first cpu itself may not be online always. In such cases, if ^ of the core the returned mask is used for IPI, then it'll cause IPIs to be skipped on cores where the first thread is offline. .. because the IPI code refuses to send IPIs to offline threads, right? Fix this by setting first-online-cpu-of-the-core's bit in the mask. .. by setting the bit of the first online thread in the core. This is done by fixing this in the underlying function cpu_thread_mask_to_cores. The result has the property that for all cores with online threads, there is one bit set in the returned map. And further, all bits that are set in the returned map correspond to online threads. Signed-off-by: Shreyas B. Prabhu shre...@linux.vnet.ibm.com --- This patch is new in v3 In an example scenario where all the threads of 1st core are offline and argument to cpu_thread_mask_to_cores is cpu_possible_mask, with this implementation, return value will not have any bit corresponding to 1st core set. I think that should be okay. Any thoughts? Looking at linux-next: $ git grep cpu_thread_mask_to_cores arch/powerpc/include/asm/cputhreads.h:/* cpu_thread_mask_to_cores - Return a cpumask of one per cores arch/powerpc/include/asm/cputhreads.h:static inline cpumask_t cpu_thread_mask_to_cores(const struct cpumask *threads) arch/powerpc/include/asm/cputhreads.h: return cpu_thread_mask_to_cores(cpu_online_mask); $ git grep cpu_online_cores_map arch/powerpc/include/asm/cputhreads.h:static inline cpumask_t cpu_online_cores_map(void) ie. There are no users. So yeah I think we can change the semantics of this, and the semantics you describe make sense. If you agree with my changelog comments I'm happy to fix that up and merge this, or you can send a v4 if you like. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: stable: Please include commit bb344ca5b90 (powerpc/mpc85xx: Add ranges to etsec2 nodes)
On Thu, Mar 26, 2015 at 04:14:27PM -0500, Scott Wood wrote: Commit bb344ca5b90df6 (powerpc/mpc85xx: Add ranges to etsec2 nodes) fixes a bug that was exposed by commit 746c9e9f92dd (of/base: Fix PowerPC address parsing hack). The latter commit was applied to stable trees, so the former should be as well. -Scott -- To unsubscribe from this list: send the line unsubscribe stable in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, I'll queue this fix for the 3.16 kernel. Cheers, -- Luís ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 2/2] powerpc/powernv: handle OPAL_SUCCESS return in opal_sensor_read
Currently, when a sensor value is read, the kernel calls OPAL, which in turn builds a message for the FSP, and waits for a message back. The new device tree for OPAL sensors [1] adds new sensors that can be read synchronously (core temperatures for instance) and that don't need to wait for a response. This patch modifies the opal call to accept an OPAL_SUCCESS return value and cover the case above. [1] https://lists.ozlabs.org/pipermail/skiboot/2015-March/000639.html Signed-off-by: Cédric Le Goater c...@fr.ibm.com --- We still uselessly reserve a token (for the response) and take a lock, which might raise the need of a new 'opal_sensor_read_sync' call. Changes since v2 : - merged the return code assignments in one call arch/powerpc/platforms/powernv/opal-sensor.c | 32 --- 1 file changed, 20 insertions(+), 12 deletions(-) Index: linux.git/arch/powerpc/platforms/powernv/opal-sensor.c === --- linux.git.orig/arch/powerpc/platforms/powernv/opal-sensor.c +++ linux.git/arch/powerpc/platforms/powernv/opal-sensor.c @@ -46,20 +46,28 @@ int opal_get_sensor_data(u32 sensor_hndl mutex_lock(opal_sensor_mutex); ret = opal_sensor_read(sensor_hndl, token, data); - if (ret != OPAL_ASYNC_COMPLETION) { - ret = opal_error_code(ret); - goto out_token; - } + switch (ret) { + case OPAL_ASYNC_COMPLETION: + ret = opal_async_wait_response(token, msg); + if (ret) { + pr_err(%s: Failed to wait for the async response, %d\n, + __func__, ret); + goto out_token; + } - ret = opal_async_wait_response(token, msg); - if (ret) { - pr_err(%s: Failed to wait for the async response, %d\n, - __func__, ret); - goto out_token; - } + ret = opal_error_code(be64_to_cpu(msg.params[1])); + *sensor_data = be32_to_cpu(data); + break; - *sensor_data = be32_to_cpu(data); - ret = opal_error_code(be64_to_cpu(msg.params[1])); + case OPAL_SUCCESS: + ret = 0; + *sensor_data = be32_to_cpu(data); + break; + + default: + ret = opal_error_code(ret); + break; + } out_token: mutex_unlock(opal_sensor_mutex); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v3, 2/3] powerpc/powernv: Move cpuidle related code from setup.c to new file
On Sun, 2015-22-03 at 04:42:58 UTC, Shreyas B. Prabhu wrote: This is a cleanup patch; doesn't change any functionality. Moves all cpuidle related code from setup.c to a new file. Signed-off-by: Shreyas B. Prabhu shre...@linux.vnet.ibm.com --- This patch is new in v3 arch/powerpc/platforms/powernv/Makefile | 2 +- arch/powerpc/platforms/powernv/idle.c | 186 arch/powerpc/platforms/powernv/setup.c | 166 Sorry this no longer applies, because I merged some changes from Preeti to __init pnv_init_idle_states(). Can you please rebase on top of linux-next, or my next. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 3/3] powerpc/powernv: remove opal_sensor_mutex
On 03/30/2015 08:59 AM, Michael Ellerman wrote: On Mon, 2015-03-30 at 08:51 +0200, Cedric Le Goater wrote: On 03/30/2015 04:09 AM, Michael Ellerman wrote: On Fri, 2015-03-27 at 17:39 +0100, Cédric Le Goater wrote: The opal sensor mutex protects the opal_sensor_read call which can return a OPAL_BUSY code on IBM Power systems if a previous request is in progress. This can be handled at user level with a retry. It can, but how does it actually look in practice? It looks like the only use of opal_get_sensor_data() is show_sensor() in drivers/hwmon/ibmpowernv.c. Because that's a sysfs attribute folks will be generally just dumping that with cat, or reading it in a shell script, neither of which will cope nicely with EBUSY I think? It won't, I agree but it should only happen when running concurrent cat commands on the hwmon sysfs files. The event should be rare enough. Rare enough maybe, but a real pain in the .. to cope with in a shell script if you're trying to automate something. Anyhow, this is not a big issue. We can drop that patch. The real issue is the time it takes to get some values back from the FSP. This is what user space has been most surprised about. OK. The other option would be to move the mutex into the sysfs show routine, so only that is synchronous. That would give you nice behaviour from cat, ie. it would sleep on contention but still be killable with ctrl-c. Let's keep it how it is and see if it is possible to the improve OPAL side first. I will send you an updated patchset shortly. Thanks for the review. C. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 1/2] powerpc/powernv: convert codes returned by OPAL calls
OPAL has its own list of return codes. The patch provides a translation of such codes in errnos for the opal_sensor_read call, and possibly others if needed. Signed-off-by: Cédric Le Goater c...@fr.ibm.com --- Changes since v3 : - reworked the return codes a little as suggested by Michael Ellerman Changes since v2 : - renamed and moved the routine to opal.[ch] - changed default value to ERANGE like rtas arch/powerpc/include/asm/opal.h |2 ++ arch/powerpc/platforms/powernv/opal-sensor.c |6 -- arch/powerpc/platforms/powernv/opal.c| 19 +++ 3 files changed, 25 insertions(+), 2 deletions(-) Index: linux.git/arch/powerpc/platforms/powernv/opal-sensor.c === --- linux.git.orig/arch/powerpc/platforms/powernv/opal-sensor.c +++ linux.git/arch/powerpc/platforms/powernv/opal-sensor.c @@ -46,8 +46,10 @@ int opal_get_sensor_data(u32 sensor_hndl mutex_lock(opal_sensor_mutex); ret = opal_sensor_read(sensor_hndl, token, data); - if (ret != OPAL_ASYNC_COMPLETION) + if (ret != OPAL_ASYNC_COMPLETION) { + ret = opal_error_code(ret); goto out_token; + } ret = opal_async_wait_response(token, msg); if (ret) { @@ -57,7 +59,7 @@ int opal_get_sensor_data(u32 sensor_hndl } *sensor_data = be32_to_cpu(data); - ret = be64_to_cpu(msg.params[1]); + ret = opal_error_code(be64_to_cpu(msg.params[1])); out_token: mutex_unlock(opal_sensor_mutex); Index: linux.git/arch/powerpc/include/asm/opal.h === --- linux.git.orig/arch/powerpc/include/asm/opal.h +++ linux.git/arch/powerpc/include/asm/opal.h @@ -983,6 +983,8 @@ struct opal_sg_list *opal_vmalloc_to_sg_ unsigned long vmalloc_size); void opal_free_sg_list(struct opal_sg_list *sg); +extern int opal_error_code(int rc); + /* * Dump region ID range usable by the OS */ Index: linux.git/arch/powerpc/platforms/powernv/opal.c === --- linux.git.orig/arch/powerpc/platforms/powernv/opal.c +++ linux.git/arch/powerpc/platforms/powernv/opal.c @@ -894,6 +894,25 @@ void opal_free_sg_list(struct opal_sg_li } } +int opal_error_code(int rc) +{ + switch (rc) { + case OPAL_SUCCESS: return 0; + + case OPAL_PARAMETER:return -EINVAL; + case OPAL_ASYNC_COMPLETION: return -EINPROGRESS; + case OPAL_BUSY_EVENT: return -EBUSY; + case OPAL_NO_MEM: return -ENOMEM; + + case OPAL_UNSUPPORTED: return -EIO; + case OPAL_HARDWARE: return -EIO; + case OPAL_INTERNAL_ERROR: return -EIO; + default: + pr_err(%s: unexpected OPAL error %d\n, __func__, rc); + return -EIO; + } +} + EXPORT_SYMBOL_GPL(opal_poll_events); EXPORT_SYMBOL_GPL(opal_rtc_read); EXPORT_SYMBOL_GPL(opal_rtc_write); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v7 RFC 1/3] sparc: Break up monolithic iommu table/lock into finer graularity pools and lock
On Mon, 2015-03-30 at 06:38 -0400, Sowmini Varadhan wrote: On (03/30/15 14:24), Benjamin Herrenschmidt wrote: + +#define IOMMU_POOL_HASHBITS 4 +#define IOMMU_NR_POOLS (1 IOMMU_POOL_HASHBITS) I don't like those macros. You changed the value from what we had on powerpc. It could be that the new values are as good for us but I'd like to do a bit differently. Can you make the bits a variable ? Or at least an arch-provided macro which we can change later if needed ? Actuallly, this are just the upper bound (16) on the number of pools. The actual number is selected by the value passed to the iommu_tbl_range_init(), and is not hard-coded (as was the case with the power-pc code). Thus powerpc can continue to use 4 pools without any loss of generality. Right, but it affects the way we hash... not a huge deal though. : Let's make it clear that this is for allocation of DMA space only, it would thus make my life easier when adapting powerpc to use a different names, something like struct iommu_area works for me, or iommu alloc_region .. whatever you fancy the most. : Why adding the 'arena' prefix ? What was wrong with pools in the powerpc imlementation ? for the same reason you want to re-baptize iommu_table above- at the time, I was doing it to minimize conflicts with existing usage. But I can rename everything if you like. But in that case it doesn't make much sense and makes the names longer. Those are just pools, it's sufficient. +#define IOMMU_LARGE_ALLOC15 Make that a variable, here too, the arch might want to tweak it. I think 15 is actually not a good value for powerpc with 4k iommu pages and 64k PAGE_SIZE, we should make the above some kind of factor of PAGE_SHIFT - iommu_page_shift. Ok. + /* Sanity check */ + if (unlikely(npages == 0)) { + printk_ratelimited(npages == 0\n); You removed the WARN_ON here which had the nice property of giving you a backtrace which points to the offender. The above message alone is useless. yes, the original code was generating checkpatch warnings and errors. That's why I removed it. Put it back please, and ignore checkpatch, it's become an annoyance more than anything else. Note that nowadays, you can probably use WARN_ON_ONCE(npages == 0); in place of the whole construct. I am not certain about the first unlocked pool... We take the lock for a fairly short amount of time, I have the gut feeling that the cache line bouncing introduced by looking at a different pool may well cost more than waiting a bit longer. Did do some measurements of that optimisation ? if you are really only taking it for a short amount of time, then the trylock should just succeed, so there is no cache line bouncing. No that's not my point. The lock is only taken for a short time but might still collide, the bouncing in that case will probably (at least that's my feeling) hurt more than help. However, I have another concern with your construct. Essentially you spin looking for an unlocked pool without a cpu_relax. Now it's unlikely but you *can* end up eating cycles, which on a high SMT like POWER8 might mean slowing down the actual owner of the pool lock. But yes, I did instrument it with iperf, and there was lock contention on the spinlock, which was eliminted by the trylock. What is iperf ? What does that mean there was lock contention ? IE, was the overall performance improved or not ? Removing contention by trading it for cache line bouncing will not necessarily help. I'm not saying this is a bad optimisation but it makes the code messy and I think deserves some solid numbers demonstrating its worth. I'll fix the rest of the variable naming etc nits and send out a new version later today. There was also an actual bug in the case where you hop'ed to a new pool and forgot the flush. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 07/27] powerpc: ppc_md.pci_dma_dev_setup - pci_controller_ops.dma_dev_setup
On Wed, 2015-25-03 at 05:35:41 UTC, Daniel Axtens wrote: Write changelogs! Also this doesn't do what the subject suggests, it just introduces the ops version and adds the shim. It doesn't do all the conversions. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/include/asm/pci-bridge.h | 14 ++ arch/powerpc/kernel/pci-common.c | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 3ab8a2d..2474f29 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -18,6 +18,7 @@ struct device_node; * PCI controller operations */ struct pci_controller_ops { + void(*dma_dev_setup)(struct pci_dev *dev); }; /* @@ -265,5 +266,18 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address) } #endif /* CONFIG_PCI */ +/* + * Shims to prefer pci_controller version over ppc_md where available. + */ +static inline void dma_dev_setup(struct pci_dev *dev) This should be called pci_dma_dev_setup() while it exists IMHO. +{ + struct pci_controller *hose = pci_bus_to_host(dev-bus); I know historically we've called them hose, but there's also a lot of code that uses phb and that is a MUCH better name, so please use that. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v7 RFC 1/3] sparc: Break up monolithic iommu table/lock into finer graularity pools and lock
On (03/30/15 21:55), Benjamin Herrenschmidt wrote: No that's not my point. The lock is only taken for a short time but might still collide, the bouncing in that case will probably (at least that's my feeling) hurt more than help. However, I have another concern with your construct. Essentially you spin looking for an unlocked pool without a cpu_relax. Now it's unlikely but you *can* end up eating cycles, which on a high SMT like POWER8 might mean slowing down the actual owner of the pool lock. So I tried looking at the code, and perhaps there is some arch-specific subtlety here that I am missing, but where does spin_lock itself do the cpu_relax? afaict, LOCK_CONTENDED() itself does not have this. What is iperf ? What does that mean there was lock contention ? IE, was the overall performance improved or not ? Removing contention by trading it for cache line bouncing will not necessarily help. I'm not saying this is a bad optimisation but it makes the code messy and I think deserves some solid numbers demonstrating its worth. iperf is a network perf benchmark. I'll try to regenerate some numbers today and get some instrumentation of cache-line bounces vs trylock misses. There was also an actual bug in the case where you hop'ed to a new pool and forgot the flush. yes, thanks for catching that, I'll fix that too, of course. --Sowmini ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[3.16.y-ckt stable] Patch timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop has been added to staging queue
This is a note to let you know that I have just added a patch titled timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue This patch is scheduled to be released in version 3.16.7-ckt10. If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.16.y-ckt tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Luis -- From 6cbc6fd5f987aea28ede4c2774830f0c48b885e6 Mon Sep 17 00:00:00 2001 From: Preeti U Murthy pre...@linux.vnet.ibm.com Date: Wed, 18 Mar 2015 16:19:27 +0530 Subject: timers/tick/broadcast-hrtimer: Fix suspicious RCU usage in idle loop commit a127d2bcf1fbc8c8e0b5cf0dab54f7d3ff50ce47 upstream. The hrtimer mode of broadcast queues hrtimers in the idle entry path so as to wakeup cpus in deep idle states. The associated call graph is : cpuidle_idle_call() | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, )) |_tick_broadcast_set_event() |clockevents_program_event() |bc_set_next() The hrtimer_{start/cancel} functions call into tracing which uses RCU. But it is not legal to call into RCU in cpuidle because it is one of the quiescent states. Hence protect this region with RCU_NONIDLE which informs RCU that the cpu is momentarily non-idle. As an aside it is helpful to point out that the clock event device that is programmed here is not a per-cpu clock device; it is a pseudo clock device, used by the broadcast framework alone. The per-cpu clock device programming never goes through bc_set_next(). Signed-off-by: Preeti U Murthy pre...@linux.vnet.ibm.com Signed-off-by: Peter Zijlstra (Intel) pet...@infradead.org Reviewed-by: Paul E. McKenney paul...@linux.vnet.ibm.com Cc: linuxppc-...@ozlabs.org Cc: m...@ellerman.id.au Cc: t...@linutronix.de Link: http://lkml.kernel.org/r/20150318104705.17763.56668.st...@preeti.in.ibm.com Signed-off-by: Ingo Molnar mi...@kernel.org Signed-off-by: Luis Henriques luis.henriq...@canonical.com --- kernel/time/tick-broadcast-hrtimer.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadcast-hrtimer.c index eb682d5c697c..6aac4beedbbe 100644 --- a/kernel/time/tick-broadcast-hrtimer.c +++ b/kernel/time/tick-broadcast-hrtimer.c @@ -49,6 +49,7 @@ static void bc_set_mode(enum clock_event_mode mode, */ static int bc_set_next(ktime_t expires, struct clock_event_device *bc) { + int bc_moved; /* * We try to cancel the timer first. If the callback is on * flight on some other cpu then we let it handle it. If we @@ -60,9 +61,15 @@ static int bc_set_next(ktime_t expires, struct clock_event_device *bc) * restart the timer because we are in the callback, but we * can set the expiry time and let the callback return * HRTIMER_RESTART. +* +* Since we are in the idle loop at this point and because +* hrtimer_{start/cancel} functions call into tracing, +* calls to these functions must be bound within RCU_NONIDLE. */ - if (hrtimer_try_to_cancel(bctimer) = 0) { - hrtimer_start(bctimer, expires, HRTIMER_MODE_ABS_PINNED); + RCU_NONIDLE(bc_moved = (hrtimer_try_to_cancel(bctimer) = 0) ? + !hrtimer_start(bctimer, expires, HRTIMER_MODE_ABS_PINNED) : + 0); + if (bc_moved) { /* Bind the device to the cpu */ bc-bound_on = smp_processor_id(); } else if (bc-bound_on == smp_processor_id()) { ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/27] powerpc/swiotlb: give init call a less misleading name
On Wed, 2015-25-03 at 05:35:37 UTC, Daniel Axtens wrote: swiotlb_late_init sets up platform specific hooks. It's not actually a late initcall, but a subsys initcall, called much earlier. Ideally we'd call it swiotlb_init, but that's taken. Call it swiotlb_subsys_init for now. (It will be refactored and renamed later.) AFAICS you just end up renaming this anyway, so I don't think you need to bother with this patch. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: nouveau regression on G5 Dual Core
On Sat, Mar 28, Olaf Hering wrote: On Sat, Mar 28, Olaf Hering wrote: I just updated the kernel from some 3.18 based state to 4.0-rc5+. The 3.19 is already broken, will bisect next week. After a first run I was able to boot prior the first bad commit, which caused a crash on boot. Now I have to find the commit which actually allows boot again, but with the white screen. Ben, was ad4a362635353f7ceb66f4038269770fee1025fa tested on a pmac? Olaf root@g5:~/work/kernel/linux # git bisect log git bisect start # good: [b2776bf7149bddd1f4161f14f79520f17fc1d71d] Linux 3.18 git bisect good b2776bf7149bddd1f4161f14f79520f17fc1d71d # bad: [bfa76d49576599a4b9f9b7a71f23d73d6dcff735] Linux 3.19 git bisect bad bfa76d49576599a4b9f9b7a71f23d73d6dcff735 # good: [54850e73e86e3bc092680d1bdb84eb322f982ab1] zram: change parameter from vaild_io_request() git bisect good 54850e73e86e3bc092680d1bdb84eb322f982ab1 # bad: [dab363f938a53ddaee60bfecc1aebdbb3d3af5f0] Merge tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging git bisect bad dab363f938a53ddaee60bfecc1aebdbb3d3af5f0 # good: [26178ec11ef3c6c814bf16a0a2b9c2f7242e3c64] x86: mm: consolidate VM_FAULT_RETRY handling git bisect good 26178ec11ef3c6c814bf16a0a2b9c2f7242e3c64 # good: [1b4bcf1fedbe7dcd98d9d35dfc947f033a398c4d] staging: comedi: addi_tcw.h: provide generic defines for the ADDI-DATA TCW git bisect good 1b4bcf1fedbe7dcd98d9d35dfc947f033a398c4d # good: [030794a368946b98a8252d3172f5f2a1b0e4fb0e] drm/exynos: Fix DSI resuming fail because power domain being off git bisect good 030794a368946b98a8252d3172f5f2a1b0e4fb0e # bad: [59ea90543f57a40827d7d1e528d657b8cc7161b1] drm/i915: Implement GPU reset for 915/945 git bisect bad 59ea90543f57a40827d7d1e528d657b8cc7161b1 # bad: [37025602f6abc5919c7d5a8517bc7d6ea08acc57] drm/nouveau/platform: add GPU speedo information to nouveau platform git bisect bad 37025602f6abc5919c7d5a8517bc7d6ea08acc57 # good: [33f86ff62c4368c8d6bf3c76dc2fa416e3f90213] Merge branch 'amdkfd-next-3.19' of git://people.freedesktop.org/~gabbayo/linux into drm-next git bisect good 33f86ff62c4368c8d6bf3c76dc2fa416e3f90213 # bad: [1f89b4756fb83f385ac0e277b092774c01a5ab9c] drm/gm204/disp: initial support git bisect bad 1f89b4756fb83f385ac0e277b092774c01a5ab9c # bad: [c2c2f6cb79141ca22f84c36887fd867373c35c4e] drm/nouveau/bios: fetch images beyond the first one in the rom git bisect bad c2c2f6cb79141ca22f84c36887fd867373c35c4e # good: [9c8af882bf1230bb85c1dbf67e0dde6888223ceb] drm: Add adv7511 encoder driver git bisect good 9c8af882bf1230bb85c1dbf67e0dde6888223ceb # good: [4894f6628e1ae04b2cc6222df692364c1ac1250f] drm/nouveau: a, somehow, missed hunk of fix regression on agp boards git bisect good 4894f6628e1ae04b2cc6222df692364c1ac1250f # bad: [ad4a362635353f7ceb66f4038269770fee1025fa] drm/nouveau/bios: split out shadow methods git bisect bad ad4a362635353f7ceb66f4038269770fee1025fa # good: [e8972421623cd10a12cc7343da029b58777fdd2f] drm/nouveau/bios: fix thinko when parsing extdev table git bisect good e8972421623cd10a12cc7343da029b58777fdd2f # first bad commit: [ad4a362635353f7ceb66f4038269770fee1025fa] drm/nouveau/bios: split out shadow methods Olaf ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v7 RFC 1/3] sparc: Break up monolithic iommu table/lock into finer graularity pools and lock
On (03/30/15 14:24), Benjamin Herrenschmidt wrote: + +#define IOMMU_POOL_HASHBITS 4 +#define IOMMU_NR_POOLS (1 IOMMU_POOL_HASHBITS) I don't like those macros. You changed the value from what we had on powerpc. It could be that the new values are as good for us but I'd like to do a bit differently. Can you make the bits a variable ? Or at least an arch-provided macro which we can change later if needed ? Actuallly, this are just the upper bound (16) on the number of pools. The actual number is selected by the value passed to the iommu_tbl_range_init(), and is not hard-coded (as was the case with the power-pc code). Thus powerpc can continue to use 4 pools without any loss of generality. : Let's make it clear that this is for allocation of DMA space only, it would thus make my life easier when adapting powerpc to use a different names, something like struct iommu_area works for me, or iommu alloc_region .. whatever you fancy the most. : Why adding the 'arena' prefix ? What was wrong with pools in the powerpc imlementation ? for the same reason you want to re-baptize iommu_table above- at the time, I was doing it to minimize conflicts with existing usage. But I can rename everything if you like. +#define IOMMU_LARGE_ALLOC 15 Make that a variable, here too, the arch might want to tweak it. I think 15 is actually not a good value for powerpc with 4k iommu pages and 64k PAGE_SIZE, we should make the above some kind of factor of PAGE_SHIFT - iommu_page_shift. Ok. + /* Sanity check */ + if (unlikely(npages == 0)) { + printk_ratelimited(npages == 0\n); You removed the WARN_ON here which had the nice property of giving you a backtrace which points to the offender. The above message alone is useless. yes, the original code was generating checkpatch warnings and errors. That's why I removed it. I am not certain about the first unlocked pool... We take the lock for a fairly short amount of time, I have the gut feeling that the cache line bouncing introduced by looking at a different pool may well cost more than waiting a bit longer. Did do some measurements of that optimisation ? if you are really only taking it for a short amount of time, then the trylock should just succeed, so there is no cache line bouncing. But yes, I did instrument it with iperf, and there was lock contention on the spinlock, which was eliminted by the trylock. I'll fix the rest of the variable naming etc nits and send out a new version later today. --Sowmini ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init
On Wed, 2015-25-03 at 05:35:38 UTC, Daniel Axtens wrote: The only function that checks ppc_swiotlb_enable is swiotlb_subsys_init. .. which is a subsys initcall. The code in fsl_pci.c is called well after that, so don't bother changing it. Hmm, I think we got this wrong. I don't remember exactly but it was probably me who told you it could be removed, but I probably hadn't had a coffee yet :} I see setup_pci_atmu() called by fsl_pci_syscore_do_resume(), ie. at runtime == late. So ignore that. But also fsl_add_bridge(), called from fsl_pci_probe(), which is a platform driver, registered at arch initcall via fsl_pci_init(). arch initcall happens *before* subsys, so in that case this will be effective. So I think we need to leave it alone. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: Export __spin_yield
On Mon, 2015-03-30 at 12:17 +0200, Geert Uytterhoeven wrote: Hi Ben, On Fri, Mar 20, 2015 at 12:08 AM, Paul Mackerras pau...@samba.org wrote: On Wed, Feb 25, 2015 at 05:23:53PM -0600, Suresh E. Warrier wrote: Export __spin_yield so that the arch_spin_unlock() function can be invoked from a module. This will be required for modules where we want to take a lock that is also is acquired in hypervisor real mode. Because we want to avoid running any lockdep code (which may not be safe in real mode), this lock needs to be an arch_spinlock_t instead of a normal spinlock. Signed-off-by: Suresh Warrier warr...@linux.vnet.ibm.com Acked-by: Paul Mackerras pau...@samba.org Something went wrong when applying this, as it ended up as: Ugh, weird. I must have fucked up something when rebasing. I don't want to rebase that branch now that it's out, I know of at least one series based on it. We'll live with it. commit 1f8c82ab1b0bc7e24601c0fca411fd27b9c883ef Author: Geert Uytterhoeven geert+rene...@glider.be Date: Wed Mar 4 12:56:20 2015 +0100 cpufreq/ppc: Add missing #include asm/smp.h If CONFIG_SMP=n, linux/smp.h does not include asm/smp.h, causing: drivers/cpufreq/ppc-corenet-cpufreq.c: In function 'corenet_cpufreq_cpu_init drivers/cpufreq/ppc-corenet-cpufreq.c:173:3: error: implicit declaration of X-Patchwork-Id: 443703 Message-Id: 54ee5989.7010...@linux.vnet.ibm.com To: linuxppc-...@ozlabs.org Date: Wed, 25 Feb 2015 17:23:53 -0600 Export __spin_yield so that the arch_spin_unlock() function can be invoked from a module. This will be required for modules where we want to take a lock that is also is acquired in hypervisor real mode. Because we want to avoid running any lockdep code (which may not be safe in real mode), this lock needs to be an arch_spinlock_t instead of a normal spinlock. Signed-off-by: Suresh Warrier warr...@linux.vnet.ibm.com Acked-by: Paul Mackerras pau...@samba.org Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote: Why did we move it? Just for cleanliness? Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/powermac/pci.c | 17 + arch/powerpc/platforms/powermac/pmac.h | 4 arch/powerpc/platforms/powermac/setup.c | 18 -- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index f4071a6..a792f45 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev) pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); + +#ifdef CONFIG_PPC64 +int pmac_pci_probe_mode(struct pci_bus *bus) +{ + struct device_node *node = pci_bus_to_OF_node(bus); + + /* We need to use normal PCI probing for the AGP bus, + * since the device for the AGP bridge isn't in the tree. + * Same for the PCIe host on U4 and the HT host bridge. + */ + if (bus-self == NULL (of_device_is_compatible(node, u3-agp) || + of_device_is_compatible(node, u4-pcie) || + of_device_is_compatible(node, u3-ht))) + return PCI_PROBE_NORMAL; + return PCI_PROBE_DEVTREE; +} +#endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index 8327cce..46d2193 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); extern int pmac_nvram_init(void); extern void pmac_pic_init(void); +#ifdef CONFIG_PPC64 +extern int pmac_pci_probe_mode(struct pci_bus *bus); +#endif You don't need to ifdef declarations, and you don't need extern. So just: +int pmac_pci_probe_mode(struct pci_bus *bus); Is fine. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v3, 3/3] powerpc/powernv: Introduce sysfs control for fastsleep workaround behavior
On Sun, 2015-22-03 at 04:42:59 UTC, Shreyas B. Prabhu wrote: Fastsleep is one of the idle state which cpuidle subsystem currently uses on power8 machines. In this state L2 cache is brought down to a threshold voltage. Therefore when the core is in fastsleep, the communication between L2 and L3 needs to be fenced. But there is a bug in the current power8 chips surrounding this fencing. OPAL provides a workaround which precludes the possibility of hitting this bug. But running with this workaround applied causes checkstop if any correctable error in L2 cache directory is detected. Hence OPAL also provides a way to undo the workaround. In the existing implementation, workaround is applied by the last thread of the core entering fastsleep and undone by the first thread waking up. But this has a performance cost. These OPAL calls account for roughly 4000 cycles everytime the core has to enter or wakeup from fastsleep. This patch introduces a sysfs attribute (fastsleep_workaround_state) to choose the behavior of this workaround. By default, fastsleep_workaround_state = 0. In this case, workaround is applied/undone everytime the core enters/exits fastsleep. fastsleep_workaround_state = 1. In this case the workaround is applied once on all the cores and never undone. This can be triggered by echo 1 /sys/devices/system/cpu/fastsleep_workaround_state For simplicity this attribute can be modified only once. Implying, once fastsleep_workaround_state is changed to 1, it cannot be reverted to the default state. This sounds good, although the name is a bit vague. Just calling it state doesn't make it clear what 0 and 1 mean. I think better would be fastsleep_workaround_active ? Though even that is a bit wrong, because 0 doesn't really mean it's not active, it means it's not *permanently* active. So another option would be to make it a string attribute, with the initial state being eg. dynamic and then maybe applied for the applied state? I won't say you have to do that, but think about it, seeing as I'm going to ask for a v4 anyway (see comments below). diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 9ee0a30..8bea8fc 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -180,6 +180,13 @@ struct opal_sg_list { #define OPAL_PM_WINKLE_ENABLED 0x0004 #define OPAL_PM_SLEEP_ENABLED_ER10x0008 +/* + * OPAL_CONFIG_CPU_IDLE_STATE parameters + */ +#define OPAL_CONFIG_IDLE_FASTSLEEP 1 +#define OPAL_CONFIG_IDLE_UNDO0 +#define OPAL_CONFIG_IDLE_APPLY 1 The OPAL defines have moved to opal-api.h in Linux. They should also be made #defines in skiboot. diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c index 77992f6..79157b9 100644 --- a/arch/powerpc/platforms/powernv/idle.c +++ b/arch/powerpc/platforms/powernv/idle.c @@ -13,6 +13,8 @@ #include linux/mm.h #include linux/slab.h #include linux/of.h +#include linux/device.h +#include linux/cpu.h #include asm/firmware.h #include asm/opal.h @@ -136,6 +138,77 @@ u32 pnv_get_supported_cpuidle_states(void) } EXPORT_SYMBOL_GPL(pnv_get_supported_cpuidle_states); +static void pnv_fastsleep_workaround_apply(void *info) +{ + opal_config_cpu_idle_state(OPAL_CONFIG_IDLE_FASTSLEEP, + OPAL_CONFIG_IDLE_APPLY); This can fail, please check the return. You'll need to report the result via *info. +} + +/* + * Used to store fastsleep workaround state + * 0 - Workaround applied/undone at fastsleep entry/exit path (Default) + * 1 - Workaround applied once, never undone. + */ +static u8 fastsleep_workaround_state; + +static ssize_t show_fastsleep_workaround_state(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, %u\n, fastsleep_workaround_state); +} + +static ssize_t store_fastsleep_workaround_state(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t count) +{ + u32 val; + cpumask_t primary_thread_mask; + + /* + * fastsleep_workaround_state is write-once parameter. + * Once it has been set to 1, it cannot be undone. + */ + if (fastsleep_workaround_state == 1) + return -EINVAL; Better behaviour here is to delay this check until after you've done the kstrtou32(), and if they are asking to set it to 1 (again) then you just return count (OK). That way scripts can just echo 1 .. and if the workaround is already applied then there is no error. + if (kstrtou32(buf, 0, val)) + return -EINVAL; You use a u8 above, so why not a u8 here? + if (val 1) + return -EINVAL; + + fastsleep_workaround_state = 1; You should delay setting this until below when you know it's succeeded. + /* + *
RE: [1/4] powerpc/fsl-booke: Add device tree support for T1024/T1023 SoC
-Original Message- From: Wood Scott-B07421 Sent: Friday, January 30, 2015 9:20 AM To: Liu Shengzhou-B36685 Cc: linuxppc-dev@lists.ozlabs.org Subject: Re: [1/4] powerpc/fsl-booke: Add device tree support for T1024/T1023 SoC On Thu, Jan 29, 2015 at 03:52:24PM +0800, Shengzhou Liu wrote: + corenet-cf@18000 { + compatible = fsl,corenet2-cf; While the damage has already been done by the t1040 device tree, this is not 100% compatible with what's on t4240. I'm not sure if it's worth doing anything about it at this point, given that you can tell the difference by the version register even though that register is reserved on t4240 and simliar chips, which is what I do in http://patchwork.ozlabs.org/patch/419911/ Now here fsl,corenet2-cf is suitable for t1024 after your t1040 patch was merged. T1024 and t1040 have the same version of ccf. + reg = 0x18000 0x1000; + interrupts = 16 2 1 31; + fsl,ccf-num-csdids = 32; + fsl,ccf-num-snoopids = 32; The t1040/t1024 CCM does not have CSD/Snoop IDs. Removed. +/include/ qoriq-i2c-0.dtsi +/include/ qoriq-i2c-1.dtsi t1023 has only three i2c controllers -- where do you disable the fourth? u-boot will disable the fourth i2c controller. +/include/ t1023si-post.dtsi +soc { + display:display@18 { + compatible = fsl,t1024-diu, fsl,diu; + reg = 0x18 1000; + interrupts = 74 2 0 0; + }; +}; There are other differences between t1023 an t1024. Where do you describe t1024's QE? Where do you describe the DDR and IFC differences? can they be detected at runtime? t1024 supports deep sleep, but t1023 doesn't -- yet you label both chips as having t1024 rcpm. As QE IP block has not been upstream yet, so have to removed QE info in dts currently(same on t1040), DDR and IFC differences are in u-boot, not in dts. Both t1023 and t1024 support sleep, so label both chips as having t1024 rcpm. Only t1024 has deep sleep, the difference is identified in *.c not in dts (confirmed with deep sleep owner). ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 06/27] powerpc: Create the pci_controller_ops struct.
On Wed, 2015-25-03 at 05:35:40 UTC, Daniel Axtens wrote: Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/include/asm/pci-bridge.h | 7 +++ 1 file changed, 7 insertions(+) That's taking splitting patches to the next level :) Just fold this into the next one where you first need it. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 0/2] Add SDHCI support for APM X-Gene SoC using ARASAN SDHCI controller.
This patch adds the SDHCI support for APM X-Gene SoC using ARASAN SDHCI controller. v1 change: * Use the CONFIG_ARM64_DMA_HAS_IOMMU for dma-mapping. v2 change: * Drop the IOMMU support and switching to PIO mode for arasan controller integrated inside APM X-Gene SoC. Signed-off-by: Suman Tripathi stripa...@apm.com Suman Tripathi (2): arm64: dts: Add the arasan sdhc nodes in apm-storm.dtsi. mmc: host: Add some quirks to be read from fdt in sdhci-pltm.c arch/arm64/boot/dts/apm-storm.dtsi | 44 ++ drivers/mmc/host/sdhci-pltfm.c | 15 + 2 files changed, 59 insertions(+) -- 1.8.2.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 2/2] mmc: host: Add some quirks to be read from fdt in sdhci-pltm.c
This patch adds some quirks support to be read from fdt. Signed-off-by: Suman Tripathi stripa...@apm.com --- drivers/mmc/host/sdhci-pltfm.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index bef250e..9f6a4b9 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -85,6 +85,21 @@ void sdhci_get_of_property(struct platform_device *pdev) if (of_get_property(np, broken-cd, NULL)) host-quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; + + if (of_get_property(np, delay-after-power, NULL)) + host-quirks |= SDHCI_QUIRK_DELAY_AFTER_POWER; + + if (of_get_property(np, no-hispd, NULL)) + host-quirks |= SDHCI_QUIRK_NO_HISPD_BIT; + + if (of_get_property(np, broken-adma, NULL)) + host-quirks |= SDHCI_QUIRK_BROKEN_ADMA; + + if (of_get_property(np, broken-dma, NULL)) + host-quirks |= SDHCI_QUIRK_BROKEN_DMA; + + if (of_get_property(np, no-cmd23, NULL)) + host-quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23; if (of_get_property(np, no-1-8-v, NULL)) host-quirks2 |= SDHCI_QUIRK2_NO_1_8_V; -- 1.8.2.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 1/2] arm64: dts: Add the arasan sdhc nodes in apm-storm.dtsi.
This patch adds the arasan sdhc nodes to reuse the of-arasan driver for APM X-Gene SoC. Signed-off-by: Suman Tripathi stripa...@apm.com --- arch/arm64/boot/dts/apm-storm.dtsi | 44 ++ 1 file changed, 44 insertions(+) diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi index c5f0a47..fd1c142 100644 --- a/arch/arm64/boot/dts/apm-storm.dtsi +++ b/arch/arm64/boot/dts/apm-storm.dtsi @@ -144,6 +144,40 @@ clock-output-names = socplldiv2; }; + ahbclk: ahbclk@1f2ac000 { + compatible = apm,xgene-device-clock; + #clock-cells = 1; + clocks = socplldiv2 0; + reg = 0x0 0x1f2ac000 0x0 0x1000 + 0x0 0x1700 0x0 0x2000; + reg-names = csr-reg, div-reg; + csr-offset = 0x0; + csr-mask = 0x1; + enable-offset = 0x8; + enable-mask = 0x1; + divider-offset = 0x164; + divider-width = 0x5; + divider-shift = 0x0; + clock-output-names = ahbclk; + }; + + sdioclk: sdioclk@1f2ac000 { + compatible = apm,xgene-device-clock; + #clock-cells = 1; + clocks = socplldiv2 0; + reg = 0x0 0x1f2ac000 0x0 0x1000 + 0x0 0x1700 0x0 0x2000; + reg-names = csr-reg, div-reg; + csr-offset = 0x0; + csr-mask = 0x2; + enable-offset = 0x8; + enable-mask = 0x2; + divider-offset = 0x178; + divider-width = 0x8; + divider-shift = 0x0; + clock-output-names = sdioclk; + }; + qmlclk: qmlclk { compatible = apm,xgene-device-clock; #clock-cells = 1; @@ -282,6 +316,16 @@ interrupts = 0x0 0x4c 0x4; }; + sdhc0: sdhc@1c00 { + device_type = sdhc; + compatible = arasan,sdhci-8.9a; + reg = 0x0 0x1c00 0x0 0x100; + interrupts = 0x0 0x49 0x4; + dma-coherent; + clock-names = clk_xin, clk_ahb; + clocks = sdioclk 0, ahbclk 0; + }; + phy1: phy@1f21a000 { compatible = apm,xgene-phy; reg = 0x0 0x1f21a000 0x0 0x100; -- 1.8.2.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v3, 1/3] powerpc: Fix cpu_online_cores_map to return only online threads mask
On Monday 30 March 2015 03:06 PM, Michael Ellerman wrote: On Sun, 2015-22-03 at 04:42:57 UTC, Shreyas B. Prabhu wrote: Currently, cpu_online_cores_map returns a mask, which for every core that has atleast one online thread, has the first-cpu-of-that-core's bit set. ... which for every core with at least one online thread, has the bit for thread 0 of the core set to 1, and the bits for all other threads of the core set to 0. Maybe that's clearer? But the first cpu itself may not be online always. In such cases, if ^ of the core the returned mask is used for IPI, then it'll cause IPIs to be skipped on cores where the first thread is offline. .. because the IPI code refuses to send IPIs to offline threads, right? Yes. Fix this by setting first-online-cpu-of-the-core's bit in the mask. .. by setting the bit of the first online thread in the core. This is done by fixing this in the underlying function cpu_thread_mask_to_cores. The result has the property that for all cores with online threads, there is one bit set in the returned map. And further, all bits that are set in the returned map correspond to online threads. Signed-off-by: Shreyas B. Prabhu shre...@linux.vnet.ibm.com --- This patch is new in v3 In an example scenario where all the threads of 1st core are offline and argument to cpu_thread_mask_to_cores is cpu_possible_mask, with this implementation, return value will not have any bit corresponding to 1st core set. I think that should be okay. Any thoughts? Looking at linux-next: $ git grep cpu_thread_mask_to_cores arch/powerpc/include/asm/cputhreads.h:/* cpu_thread_mask_to_cores - Return a cpumask of one per cores arch/powerpc/include/asm/cputhreads.h:static inline cpumask_t cpu_thread_mask_to_cores(const struct cpumask *threads) arch/powerpc/include/asm/cputhreads.h: return cpu_thread_mask_to_cores(cpu_online_mask); $ git grep cpu_online_cores_map arch/powerpc/include/asm/cputhreads.h:static inline cpumask_t cpu_online_cores_map(void) ie. There are no users. So yeah I think we can change the semantics of this, and the semantics you describe make sense. If you agree with my changelog comments I'm happy to fix that up and merge this, or you can send a v4 if you like. I'll fix the changelog in v4. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v3, 3/3] powerpc/powernv: Introduce sysfs control for fastsleep workaround behavior
On Monday 30 March 2015 03:51 PM, Michael Ellerman wrote: On Sun, 2015-22-03 at 04:42:59 UTC, Shreyas B. Prabhu wrote: Fastsleep is one of the idle state which cpuidle subsystem currently uses on power8 machines. In this state L2 cache is brought down to a threshold voltage. Therefore when the core is in fastsleep, the communication between L2 and L3 needs to be fenced. But there is a bug in the current power8 chips surrounding this fencing. OPAL provides a workaround which precludes the possibility of hitting this bug. But running with this workaround applied causes checkstop if any correctable error in L2 cache directory is detected. Hence OPAL also provides a way to undo the workaround. In the existing implementation, workaround is applied by the last thread of the core entering fastsleep and undone by the first thread waking up. But this has a performance cost. These OPAL calls account for roughly 4000 cycles everytime the core has to enter or wakeup from fastsleep. This patch introduces a sysfs attribute (fastsleep_workaround_state) to choose the behavior of this workaround. By default, fastsleep_workaround_state = 0. In this case, workaround is applied/undone everytime the core enters/exits fastsleep. fastsleep_workaround_state = 1. In this case the workaround is applied once on all the cores and never undone. This can be triggered by echo 1 /sys/devices/system/cpu/fastsleep_workaround_state For simplicity this attribute can be modified only once. Implying, once fastsleep_workaround_state is changed to 1, it cannot be reverted to the default state. This sounds good, although the name is a bit vague. Just calling it state doesn't make it clear what 0 and 1 mean. I think better would be fastsleep_workaround_active ? Though even that is a bit wrong, because 0 doesn't really mean it's not active, it means it's not *permanently* active. So another option would be to make it a string attribute, with the initial state being eg. dynamic and then maybe applied for the applied state? How about fastsleep_workaround_permanent, with default value = 0. User can make workaround permanent by echoing 1 to it. I'll post out V4 with the suggested changes. Thanks, Shreyas ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Kernel hangs after Loading Device Tree after update
Hi all, I have a strange problem on a self-developed MPC5200B system (more or less like the Freescale Lite board). On that board, I use kernel 3.2.68 with my own machine init file, which is almost the same as for Lite (arch/powerpc/platforms/52xx/lite5200.c). Everything works just fine. When I use 3.18.9 with the same init file modifications and compiled with more or less the same .config, plus an adjusted DTB (e.g. rename the fsl,mpc5200b-psc-uart entries to fsl,mpc5200b-psc), the boot process from u-boot simply hangs after: snip ## Booting kernel from Legacy Image at 0100 ... Image Name: Linux-3.18.9 Created: 2015-03-30 7:23:52 UTC Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size:1972101 Bytes = 1.9 MB Load Address: Entry Point: Verifying Checksum ... OK ## Flattened Device Tree blob at 0120 Booting using the fdt blob at 0x120 Uncompressing Kernel Image ... OK Loading Device Tree to 007fa000, end 007ff2d9 ... OK /snip Any idea what goes wrong here? I recall that I used the same approach outlined above to move from 2.6.32 to 3.2, which worked immediately. Might my U-Boot be too old (I use 2009.03)? Thanks in advance, Albrecht. pgpp8gyhfG26V.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v7 RFC 1/3] sparc: Break up monolithic iommu table/lock into finer graularity pools and lock
On Mon, 2015-03-30 at 17:15 -0400, Sowmini Varadhan wrote: On (03/30/15 09:01), Sowmini Varadhan wrote: So I tried looking at the code, and perhaps there is some arch-specific subtlety here that I am missing, but where does spin_lock itself do the cpu_relax? afaict, LOCK_CONTENDED() itself does not have this. To answer my question: I'd missed the CONFIG_LOCK_STAT (which David Ahern pointed out to me). the above is only true for the LOCK_STAT case. powerpc: static inline void arch_spin_lock(arch_spinlock_t *lock) { CLEAR_IO_SYNC; while (1) { if (likely(__arch_spin_trylock(lock) == 0)) break; do { HMT_low(); if (SHARED_PROCESSOR) __spin_yield(lock); } while (unlikely(lock-slock != 0)); HMT_medium(); } } The HMT_* statements are what reduces the thread prio. Additionally, the yield thingy is something that allows us to relinguish out time slice to the partition owning the lock if it's not currently scheduled by the hypervisor. In any case, I ran some experiments today: I was running iperf [http://en.wikipedia.org/wiki/Iperf] over ixgbe, which is where I'd noticed the original perf issues for sparc. I was running iperf2 (which is more aggressively threaded than iperf3) with 8, 10, 16, 20 threads, and with TSO turned off. In each case, I was making sure that I was able to reach 9.X Gbps (this is a 10Gbps link) I dont see any significant difference in the perf profile between the spin_trylock and the spin_lock version (other than, of course, the change to the lock-contention for the trylock version). I looked at the perf profiled cache-misses (works out to about 1400M for 10 threads, with or without the trylock). I'm still waiting for some of the IB folks to try out the spin_lock version (they had also seen some significant perf improvements from breaking down the monolithic lock into multiple pools, so their workload is also sensitive to this) But as such, it looks like it doesnt matter much, whether you use the trylock to find the first available pool, or block on the spin_lock. I'll let folks on this list vote on this one (assuming the IB tests also come out without a significant variation between the 2 locking choices). Provided that the IB test doesn't come up with a significant difference, I definitely vote for the simpler version of doing a normal spin_lock. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [1/4] powerpc/fsl-booke: Add device tree support for T1024/T1023 SoC
On Mon, 2015-03-30 at 06:08 -0500, Liu Shengzhou-B36685 wrote: -Original Message- From: Wood Scott-B07421 Sent: Friday, January 30, 2015 9:20 AM To: Liu Shengzhou-B36685 Cc: linuxppc-dev@lists.ozlabs.org Subject: Re: [1/4] powerpc/fsl-booke: Add device tree support for T1024/T1023 SoC On Thu, Jan 29, 2015 at 03:52:24PM +0800, Shengzhou Liu wrote: + corenet-cf@18000 { + compatible = fsl,corenet2-cf; While the damage has already been done by the t1040 device tree, this is not 100% compatible with what's on t4240. I'm not sure if it's worth doing anything about it at this point, given that you can tell the difference by the version register even though that register is reserved on t4240 and simliar chips, which is what I do in http://patchwork.ozlabs.org/patch/419911/ Now here fsl,corenet2-cf is suitable for t1024 after your t1040 patch was merged. T1024 and t1040 have the same version of ccf. I wouldn't call it suitable, just that there's a workaround for existing badness. +/include/ t1023si-post.dtsi +soc { + display:display@18 { + compatible = fsl,t1024-diu, fsl,diu; + reg = 0x18 1000; + interrupts = 74 2 0 0; + }; +}; There are other differences between t1023 an t1024. Where do you describe t1024's QE? Where do you describe the DDR and IFC differences? can they be detected at runtime? t1024 supports deep sleep, but t1023 doesn't -- yet you label both chips as having t1024 rcpm. As QE IP block has not been upstream yet, Huh? arch/powerpc/sysdev/qe_lib/ so have to removed QE info in dts currently(same on t1040), That's not how it works. DDR and IFC differences are in u-boot, not in dts. The differences are in hardware, which is what the dts is supposed to describe. Both t1023 and t1024 support sleep, so label both chips as having t1024 rcpm. That's not how it works. Only t1024 has deep sleep, the difference is identified in *.c not in dts (confirmed with deep sleep owner). Even if the C code chooses to use SVR to identify the difference (why?), that doesn't mean it's OK for the device tree to contain wrong information. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote: On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote: Why did we move it? Just for cleanliness? Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/powermac/pci.c | 17 + arch/powerpc/platforms/powermac/pmac.h | 4 arch/powerpc/platforms/powermac/setup.c | 18 -- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index f4071a6..a792f45 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev) pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); + +#ifdef CONFIG_PPC64 +int pmac_pci_probe_mode(struct pci_bus *bus) +{ + struct device_node *node = pci_bus_to_OF_node(bus); + + /* We need to use normal PCI probing for the AGP bus, +* since the device for the AGP bridge isn't in the tree. +* Same for the PCIe host on U4 and the HT host bridge. +*/ + if (bus-self == NULL (of_device_is_compatible(node, u3-agp) || + of_device_is_compatible(node, u4-pcie) || + of_device_is_compatible(node, u3-ht))) + return PCI_PROBE_NORMAL; + return PCI_PROBE_DEVTREE; +} +#endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index 8327cce..46d2193 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); extern int pmac_nvram_init(void); extern void pmac_pic_init(void); +#ifdef CONFIG_PPC64 +extern int pmac_pci_probe_mode(struct pci_bus *bus); +#endif You don't need to ifdef declarations, and you don't need extern. I like extern :-) If the rest of the file use it, I prefer if he continues doing so. So just: +int pmac_pci_probe_mode(struct pci_bus *bus); Is fine. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v7 RFC 1/3] sparc: Break up monolithic iommu table/lock into finer graularity pools and lock
On (03/31/15 08:28), Benjamin Herrenschmidt wrote: Provided that the IB test doesn't come up with a significant difference, I definitely vote for the simpler version of doing a normal spin_lock. sounds good. let me wait for the confirmation from IB, and I'll send out patchv8 soon after. FWIW, I'm ok with all the other comments- thanks for the feedback. --Sowmini ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote: On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote: Why did we move it? Just for cleanliness? I move it because in (what is currently) patch 14, I want to hook it into the PCI controller ops structure, which I define in pci.c. In that patch I make the definition static again and remove the prototype from the header. I saw two other options: - Move it to pci.c as part of patch 14 - Keep it in setup.c and just accept that it won't be static and will need a prototype in the header. I thought this was the least bad option, but I'm happy to do it another way. Either way I will explain it better in the next series. Regards, Daniel Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/powermac/pci.c | 17 + arch/powerpc/platforms/powermac/pmac.h | 4 arch/powerpc/platforms/powermac/setup.c | 18 -- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index f4071a6..a792f45 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev) pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); + +#ifdef CONFIG_PPC64 +int pmac_pci_probe_mode(struct pci_bus *bus) +{ + struct device_node *node = pci_bus_to_OF_node(bus); + + /* We need to use normal PCI probing for the AGP bus, +* since the device for the AGP bridge isn't in the tree. +* Same for the PCIe host on U4 and the HT host bridge. +*/ + if (bus-self == NULL (of_device_is_compatible(node, u3-agp) || + of_device_is_compatible(node, u4-pcie) || + of_device_is_compatible(node, u3-ht))) + return PCI_PROBE_NORMAL; + return PCI_PROBE_DEVTREE; +} +#endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index 8327cce..46d2193 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); extern int pmac_nvram_init(void); extern void pmac_pic_init(void); +#ifdef CONFIG_PPC64 +extern int pmac_pci_probe_mode(struct pci_bus *bus); +#endif You don't need to ifdef declarations, and you don't need extern. So just: +int pmac_pci_probe_mode(struct pci_bus *bus); Is fine. cheers signature.asc Description: This is a digitally signed message part ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v7 RFC 1/3] sparc: Break up monolithic iommu table/lock into finer graularity pools and lock
On (03/30/15 09:01), Sowmini Varadhan wrote: So I tried looking at the code, and perhaps there is some arch-specific subtlety here that I am missing, but where does spin_lock itself do the cpu_relax? afaict, LOCK_CONTENDED() itself does not have this. To answer my question: I'd missed the CONFIG_LOCK_STAT (which David Ahern pointed out to me). the above is only true for the LOCK_STAT case. In any case, I ran some experiments today: I was running iperf [http://en.wikipedia.org/wiki/Iperf] over ixgbe, which is where I'd noticed the original perf issues for sparc. I was running iperf2 (which is more aggressively threaded than iperf3) with 8, 10, 16, 20 threads, and with TSO turned off. In each case, I was making sure that I was able to reach 9.X Gbps (this is a 10Gbps link) I dont see any significant difference in the perf profile between the spin_trylock and the spin_lock version (other than, of course, the change to the lock-contention for the trylock version). I looked at the perf profiled cache-misses (works out to about 1400M for 10 threads, with or without the trylock). I'm still waiting for some of the IB folks to try out the spin_lock version (they had also seen some significant perf improvements from breaking down the monolithic lock into multiple pools, so their workload is also sensitive to this) But as such, it looks like it doesnt matter much, whether you use the trylock to find the first available pool, or block on the spin_lock. I'll let folks on this list vote on this one (assuming the IB tests also come out without a significant variation between the 2 locking choices). --Sowmini ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init
Hmm, I think we got this wrong. I don't remember exactly but it was probably me who told you it could be removed, but I probably hadn't had a coffee yet :} I see setup_pci_atmu() called by fsl_pci_syscore_do_resume(), ie. at runtime == late. So ignore that. But also fsl_add_bridge(), called from fsl_pci_probe(), which is a platform driver, registered at arch initcall via fsl_pci_init(). arch initcall happens *before* subsys, so in that case this will be effective. So I think we need to leave it alone. OK, yeah you're right. Darn. It looks like we can keep the general approach here, but drop this patch and the rename patch. Then if we move the swiotlb hooks to the end of fsl_add_bridge, everything should happen in the right order. I'll get that into v2. Thanks for the detailed checking! -- d cheers signature.asc Description: This is a digitally signed message part ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 08/10] perf/hv24x7: Whitespace cleanup
On Mon, 2015-03-30 at 18:53 -0700, Sukadev Bhattiprolu wrote: Fix minor whitespace damages. If you are going to do whitespace cleaning, please verify the patches with scripts/checkpatch.pl --strict. diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c [] @@ -1077,7 +1079,6 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count) } resb = result_buffer-results[0]; - *count = be64_to_cpu(resb-elements[0].element_data[0]); out: return ret; Does this deletion make the code easier to read? It might be better just to use: be64 val; ... val = result_buffer-results[0].elements[0].element_data[0]; *count = be64_to_cpu(val); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 6/8] mtd: replace CONFIG_8xx by CONFIG_PPC_8xx
On Thu, Mar 12, 2015 at 04:24:04PM +0100, Christophe Leroy wrote: Two config options exist to define powerpc MPC8xx: * CONFIG_PPC_8xx * CONFIG_8xx In addition, CONFIG_PPC_8xx also defines CONFIG_CPM1 as communication co-processor arch/powerpc/platforms/Kconfig.cputype has contained the following comment about CONFIG_8xx item for some years: # this is temp to handle compat with arch=ppc It looks like not many places still have that old CONFIG_8xx used, so it is likely to be a good time to get rid of it completely ? Signed-off-by: Christophe Leroy christophe.le...@c-s.fr I'm not sure if the consistency aspect is worked out for all symbols (Geert's comment on the cover letter), but this one looks fine. Applied this patch to l2-mtd.git. Brian ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [2/4] powerpc/rcpm: add RCPM driver
On Thu, Mar 26, 2015 at 06:18:13PM +0800, chenhui zhao wrote: There is a RCPM (Run Control/Power Management) in Freescale QorIQ series processors. The device performs tasks associated with device run control and power management. The driver implements some features: mask/unmask irq, enter/exit low power states, freeze time base, etc. Signed-off-by: Chenhui Zhao chenhui.z...@freescale.com --- Documentation/devicetree/bindings/soc/fsl/rcpm.txt | 23 ++ arch/powerpc/include/asm/fsl_guts.h| 105 ++ arch/powerpc/include/asm/fsl_pm.h | 49 +++ arch/powerpc/platforms/85xx/Kconfig| 1 + arch/powerpc/sysdev/Kconfig| 5 + arch/powerpc/sysdev/Makefile | 1 + arch/powerpc/sysdev/fsl_rcpm.c | 353 + 7 files changed, 537 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/fsl/rcpm.txt create mode 100644 arch/powerpc/include/asm/fsl_pm.h create mode 100644 arch/powerpc/sysdev/fsl_rcpm.c diff --git a/Documentation/devicetree/bindings/soc/fsl/rcpm.txt b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt new file mode 100644 index 000..8c21b6c --- /dev/null +++ b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt @@ -0,0 +1,23 @@ +* Run Control and Power Management + +The RCPM performs all device-level tasks associated with device run control +and power management. + +Required properites: + - reg : Offset and length of the register set of RCPM block. + - compatible : Specifies the compatibility list for the RCPM. The type +should be string, such as fsl,qoriq-rcpm-1.0, fsl,qoriq-rcpm-2.0. + +Example: +The RCPM node for T4240: + rcpm: global-utilities@e2000 { + compatible = fsl,t4240-rcpm, fsl,qoriq-rcpm-2.0; + reg = 0xe2000 0x1000; + }; + +The RCPM node for P4080: + rcpm: global-utilities@e2000 { + compatible = fsl,qoriq-rcpm-1.0; + reg = 0xe2000 0x1000; + #sleep-cells = 1; + }; Where is #sleep-cells documented? It's copy-and-paste from something that was never finished from many years ago. diff --git a/arch/powerpc/include/asm/fsl_pm.h b/arch/powerpc/include/asm/fsl_pm.h new file mode 100644 index 000..bbe6089 --- /dev/null +++ b/arch/powerpc/include/asm/fsl_pm.h @@ -0,0 +1,49 @@ +/* + * Support Power Management + * + * Copyright 2014-2015 Freescale Semiconductor Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ +#ifndef __PPC_FSL_PM_H +#define __PPC_FSL_PM_H +#ifdef __KERNEL__ Put a space after #ifdef, not a tab. +#define E500_PM_PH10 1 +#define E500_PM_PH15 2 +#define E500_PM_PH20 3 +#define E500_PM_PH30 4 +#define E500_PM_DOZE E500_PM_PH10 +#define E500_PM_NAP E500_PM_PH15 + +#define PLAT_PM_SLEEP20 +#define PLAT_PM_LPM2030 + +#define FSL_PM_SLEEP (1 0) +#define FSL_PM_DEEP_SLEEP(1 1) + +struct fsl_pm_ops { + /* mask pending interrupts to the RCPM from MPIC */ + void (*irq_mask)(int cpu); + /* unmask pending interrupts to the RCPM from MPIC */ + void (*irq_unmask)(int cpu); + /* place the CPU in the specified state */ + void (*cpu_enter_state)(int cpu, int state); + /* exit the CPU from the specified state */ + void (*cpu_exit_state)(int cpu, int state); + /* place the platform in the sleep state */ + int (*plat_enter_sleep)(void); + /* freeze the time base */ + void (*freeze_time_base)(int freeze); + /* keep the power of IP blocks during sleep/deep sleep */ + void (*set_ip_power)(int enable, u32 *mask); + /* get platform supported power management modes */ + unsigned int (*get_pm_modes)(void); +}; Drop the comments that are basically just a restatement of the function name. Where there are comments, it'd be easier to read with a blank line between a function and the next comment. s/int enable/bool enable/ s/int freeze/bool freeze/ +#endif /* __KERNEL__ */ +#endif /* __PPC_FSL_PM_H */ Please be consistent with whitespace. + default: + pr_err(%s: Unknown cpu PM state (%d)\n, __func__, state); WARN? +static int rcpm_v2_plat_enter_state(int state) +{ + u32 *pmcsr_reg = rcpm_v2_regs-powmgtcsr; + int ret = 0; + int result; + + switch (state) { + case PLAT_PM_LPM20: + /* clear previous LPM20 status */ + setbits32(pmcsr_reg, RCPM_POWMGTCSR_P_LPM20_ST); How would the bit be set when you enter here, given that you wait for it to clear when leaving? + /* enter LPM20 status */ + setbits32(pmcsr_reg, RCPM_POWMGTCSR_LPM20_RQ); +
Re: [PATCH 06/25] powerpc: Use bool function return values of true/false not 1/0
On Mon, 2015-03-30 at 16:46 -0700, Joe Perches wrote: Use the normal return values for bool functions Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org Should we merge it or will you ? Cheers, Ben. Signed-off-by: Joe Perches j...@perches.com --- arch/powerpc/include/asm/dcr-native.h| 2 +- arch/powerpc/include/asm/dma-mapping.h | 4 ++-- arch/powerpc/include/asm/kvm_book3s_64.h | 4 ++-- arch/powerpc/sysdev/dcr.c| 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/dcr-native.h b/arch/powerpc/include/asm/dcr-native.h index 7d2e623..4efc11d 100644 --- a/arch/powerpc/include/asm/dcr-native.h +++ b/arch/powerpc/include/asm/dcr-native.h @@ -31,7 +31,7 @@ typedef struct { static inline bool dcr_map_ok_native(dcr_host_native_t host) { - return 1; + return true; } #define dcr_map_native(dev, dcr_n, dcr_c) \ diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 894d538..9103687 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -191,11 +191,11 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) struct dev_archdata *sd = dev-archdata; if (sd-max_direct_dma_addr addr + size sd-max_direct_dma_addr) - return 0; + return false; #endif if (!dev-dma_mask) - return 0; + return false; return addr + size - 1 = *dev-dma_mask; } diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 2d81e20..2a244bf 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h @@ -335,7 +335,7 @@ static inline bool hpte_read_permission(unsigned long pp, unsigned long key) { if (key) return PP_RWRX = pp pp = PP_RXRX; - return 1; + return true; } static inline bool hpte_write_permission(unsigned long pp, unsigned long key) @@ -373,7 +373,7 @@ static inline bool slot_is_aligned(struct kvm_memory_slot *memslot, unsigned long mask = (pagesize PAGE_SHIFT) - 1; if (pagesize = PAGE_SIZE) - return 1; + return true; return !(memslot-base_gfn mask) !(memslot-npages mask); } diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c index 2d8a101..121e26f 100644 --- a/arch/powerpc/sysdev/dcr.c +++ b/arch/powerpc/sysdev/dcr.c @@ -54,7 +54,7 @@ bool dcr_map_ok_generic(dcr_host_t host) else if (host.type == DCR_HOST_MMIO) return dcr_map_ok_mmio(host.host.mmio); else - return 0; + return false; } EXPORT_SYMBOL_GPL(dcr_map_ok_generic); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 01/10] powerpc/hv-24x7: Modify definition of request and result buffers
The parameters to the 24x7 HCALL have variable number of elements in them. Set the minimum number of such elements to 1 rather than 0 and eliminate the temporary structures. This would enable us to submit multiple counter requests and process multiple results from a single HCALL (in a follow on patch). Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 77 ++--- arch/powerpc/perf/hv-24x7.h | 8 ++--- 2 files changed, 41 insertions(+), 44 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 9445a82..408e6e9 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -142,6 +142,15 @@ static struct attribute_group event_long_desc_group = { static struct kmem_cache *hv_page_cache; +/* + * request_buffer and result_buffer are not required to be 4k aligned, + * but are not allowed to cross any 4k boundary. Aligning them to 4k is + * the simplest way to ensure that. + */ +#define H24x7_DATA_BUFFER_SIZE 4096 +DEFINE_PER_CPU(char, hv_24x7_reqb[H24x7_DATA_BUFFER_SIZE]) __aligned(4096); +DEFINE_PER_CPU(char, hv_24x7_resb[H24x7_DATA_BUFFER_SIZE]) __aligned(4096); + static char *event_name(struct hv_24x7_event_data *ev, int *len) { *len = be16_to_cpu(ev-event_name_len) - 2; @@ -976,31 +985,16 @@ static const struct attribute_group *attr_groups[] = { NULL, }; -DEFINE_PER_CPU(char, hv_24x7_reqb[4096]) __aligned(4096); -DEFINE_PER_CPU(char, hv_24x7_resb[4096]) __aligned(4096); - static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, -u16 lpar, u64 *res, +u16 lpar, u64 *count, bool success_expected) { unsigned long ret; - /* -* request_buffer and result_buffer are not required to be 4k aligned, -* but are not allowed to cross any 4k boundary. Aligning them to 4k is -* the simplest way to ensure that. -*/ - struct reqb { - struct hv_24x7_request_buffer buf; - struct hv_24x7_request req; - } __packed *request_buffer; - - struct { - struct hv_24x7_data_result_buffer buf; - struct hv_24x7_result res; - struct hv_24x7_result_element elem; - __be64 result; - } __packed *result_buffer; + struct hv_24x7_request_buffer *request_buffer; + struct hv_24x7_data_result_buffer *result_buffer; + struct hv_24x7_result *resb; + struct hv_24x7_request *req; BUILD_BUG_ON(sizeof(*request_buffer) 4096); BUILD_BUG_ON(sizeof(*result_buffer) 4096); @@ -1011,38 +1005,41 @@ static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, memset(request_buffer, 0, 4096); memset(result_buffer, 0, 4096); - *request_buffer = (struct reqb) { - .buf = { - .interface_version = HV_24X7_IF_VERSION_CURRENT, - .num_requests = 1, - }, - .req = { - .performance_domain = domain, - .data_size = cpu_to_be16(8), - .data_offset = cpu_to_be32(offset), - .starting_lpar_ix = cpu_to_be16(lpar), - .max_num_lpars = cpu_to_be16(1), - .starting_ix = cpu_to_be16(ix), - .max_ix = cpu_to_be16(1), - } - }; + request_buffer-interface_version = HV_24X7_IF_VERSION_CURRENT; + request_buffer-num_requests = 1; + + req = request_buffer-requests[0]; + req-performance_domain = domain; + req-data_size = cpu_to_be16(8); + req-data_offset = cpu_to_be32(offset); + req-starting_lpar_ix = cpu_to_be16(lpar), + req-max_num_lpars = cpu_to_be16(1); + req-starting_ix = cpu_to_be16(ix); + req-max_ix = cpu_to_be16(1); + + /* +* NOTE: Due to variable number of array elements in request and +* result buffer(s), sizeof() is not reliable. Use the actual +* allocated buffer size, H24x7_DATA_BUFFER_SIZE. +*/ ret = plpar_hcall_norets(H_GET_24X7_DATA, - virt_to_phys(request_buffer), sizeof(*request_buffer), - virt_to_phys(result_buffer), sizeof(*result_buffer)); + virt_to_phys(request_buffer), H24x7_DATA_BUFFER_SIZE, + virt_to_phys(result_buffer), H24x7_DATA_BUFFER_SIZE); if (ret) { if (success_expected) pr_err_ratelimited(hcall failed: %d %#x %#x %d = 0x%lx (%ld) detail=0x%x failing ix=%x\n, domain, offset, ix, lpar, ret, ret, - result_buffer-buf.detailed_rc, -
[PATCH v2 02/10] powerpc/hv24x7: Remove unnecessary parameter
Remove the 'success_expected' parameter and log the message unconditionally. Changelog[v2] [Michael Ellerman]: Move the change to reduce log message priority into a separate patch. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 408e6e9..c185dcf 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -986,8 +986,7 @@ static const struct attribute_group *attr_groups[] = { }; static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, -u16 lpar, u64 *count, -bool success_expected) +u16 lpar, u64 *count) { unsigned long ret; @@ -1028,8 +1027,7 @@ static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, virt_to_phys(result_buffer), H24x7_DATA_BUFFER_SIZE); if (ret) { - if (success_expected) - pr_err_ratelimited(hcall failed: %d %#x %#x %d = + pr_err_ratelimited(hcall failed: %d %#x %#x %d = 0x%lx (%ld) detail=0x%x failing ix=%x\n, domain, offset, ix, lpar, ret, ret, result_buffer-detailed_rc, @@ -1044,8 +1042,7 @@ out: return ret; } -static unsigned long event_24x7_request(struct perf_event *event, u64 *res, - bool success_expected) +static unsigned long event_24x7_request(struct perf_event *event, u64 *res) { u16 idx; unsigned domain = event_get_domain(event); @@ -1059,8 +1056,7 @@ static unsigned long event_24x7_request(struct perf_event *event, u64 *res, event_get_offset(event), idx, event_get_lpar(event), - res, - success_expected); + res); } static int h_24x7_event_init(struct perf_event *event) @@ -1130,7 +1126,7 @@ static int h_24x7_event_init(struct perf_event *event) } /* see if the event complains */ - if (event_24x7_request(event, ct, false)) { + if (event_24x7_request(event, ct)) { pr_devel(test hcall failed\n); return -EIO; } @@ -1142,7 +1138,7 @@ static u64 h_24x7_get_value(struct perf_event *event) { unsigned long ret; u64 ct; - ret = event_24x7_request(event, ct, true); + ret = event_24x7_request(event, ct); if (ret) /* We checked this in event init, shouldn't fail here... */ return 0; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 08/10] perf/hv24x7: Whitespace cleanup
Fix minor whitespace damages. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index fe74221..676fb2f9 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -161,6 +161,7 @@ static char *event_desc(struct hv_24x7_event_data *ev, int *len) { unsigned nl = be16_to_cpu(ev-event_name_len); __be16 *desc_len = (__be16 *)(ev-remainder + nl - 2); + *len = be16_to_cpu(*desc_len) - 2; return (char *)ev-remainder + nl; } @@ -171,6 +172,7 @@ static char *event_long_desc(struct hv_24x7_event_data *ev, int *len) __be16 *desc_len_ = (__be16 *)(ev-remainder + nl - 2); unsigned desc_len = be16_to_cpu(*desc_len_); __be16 *long_desc_len = (__be16 *)(ev-remainder + nl + desc_len - 2); + *len = be16_to_cpu(*long_desc_len) - 2; return (char *)ev-remainder + nl + desc_len; } @@ -248,14 +250,12 @@ static unsigned long h_get_24x7_catalog_page_(unsigned long phys_4096, unsigned long index) { pr_devel(h_get_24x7_catalog_page(0x%lx, %lu, %lu), - phys_4096, - version, - index); + phys_4096, version, index); + WARN_ON(!IS_ALIGNED(phys_4096, 4096)); + return plpar_hcall_norets(H_GET_24X7_CATALOG_PAGE, - phys_4096, - version, - index); + phys_4096, version, index); } static unsigned long h_get_24x7_catalog_page(char page[], @@ -309,6 +309,7 @@ static ssize_t device_show_string(struct device *dev, struct dev_ext_attribute *d; d = container_of(attr, struct dev_ext_attribute, attr); + return sprintf(buf, %s\n, (char *)d-var); } @@ -323,6 +324,7 @@ static struct attribute *device_str_attr_create_(char *name, char *str) attr-attr.attr.name = name; attr-attr.attr.mode = 0444; attr-attr.show = device_show_string; + return attr-attr.attr; } @@ -396,7 +398,6 @@ static struct attribute *event_to_attr(unsigned ix, a_ev_name = kasprintf(GFP_KERNEL, %.*s%s__%d, (int)event_name_len, ev_name, ev_suffix, nonce); - if (!a_ev_name) goto out_val; @@ -881,6 +882,7 @@ static ssize_t catalog_read(struct file *filp, struct kobject *kobj, uint64_t catalog_version_num = 0; void *page = kmem_cache_alloc(hv_page_cache, GFP_USER); struct hv_24x7_catalog_page_0 *page_0 = page; + if (!page) return -ENOMEM; @@ -1077,7 +1079,6 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count) } resb = result_buffer-results[0]; - *count = be64_to_cpu(resb-elements[0].element_data[0]); out: return ret; @@ -1175,6 +1176,7 @@ static void h_24x7_event_read(struct perf_event *event) { s64 prev; u64 now; + now = h_24x7_get_value(event); prev = local64_xchg(event-hw.prev_count, now); local64_add(now - prev, event-count); -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 07/10] powerpc/hv-24x7: Define add_event_to_24x7_request()
Move code that maps a perf_event to a 24x7 request buffer into a separate function, add_event_to_24x7_request(). Changelog[v2] [Michael Ellerman]: Move white-space changes to separate patch. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 59 - 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index e78b127..fe74221 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -1000,15 +1000,52 @@ static void log_24x7_hcall(struct hv_24x7_request_buffer *request_buffer, result_buffer-failing_request_ix); } -static unsigned long single_24x7_request(struct perf_event *event, u64 *count) +/* + * Add the given @event to the next slot in the 24x7 request_buffer. + * + * Note that H_GET_24X7_DATA hcall allows reading several counters' + * values in a single HCALL. We expect the caller to add events to the + * request buffer one by one, make the HCALL and process the results. + */ +static int add_event_to_24x7_request(struct perf_event *event, + struct hv_24x7_request_buffer *request_buffer) { u16 idx; + int i; + struct hv_24x7_request *req; + + if (request_buffer-num_requests 254) { + pr_devel(Too many requests for 24x7 HCALL %d\n, + request_buffer-num_requests); + return -EINVAL; + } + + if (is_physical_domain(event_get_domain(event))) + idx = event_get_core(event); + else + idx = event_get_vcpu(event); + + i = request_buffer-num_requests++; + req = request_buffer-requests[i]; + + req-performance_domain = event_get_domain(event); + req-data_size = cpu_to_be16(8); + req-data_offset = cpu_to_be32(event_get_offset(event)); + req-starting_lpar_ix = cpu_to_be16(event_get_lpar(event)), + req-max_num_lpars = cpu_to_be16(1); + req-starting_ix = cpu_to_be16(idx); + req-max_ix = cpu_to_be16(1); + + return 0; +} + +static unsigned long single_24x7_request(struct perf_event *event, u64 *count) +{ unsigned long ret; struct hv_24x7_request_buffer *request_buffer; struct hv_24x7_data_result_buffer *result_buffer; struct hv_24x7_result *resb; - struct hv_24x7_request *req; BUILD_BUG_ON(sizeof(*request_buffer) 4096); BUILD_BUG_ON(sizeof(*result_buffer) 4096); @@ -1019,23 +1056,11 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count) memset(request_buffer, 0, 4096); memset(result_buffer, 0, 4096); - if (is_physical_domain(event_get_domain(event))) - idx = event_get_core(event); - else - idx = event_get_vcpu(event); - request_buffer-interface_version = HV_24X7_IF_VERSION_CURRENT; - request_buffer-num_requests = 1; - - req = request_buffer-requests[0]; - req-performance_domain = event_get_domain(event); - req-data_size = cpu_to_be16(8); - req-data_offset = cpu_to_be32(event_get_offset(event)); - req-starting_lpar_ix = cpu_to_be16(event_get_lpar(event)), - req-max_num_lpars = cpu_to_be16(1); - req-starting_ix = cpu_to_be16(idx); - req-max_ix = cpu_to_be16(1); + ret = add_event_to_24x7_request(event, request_buffer); + if (ret) + return ret; /* * NOTE: Due to variable number of array elements in request and -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 09/10] powerpc/hv-24x7: Define update_event_count()
Move the code to update an event count into a new function, update_event_count(). Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 676fb2f9..cf82026 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -1172,16 +1172,22 @@ static u64 h_24x7_get_value(struct perf_event *event) return ct; } -static void h_24x7_event_read(struct perf_event *event) +static void update_event_count(struct perf_event *event, u64 now) { s64 prev; - u64 now; - now = h_24x7_get_value(event); prev = local64_xchg(event-hw.prev_count, now); local64_add(now - prev, event-count); } +static void h_24x7_event_read(struct perf_event *event) +{ + u64 now; + + now = h_24x7_get_value(event); + update_event_count(event, now); +} + static void h_24x7_event_start(struct perf_event *event, int flags) { if (flags PERF_EF_RELOAD) -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [4/4] powerpc/85xx: support sleep feature on QorIQ SoCs with RCPM
On Thu, Mar 26, 2015 at 06:18:15PM +0800, chenhui zhao wrote: In sleep mode, the clocks of e500 cores and unused IP blocks is turned off. The IP blocks which are allowed to wake up the processor are still running. The sleep mode is equal to the Standby state in Linux. Use the command to enter sleep mode: echo standby /sys/power/state Signed-off-by: Chenhui Zhao chenhui.z...@freescale.com --- arch/powerpc/Kconfig | 3 +- arch/powerpc/platforms/85xx/Kconfig| 5 +++ arch/powerpc/platforms/85xx/Makefile | 1 + arch/powerpc/platforms/85xx/qoriq_pm.c | 59 ++ arch/powerpc/platforms/86xx/Kconfig| 1 + 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/platforms/85xx/qoriq_pm.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 9846c83..162eb53 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -233,7 +233,7 @@ config ARCH_HIBERNATION_POSSIBLE config ARCH_SUSPEND_POSSIBLE def_bool y depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \ -(PPC_85xx !PPC_E500MC) || PPC_86xx || PPC_PSERIES \ +FSL_SOC_BOOKE || PPC_86xx || PPC_PSERIES \ || 44x || 40x config PPC_DCR_NATIVE @@ -747,7 +747,6 @@ config FSL_PCI config FSL_PMC bool - default y depends on SUSPEND (PPC_85xx || PPC_86xx) Get rid of this depends line if you're going to use select instead. +static int qoriq_suspend_valid(suspend_state_t state) +{ + unsigned int pm_modes; + + pm_modes = qoriq_pm_ops-get_pm_modes(); + + if ((state == PM_SUSPEND_STANDBY) (pm_modes FSL_PM_SLEEP)) + return 1; Unnecessary parentheses around == -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 06/25] powerpc: Use bool function return values of true/false not 1/0
Use the normal return values for bool functions Signed-off-by: Joe Perches j...@perches.com --- arch/powerpc/include/asm/dcr-native.h| 2 +- arch/powerpc/include/asm/dma-mapping.h | 4 ++-- arch/powerpc/include/asm/kvm_book3s_64.h | 4 ++-- arch/powerpc/sysdev/dcr.c| 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/dcr-native.h b/arch/powerpc/include/asm/dcr-native.h index 7d2e623..4efc11d 100644 --- a/arch/powerpc/include/asm/dcr-native.h +++ b/arch/powerpc/include/asm/dcr-native.h @@ -31,7 +31,7 @@ typedef struct { static inline bool dcr_map_ok_native(dcr_host_native_t host) { - return 1; + return true; } #define dcr_map_native(dev, dcr_n, dcr_c) \ diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 894d538..9103687 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -191,11 +191,11 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) struct dev_archdata *sd = dev-archdata; if (sd-max_direct_dma_addr addr + size sd-max_direct_dma_addr) - return 0; + return false; #endif if (!dev-dma_mask) - return 0; + return false; return addr + size - 1 = *dev-dma_mask; } diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 2d81e20..2a244bf 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h @@ -335,7 +335,7 @@ static inline bool hpte_read_permission(unsigned long pp, unsigned long key) { if (key) return PP_RWRX = pp pp = PP_RXRX; - return 1; + return true; } static inline bool hpte_write_permission(unsigned long pp, unsigned long key) @@ -373,7 +373,7 @@ static inline bool slot_is_aligned(struct kvm_memory_slot *memslot, unsigned long mask = (pagesize PAGE_SHIFT) - 1; if (pagesize = PAGE_SIZE) - return 1; + return true; return !(memslot-base_gfn mask) !(memslot-npages mask); } diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c index 2d8a101..121e26f 100644 --- a/arch/powerpc/sysdev/dcr.c +++ b/arch/powerpc/sysdev/dcr.c @@ -54,7 +54,7 @@ bool dcr_map_ok_generic(dcr_host_t host) else if (host.type == DCR_HOST_MMIO) return dcr_map_ok_mmio(host.host.mmio); else - return 0; + return false; } EXPORT_SYMBOL_GPL(dcr_map_ok_generic); -- 2.1.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 00/25] treewide: Use bool function return values of true/false not 1/0
Joe Perches (25): arm: Use bool function return values of true/false not 1/0 arm64: Use bool function return values of true/false not 1/0 hexagon: Use bool function return values of true/false not 1/0 ia64: Use bool function return values of true/false not 1/0 mips: Use bool function return values of true/false not 1/0 powerpc: Use bool function return values of true/false not 1/0 s390: Use bool function return values of true/false not 1/0 sparc: Use bool function return values of true/false not 1/0 tile: Use bool function return values of true/false not 1/0 unicore32: Use bool function return values of true/false not 1/0 x86: Use bool function return values of true/false not 1/0 virtio_console: Use bool function return values of true/false not 1/0 csiostor: Use bool function return values of true/false not 1/0 dcache: Use bool function return values of true/false not 1/0 nfsd: nfs4state: Use bool function return values of true/false not 1/0 include/linux: Use bool function return values of true/false not 1/0 sound: Use bool function return values of true/false not 1/0 rcu: tree_plugin: Use bool function return values of true/false not 1/0 sched: Use bool function return values of true/false not 1/0 ftrace: Use bool function return values of true/false not 1/0 slub: Use bool function return values of true/false not 1/0 bridge: Use bool function return values of true/false not 1/0 netfilter: Use bool function return values of true/false not 1/0 security: Use bool function return values of true/false not 1/0 sound: wm5100-tables: Use bool function return values of true/false not 1/0 arch/arm/include/asm/dma-mapping.h | 8 ++-- arch/arm/include/asm/kvm_emulate.h | 2 +- arch/arm/mach-omap2/powerdomain.c| 14 +++--- arch/arm64/include/asm/dma-mapping.h | 2 +- arch/hexagon/include/asm/dma-mapping.h | 2 +- arch/ia64/include/asm/dma-mapping.h | 2 +- arch/mips/include/asm/dma-mapping.h | 2 +- arch/powerpc/include/asm/dcr-native.h| 2 +- arch/powerpc/include/asm/dma-mapping.h | 4 +- arch/powerpc/include/asm/kvm_book3s_64.h | 4 +- arch/powerpc/sysdev/dcr.c| 2 +- arch/s390/include/asm/dma-mapping.h | 2 +- arch/sparc/mm/init_64.c | 8 ++-- arch/tile/include/asm/dma-mapping.h | 2 +- arch/unicore32/include/asm/dma-mapping.h | 2 +- arch/x86/include/asm/archrandom.h| 2 +- arch/x86/include/asm/dma-mapping.h | 2 +- arch/x86/include/asm/kvm_para.h | 2 +- arch/x86/kvm/cpuid.h | 2 +- arch/x86/kvm/vmx.c | 72 ++-- drivers/char/virtio_console.c| 2 +- drivers/scsi/csiostor/csio_scsi.c| 4 +- fs/dcache.c | 12 ++--- fs/nfsd/nfs4state.c | 2 +- include/linux/blkdev.h | 2 +- include/linux/ide.h | 2 +- include/linux/kgdb.h | 2 +- include/linux/mfd/db8500-prcmu.h | 2 +- include/linux/mm.h | 2 +- include/linux/power_supply.h | 8 ++-- include/linux/ssb/ssb_driver_extif.h | 2 +- include/linux/ssb/ssb_driver_gige.h | 16 +++ include/sound/soc.h | 4 +- kernel/rcu/tree_plugin.h | 4 +- kernel/sched/auto_group.h| 2 +- kernel/sched/completion.c| 16 --- kernel/trace/ftrace.c| 10 ++-- mm/slub.c| 12 ++--- net/bridge/br_private.h | 2 +- net/ipv4/netfilter/ipt_ah.c | 2 +- net/netfilter/ipset/ip_set_hash_ip.c | 8 ++-- net/netfilter/ipset/ip_set_hash_ipmark.c | 8 ++-- net/netfilter/ipset/ip_set_hash_ipport.c | 8 ++-- net/netfilter/ipset/ip_set_hash_ipportip.c | 8 ++-- net/netfilter/ipset/ip_set_hash_ipportnet.c | 8 ++-- net/netfilter/ipset/ip_set_hash_net.c| 8 ++-- net/netfilter/ipset/ip_set_hash_netiface.c | 8 ++-- net/netfilter/ipset/ip_set_hash_netport.c| 8 ++-- net/netfilter/ipset/ip_set_hash_netportnet.c | 8 ++-- net/netfilter/xt_connlimit.c | 2 +- net/netfilter/xt_hashlimit.c | 2 +- net/netfilter/xt_ipcomp.c| 2 +- security/apparmor/file.c | 8 ++-- security/apparmor/policy.c | 10 ++-- sound/soc/codecs/wm5100-tables.c | 12 ++--- 55 files changed, 178 insertions(+), 176 deletions(-) -- 2.1.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 00/25] treewide: Use bool function return values of true/false not 1/0
On Mon, 2015-03-30 at 17:07 -0700, Casey Schaufler wrote: On 3/30/2015 4:45 PM, Joe Perches wrote: Joe Perches (25): arm: Use bool function return values of true/false not 1/0 [etc...] Why, and why these in particular? bool functions are probably better returning bool values instead of 1 and 0. Especially when the functions intermix returning returning 1/0 and true/false. (there are only a couple of those though) These are all the remaining instances in the kernel tree. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [1/4] powerpc/cache: add cache flush operation for various e500
On Thu, Mar 26, 2015 at 06:18:12PM +0800, chenhui zhao wrote: Various e500 core have different cache architecture, so they need different cache flush operations. Therefore, add a callback function cpu_flush_caches to the struct cpu_spec. The cache flush operation for the specific kind of e500 is selected at init time. The callback function will flush all caches inside the current cpu. Signed-off-by: Chenhui Zhao chenhui.z...@freescale.com --- arch/powerpc/include/asm/cacheflush.h | 2 - arch/powerpc/include/asm/cputable.h | 11 +++ arch/powerpc/kernel/asm-offsets.c | 3 + arch/powerpc/kernel/cpu_setup_fsl_booke.S | 114 +- arch/powerpc/kernel/cputable.c| 4 ++ arch/powerpc/kernel/head_fsl_booke.S | 74 --- arch/powerpc/platforms/85xx/smp.c | 3 +- 7 files changed, 133 insertions(+), 78 deletions(-) diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h index 30b35ff..729fde4 100644 --- a/arch/powerpc/include/asm/cacheflush.h +++ b/arch/powerpc/include/asm/cacheflush.h @@ -30,8 +30,6 @@ extern void flush_dcache_page(struct page *page); #define flush_dcache_mmap_lock(mapping) do { } while (0) #define flush_dcache_mmap_unlock(mapping)do { } while (0) -extern void __flush_disable_L1(void); - extern void flush_icache_range(unsigned long, unsigned long); extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, unsigned long addr, diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index 5cf5a6d..c776efe4 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h @@ -43,6 +43,13 @@ extern int machine_check_e500(struct pt_regs *regs); extern int machine_check_e200(struct pt_regs *regs); extern int machine_check_47x(struct pt_regs *regs); +#if defined(CONFIG_E500) || defined(CONFIG_PPC_E500MC) +extern void __flush_caches_e500v2(void); +extern void __flush_caches_e500mc(void); +extern void __flush_caches_e5500(void); +extern void __flush_caches_e6500(void); +#endif Why the leading underscores? /* NOTE WELL: Update identify_cpu() if fields are added or removed! */ struct cpu_spec { /* CPU is matched via (PVR pvr_mask) == pvr_value */ @@ -59,6 +66,10 @@ struct cpu_spec { unsigned inticache_bsize; unsigned intdcache_bsize; +#if defined(CONFIG_E500) || defined(CONFIG_PPC_E500MC) CONFIG_PPC_E500MC implies CONFIG_E500. Why do we need this ifdef? + /* flush caches inside the current cpu */ + void (*cpu_flush_caches)(void); +#endif It seems you literally mean in the cpu -- If it's a threaded core, then by cpu do you mean thread (like we usually do) and thus no caches get flushed (ignore the fact that it's moot on e6500 -- this is an interface and needs to be clear). Also, no-oping L1 flush on e6500 is not compliant with the claim that you're flushing the cache. You're relying on an unstated assumption that you'll invalidate that cache later instead. If you want to make this flush whatever needs to be flushed for suspend/hotplug, call it that. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/1] powerpc/hv-24x7: Add missing put_cpu_var()
From: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Date: Tue, 17 Feb 2015 14:14:36 -0500 Subject: [PATCH 1/1] powerpc/hv-24x7: Add missing put_cpu_var() Add missing put_cpu_var() for 24x7 requests. This went missing in commit f34b6c7 (3.18-rc3). Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 46be032..ead8878 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -1096,7 +1096,7 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count) ret = add_event_to_24x7_request(event, request_buffer); if (ret) - return ret; + goto out; ret = make_24x7_request(request_buffer, result_buffer); if (ret) { @@ -1109,6 +1109,8 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count) *count = be64_to_cpu(resb-elements[0].element_data[0]); out: + put_cpu_var(hv_24x7_reqb); + put_cpu_var(hv_24x7_resb); return ret; } -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 06/10] powerpc/hv-24x7: Rename hv_24x7_event_update
For consistency with the pmu operation -read() and with other pmus, rename hv_24x7_event_update() to hv_24x7_event_read(). Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index a58a1df..e78b127 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -1146,7 +1146,7 @@ static u64 h_24x7_get_value(struct perf_event *event) return ct; } -static void h_24x7_event_update(struct perf_event *event) +static void h_24x7_event_read(struct perf_event *event) { s64 prev; u64 now; @@ -1163,7 +1163,7 @@ static void h_24x7_event_start(struct perf_event *event, int flags) static void h_24x7_event_stop(struct perf_event *event, int flags) { - h_24x7_event_update(event); + h_24x7_event_read(event); } static int h_24x7_event_add(struct perf_event *event, int flags) @@ -1184,7 +1184,7 @@ static struct pmu h_24x7_pmu = { .del = h_24x7_event_stop, .start = h_24x7_event_start, .stop= h_24x7_event_stop, - .read= h_24x7_event_update, + .read= h_24x7_event_read, }; static int hv_24x7_init(void) -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [3/4] powerpc: support CPU hotplug for e500mc, e5500 and e6500
On Thu, Mar 26, 2015 at 06:18:14PM +0800, chenhui zhao wrote: Implemented CPU hotplug on e500mc, e5500 and e6500, and support multiple threads mode and 64-bits mode. For e6500 with two threads, if one thread is online, it can enable/disable the other thread in the same core. If two threads of one core are offline, the core will enter the PH20 state (a low power state). When the core is up again, Thread0 is up first, and it will be bound with the present booting cpu. This way, all CPUs can hotplug separately. Signed-off-by: Chenhui Zhao chenhui.z...@freescale.com --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/fsl_pm.h | 4 + arch/powerpc/include/asm/smp.h| 2 + arch/powerpc/kernel/head_64.S | 20 +++-- arch/powerpc/kernel/smp.c | 5 ++ arch/powerpc/platforms/85xx/smp.c | 182 +- arch/powerpc/sysdev/fsl_rcpm.c| 56 7 files changed, 220 insertions(+), 51 deletions(-) Please factor out changes to generic code (including but not limited to cur_boot_cpu and PIR handling) into separate patches with clear explanations. diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 22b0940..9846c83 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -380,7 +380,7 @@ config SWIOTLB config HOTPLUG_CPU bool Support for enabling/disabling CPUs depends on SMP (PPC_PSERIES || \ - PPC_PMAC || PPC_POWERNV || (PPC_85xx !PPC_E500MC)) + PPC_PMAC || PPC_POWERNV || FSL_SOC_BOOKE) ---help--- Say Y here to be able to disable and re-enable individual CPUs at runtime on SMP machines. diff --git a/arch/powerpc/include/asm/fsl_pm.h b/arch/powerpc/include/asm/fsl_pm.h index bbe6089..579f495 100644 --- a/arch/powerpc/include/asm/fsl_pm.h +++ b/arch/powerpc/include/asm/fsl_pm.h @@ -34,6 +34,10 @@ struct fsl_pm_ops { void (*cpu_enter_state)(int cpu, int state); /* exit the CPU from the specified state */ void (*cpu_exit_state)(int cpu, int state); + /* cpu up */ + void (*cpu_up)(int cpu); Again, this sort of comment is useless. Tell us what cpu up *does*, when it should be called, etc. @@ -189,16 +193,14 @@ _GLOBAL(fsl_secondary_thread_init) isync /* - * Fix PIR to match the linear numbering in the device tree. - * - * On e6500, the reset value of PIR uses the low three bits for - * the thread within a core, and the upper bits for the core - * number. There are two threads per core, so shift everything - * but the low bit right by two bits so that the cpu numbering is - * continuous. Why are you getting rid of this? If it's to avoid doing it twice on the same thread, in my work-in-progress kexec patches I instead check to see whether BUCSR has already been set up -- if it has, I assume we've already been here. + * The current thread has been in 64-bit mode, + * see the value of TMRN_IMSR. I don't see what the relevance of this comment is here. + * compute the address of __cur_boot_cpu */ - mfspr r3, SPRN_PIR - rlwimi r3, r3, 30, 2, 30 + bl 10f +10: mflrr22 + addir22,r22,(__cur_boot_cpu - 10b) + lwz r3,0(r22) Please save non-volatile registers for things that need to stick around for a while. mtspr SPRN_PIR, r3 If __cur_boot_cpu is meant to be the PIR of the currently booting CPU, it's a misleading. It looks like it's supposed to have something to do with the boot cpu (not booting). Also please don't put leading underscores on symbols just because the adjacent symbols have them. -#ifdef CONFIG_HOTPLUG_CPU +#ifdef CONFIG_PPC_E500MC +static void qoriq_cpu_wait_die(void) +{ + unsigned int cpu = smp_processor_id(); + + hard_irq_disable(); + /* mask all irqs to prevent cpu wakeup */ + qoriq_pm_ops-irq_mask(cpu); + idle_task_exit(); + + mtspr(SPRN_TCR, 0); + mtspr(SPRN_TSR, mfspr(SPRN_TSR)); + + cur_cpu_spec-cpu_flush_caches(); + + generic_set_cpu_dead(cpu); + smp_mb(); Comment memory barriers, as checkpatch says. + while (1) + ; Indent the ; @@ -174,17 +232,29 @@ static inline u32 read_spin_table_addr_l(void *spin_table) static void wake_hw_thread(void *info) { void fsl_secondary_thread_init(void); - unsigned long imsr1, inia1; + unsigned long imsr, inia; int nr = *(const int *)info; - - imsr1 = MSR_KERNEL; - inia1 = *(unsigned long *)fsl_secondary_thread_init; - - mttmr(TMRN_IMSR1, imsr1); - mttmr(TMRN_INIA1, inia1); - mtspr(SPRN_TENS, TEN_THREAD(1)); + int hw_cpu = get_hard_smp_processor_id(nr); + int thread_idx = cpu_thread_in_core(hw_cpu); + + __cur_boot_cpu = (u32)hw_cpu; + imsr = MSR_KERNEL; + inia = *(unsigned long *)fsl_secondary_thread_init; + smp_mb(); + if (thread_idx == 0) { +
Re: [PATCH 06/25] powerpc: Use bool function return values of true/false not 1/0
On Tue, 2015-03-31 at 12:49 +1100, Benjamin Herrenschmidt wrote: On Mon, 2015-03-30 at 16:46 -0700, Joe Perches wrote: Use the normal return values for bool functions Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org Should we merge it or will you ? Hey Ben. I don't merge stuff. I just send patches. So, it'll be better if you do it. I'll resend whatever doesn't get picked up in the next couple months on to Andrew Morton. cheers. Joe ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v2,2/2] powerpc32: add support for csum_add()
On Tue, Feb 03, 2015 at 12:39:27PM +0100, LEROY Christophe wrote: The C version of csum_add() as defined in include/net/checksum.h gives the following assembly: 0: 7c 04 1a 14 add r0,r4,r3 4: 7c 64 00 10 subfc r3,r4,r0 8: 7c 63 19 10 subfe r3,r3,r3 c: 7c 63 00 50 subfr3,r3,r0 include/net/checksum.h also offers the possibility to define an arch specific function. This patch provides a ppc32 specific csum_add() inline function. Signed-off-by: Christophe Leroy christophe.le...@c-s.fr --- v2: changed constraints on the __asm__ arch/powerpc/include/asm/checksum.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/powerpc/include/asm/checksum.h b/arch/powerpc/include/asm/checksum.h index cfe806a..1e48cc7 100644 --- a/arch/powerpc/include/asm/checksum.h +++ b/arch/powerpc/include/asm/checksum.h @@ -141,6 +141,18 @@ static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, { return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); } + +#define HAVE_ARCH_CSUM_ADD +static inline __wsum csum_add(__wsum csum, __wsum addend) +{ +__asm__(\n\ s/__asm__/asm/ Use tabs to indent + addc %0,%0,%1 \n\ + addze %0,%0 \n\ Use ; to separate asm statements instead of using \n Use string concatenation instead of \ -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2] clockevents: Fix cpu down race for hrtimer based broadcasting
On Mon, 30 Mar 2015, Preeti U Murthy wrote: It was found when doing a hotplug stress test on POWER, that the machine either hit softlockups or rcu_sched stall warnings. The issue was traced to commit 7cba160ad789a powernv/cpuidle: Redesign idle states management, which exposed the cpu down race with hrtimer based broadcast mode(Commit 5d1638acb9f6(tick: Introduce hrtimer based broadcast). This is explained below. Assume CPU1 is the CPU which holds the hrtimer broadcasting duty before it is taken down. CPU0 CPU1 cpu_down()take_cpu_down() disable_interrupts() cpu_die() while(CPU1 != CPU_DEAD) { msleep(100); switch_to_idle(); stop_cpu_timer(); schedule_broadcast(); } tick_cleanup_cpu_dead() take_over_broadcast() So after CPU1 disabled interrupts it cannot handle the broadcast hrtimer anymore, so CPU0 will be stuck forever. Fix this by explicitly taking over broadcast duty before cpu_die(). This is a temporary workaround. What we really want is a callback in the clockevent device which allows us to do that from the dying CPU by pushing the hrtimer onto a different cpu. That might involve an IPI and is definitely more complex than this immediate fix. Fixes: http://linuxppc.10917.n7.nabble.com/offlining-cpus-breakage-td88619.html Suggested-by: Thomas Gleixner t...@linutronix.de Signed-off-by: Preeti U. Murthy pre...@linux.vnet.ibm.com [Changelog drawn from: https://lkml.org/lkml/2015/2/16/213] The lock-up I was experiencing with v1 of this patch is no longer reproducible with this one. Tested-by: Nicolas Pitre n...@linaro.org --- Change from V1: https://lkml.org/lkml/2015/2/26/11 1. Decoupled this fix from the kernel/time cleanup patches. V1 had a fail related to the cleanup which needs to be fixed. But since this bug fix is independent of this and needs to go in quickly, the patch is being posted out separately to be merged. include/linux/tick.h | 10 +++--- kernel/cpu.c |2 ++ kernel/time/tick-broadcast.c | 19 +++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 9c085dc..3069256 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -94,14 +94,18 @@ extern void tick_cancel_sched_timer(int cpu); static inline void tick_cancel_sched_timer(int cpu) { } # endif -# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST +# if defined CONFIG_GENERIC_CLOCKEVENTS_BROADCAST extern struct tick_device *tick_get_broadcast_device(void); extern struct cpumask *tick_get_broadcast_mask(void); -# ifdef CONFIG_TICK_ONESHOT +# if defined CONFIG_TICK_ONESHOT extern struct cpumask *tick_get_broadcast_oneshot_mask(void); +extern void tick_takeover(int deadcpu); +# else +static inline void tick_takeover(int deadcpu) {} # endif - +# else +static inline void tick_takeover(int deadcpu) {} # endif /* BROADCAST */ # ifdef CONFIG_TICK_ONESHOT diff --git a/kernel/cpu.c b/kernel/cpu.c index 1972b16..f9ca351 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -20,6 +20,7 @@ #include linux/gfp.h #include linux/suspend.h #include linux/lockdep.h +#include linux/tick.h #include trace/events/power.h #include smpboot.h @@ -411,6 +412,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) while (!idle_cpu(cpu)) cpu_relax(); + tick_takeover(cpu); /* This actually kills the CPU. */ __cpu_die(cpu); diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 066f0ec..0fd6634 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -669,14 +669,19 @@ static void broadcast_shutdown_local(struct clock_event_device *bc, clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN); } -static void broadcast_move_bc(int deadcpu) +void tick_takeover(int deadcpu) { - struct clock_event_device *bc = tick_broadcast_device.evtdev; + struct clock_event_device *bc; + unsigned long flags; - if (!bc || !broadcast_needs_cpu(bc, deadcpu)) - return; - /* This moves the broadcast assignment to this cpu */ - clockevents_program_event(bc, bc-next_event, 1); + raw_spin_lock_irqsave(tick_broadcast_lock, flags); + bc = tick_broadcast_device.evtdev; + + if (bc broadcast_needs_cpu(bc, deadcpu)) { + /* This moves the broadcast assignment to this cpu */ + clockevents_program_event(bc, bc-next_event, 1); + } + raw_spin_unlock_irqrestore(tick_broadcast_lock, flags); } /* @@ -913,8 +918,6 @@ void tick_shutdown_broadcast_oneshot(unsigned int *cpup) cpumask_clear_cpu(cpu, tick_broadcast_pending_mask); cpumask_clear_cpu(cpu, tick_broadcast_force_mask); - broadcast_move_bc(cpu); -
Re: [PATCH 1/3] powerpc/mpc85xx: Add FMan clock nodes
On Tue, 2015-03-24 at 03:26 -0500, Emil Medve wrote: Hello Scott, On 03/23/2015 06:30 PM, Scott Wood wrote: On Thu, 2015-02-26 at 09:26 -0600, Emil Medve wrote: From: Igal Liberman igal.liber...@freescale.com Signed-off-by: Igal Liberman igal.liber...@freescale.com --- arch/powerpc/boot/dts/fsl/b4si-post.dtsi| 11 +++ arch/powerpc/boot/dts/fsl/p2041si-post.dtsi | 8 arch/powerpc/boot/dts/fsl/p3041si-post.dtsi | 8 arch/powerpc/boot/dts/fsl/p4080si-post.dtsi | 16 arch/powerpc/boot/dts/fsl/p5020si-post.dtsi | 13 + arch/powerpc/boot/dts/fsl/p5040si-post.dtsi | 26 ++ arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 8 arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 11 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 20 9 files changed, 121 insertions(+) diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi index f8c325e..38621ef 100644 --- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi @@ -395,6 +395,17 @@ reg = 0xe 0xe00; fsl,has-rstcr; fsl,liodn-bits = 12; + + fm0clk: fm0-clk-mux { + #clock-cells = 0; + compatible = fsl,fman-clk-mux; + clocks = pll0 0, pll0 1, pll0 2, pll0 3, + platform_pll 0, pll1 1, pll1 2; + clock-names = pll0, pll0-div2, pll0-div3, +pll0-div4, platform-pll, pll1-div2, +pll1-div3; + clock-output-names = fm0-clk; + }; Where's the binding for fsl,fman-clk-mux? Igal will follow-up with the binding document Igal, ping? I need a binding before I can apply the dts patch. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 00/25] treewide: Use bool function return values of true/false not 1/0
On 3/30/2015 4:45 PM, Joe Perches wrote: Joe Perches (25): arm: Use bool function return values of true/false not 1/0 arm64: Use bool function return values of true/false not 1/0 hexagon: Use bool function return values of true/false not 1/0 ia64: Use bool function return values of true/false not 1/0 mips: Use bool function return values of true/false not 1/0 powerpc: Use bool function return values of true/false not 1/0 s390: Use bool function return values of true/false not 1/0 sparc: Use bool function return values of true/false not 1/0 tile: Use bool function return values of true/false not 1/0 unicore32: Use bool function return values of true/false not 1/0 x86: Use bool function return values of true/false not 1/0 virtio_console: Use bool function return values of true/false not 1/0 csiostor: Use bool function return values of true/false not 1/0 dcache: Use bool function return values of true/false not 1/0 nfsd: nfs4state: Use bool function return values of true/false not 1/0 include/linux: Use bool function return values of true/false not 1/0 sound: Use bool function return values of true/false not 1/0 rcu: tree_plugin: Use bool function return values of true/false not 1/0 sched: Use bool function return values of true/false not 1/0 ftrace: Use bool function return values of true/false not 1/0 slub: Use bool function return values of true/false not 1/0 bridge: Use bool function return values of true/false not 1/0 netfilter: Use bool function return values of true/false not 1/0 security: Use bool function return values of true/false not 1/0 sound: wm5100-tables: Use bool function return values of true/false not 1/0 arch/arm/include/asm/dma-mapping.h | 8 ++-- arch/arm/include/asm/kvm_emulate.h | 2 +- arch/arm/mach-omap2/powerdomain.c| 14 +++--- arch/arm64/include/asm/dma-mapping.h | 2 +- arch/hexagon/include/asm/dma-mapping.h | 2 +- arch/ia64/include/asm/dma-mapping.h | 2 +- arch/mips/include/asm/dma-mapping.h | 2 +- arch/powerpc/include/asm/dcr-native.h| 2 +- arch/powerpc/include/asm/dma-mapping.h | 4 +- arch/powerpc/include/asm/kvm_book3s_64.h | 4 +- arch/powerpc/sysdev/dcr.c| 2 +- arch/s390/include/asm/dma-mapping.h | 2 +- arch/sparc/mm/init_64.c | 8 ++-- arch/tile/include/asm/dma-mapping.h | 2 +- arch/unicore32/include/asm/dma-mapping.h | 2 +- arch/x86/include/asm/archrandom.h| 2 +- arch/x86/include/asm/dma-mapping.h | 2 +- arch/x86/include/asm/kvm_para.h | 2 +- arch/x86/kvm/cpuid.h | 2 +- arch/x86/kvm/vmx.c | 72 ++-- drivers/char/virtio_console.c| 2 +- drivers/scsi/csiostor/csio_scsi.c| 4 +- fs/dcache.c | 12 ++--- fs/nfsd/nfs4state.c | 2 +- include/linux/blkdev.h | 2 +- include/linux/ide.h | 2 +- include/linux/kgdb.h | 2 +- include/linux/mfd/db8500-prcmu.h | 2 +- include/linux/mm.h | 2 +- include/linux/power_supply.h | 8 ++-- include/linux/ssb/ssb_driver_extif.h | 2 +- include/linux/ssb/ssb_driver_gige.h | 16 +++ include/sound/soc.h | 4 +- kernel/rcu/tree_plugin.h | 4 +- kernel/sched/auto_group.h| 2 +- kernel/sched/completion.c| 16 --- kernel/trace/ftrace.c| 10 ++-- mm/slub.c| 12 ++--- net/bridge/br_private.h | 2 +- net/ipv4/netfilter/ipt_ah.c | 2 +- net/netfilter/ipset/ip_set_hash_ip.c | 8 ++-- net/netfilter/ipset/ip_set_hash_ipmark.c | 8 ++-- net/netfilter/ipset/ip_set_hash_ipport.c | 8 ++-- net/netfilter/ipset/ip_set_hash_ipportip.c | 8 ++-- net/netfilter/ipset/ip_set_hash_ipportnet.c | 8 ++-- net/netfilter/ipset/ip_set_hash_net.c| 8 ++-- net/netfilter/ipset/ip_set_hash_netiface.c | 8 ++-- net/netfilter/ipset/ip_set_hash_netport.c| 8 ++-- net/netfilter/ipset/ip_set_hash_netportnet.c | 8 ++-- net/netfilter/xt_connlimit.c | 2 +- net/netfilter/xt_hashlimit.c | 2 +- net/netfilter/xt_ipcomp.c| 2 +- security/apparmor/file.c | 8 ++-- security/apparmor/policy.c | 10 ++-- sound/soc/codecs/wm5100-tables.c | 12 ++--- Why, and why these in particular? 55 files changed, 178 insertions(+), 176 deletions(-) ___ Linuxppc-dev mailing
[PATCH v2 00/10] powerpc/hv-24x7: Reorganize single_24x7_request()
We currently issue a new hcall for to retrieve the value of each 24x7 counter that we want to read. However, the H_GET_24x7_DATA hcall can retrieve several counters in a single call, which would be useful in getting a more consistent snapshot of the system. Reorganize the code that prepares a 24x7 hcall request, submits it and processes the result to allow reading seveal counters at once. We still submit a fresh hcall for each event for now. A follow-on patch-set will build on this to submit multiple perf_events in a single hcall. Thanks to Peter Zijlstra for his input. Changelog[v2] - Split independent changes in patch 2 into patch 3. - Minor changes to pr_err() (Patch 4). - Move whitespace changes to separate patch (Patch 8). - Minor function renames (Patch 10). Sukadev Bhattiprolu (10): powerpc/hv-24x7: Modify definition of request and result buffers powerpc/hv24x7: Remove unnecessary parameter perf/hv24x7: Use pr_devel() to log message powerpc/hv-24x7: Drop event_24x7_request() powerpc/hv24x7: Move debug prints to separate function powerpc/hv-24x7: Rename hv_24x7_event_update powerpc/hv-24x7: Define add_event_to_24x7_request() perf/hv24x7: Whitespace cleanup powerpc/hv-24x7: Define update_event_count() powerpc/hv-24x7: Break up single_24x7_request arch/powerpc/perf/hv-24x7.c | 212 +++- arch/powerpc/perf/hv-24x7.h | 8 +- 2 files changed, 137 insertions(+), 83 deletions(-) -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 03/10] perf/hv24x7: Use pr_devel() to log message
Use pr_devel_ratelimited() to log error message when the 24x7 HCALL fails. Since users specify events by their sysfs name, the HCALL should succeed. Any errors reported by the HCALL would be of interest to the developer, rather than the user/administrator. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index c185dcf..87c9905 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -1027,7 +1027,7 @@ static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, virt_to_phys(result_buffer), H24x7_DATA_BUFFER_SIZE); if (ret) { - pr_err_ratelimited(hcall failed: %d %#x %#x %d = + pr_devel_ratelimited(hcall failed: %d %#x %#x %d = 0x%lx (%ld) detail=0x%x failing ix=%x\n, domain, offset, ix, lpar, ret, ret, result_buffer-detailed_rc, -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 04/10] powerpc/hv-24x7: Drop event_24x7_request()
The function event_24x7_request() is essentially a wrapper to the function single_24x7_request() and can be dropped to simplify code. Changelog [v2]: - Michael Ellerman: Use fields from the request structure rather than re-extracting from event structure. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 40 +++- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 87c9905..f509f3b 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -985,9 +985,9 @@ static const struct attribute_group *attr_groups[] = { NULL, }; -static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, -u16 lpar, u64 *count) +static unsigned long single_24x7_request(struct perf_event *event, u64 *count) { + u16 idx; unsigned long ret; struct hv_24x7_request_buffer *request_buffer; @@ -1004,17 +1004,22 @@ static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, memset(request_buffer, 0, 4096); memset(result_buffer, 0, 4096); + if (is_physical_domain(event_get_domain(event))) + idx = event_get_core(event); + else + idx = event_get_vcpu(event); + request_buffer-interface_version = HV_24X7_IF_VERSION_CURRENT; request_buffer-num_requests = 1; req = request_buffer-requests[0]; - req-performance_domain = domain; + req-performance_domain = event_get_domain(event); req-data_size = cpu_to_be16(8); - req-data_offset = cpu_to_be32(offset); - req-starting_lpar_ix = cpu_to_be16(lpar), + req-data_offset = cpu_to_be32(event_get_offset(event)); + req-starting_lpar_ix = cpu_to_be16(event_get_lpar(event)), req-max_num_lpars = cpu_to_be16(1); - req-starting_ix = cpu_to_be16(ix); + req-starting_ix = cpu_to_be16(idx); req-max_ix = cpu_to_be16(1); /* @@ -1029,7 +1034,8 @@ static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, if (ret) { pr_devel_ratelimited(hcall failed: %d %#x %#x %d = 0x%lx (%ld) detail=0x%x failing ix=%x\n, - domain, offset, ix, lpar, ret, ret, + req-performance_domain, req-data_offset, + idx, req-starting_lpar_ix, ret, ret, result_buffer-detailed_rc, result_buffer-failing_request_ix); goto out; @@ -1042,22 +1048,6 @@ out: return ret; } -static unsigned long event_24x7_request(struct perf_event *event, u64 *res) -{ - u16 idx; - unsigned domain = event_get_domain(event); - - if (is_physical_domain(domain)) - idx = event_get_core(event); - else - idx = event_get_vcpu(event); - - return single_24x7_request(event_get_domain(event), - event_get_offset(event), - idx, - event_get_lpar(event), - res); -} static int h_24x7_event_init(struct perf_event *event) { @@ -1126,7 +1116,7 @@ static int h_24x7_event_init(struct perf_event *event) } /* see if the event complains */ - if (event_24x7_request(event, ct)) { + if (single_24x7_request(event, ct)) { pr_devel(test hcall failed\n); return -EIO; } @@ -1138,7 +1128,7 @@ static u64 h_24x7_get_value(struct perf_event *event) { unsigned long ret; u64 ct; - ret = event_24x7_request(event, ct); + ret = single_24x7_request(event, ct); if (ret) /* We checked this in event init, shouldn't fail here... */ return 0; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 05/10] powerpc/hv24x7: Move debug prints to separate function
To simplify/cleanup code, move the rather long printk() to a separate function. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Conflicts: arch/powerpc/perf/hv-24x7.c --- arch/powerpc/perf/hv-24x7.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index f509f3b..a58a1df 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -985,6 +985,21 @@ static const struct attribute_group *attr_groups[] = { NULL, }; +static void log_24x7_hcall(struct hv_24x7_request_buffer *request_buffer, + struct hv_24x7_data_result_buffer *result_buffer, + unsigned long ret) +{ + struct hv_24x7_request *req; + + req = request_buffer-requests[0]; + pr_notice_ratelimited(hcall failed: [%d %#x %#x %d] = + ret 0x%lx (%ld) detail=0x%x failing ix=%x\n, + req-performance_domain, req-data_offset, + req-starting_ix, req-starting_lpar_ix, ret, ret, + result_buffer-detailed_rc, + result_buffer-failing_request_ix); +} + static unsigned long single_24x7_request(struct perf_event *event, u64 *count) { u16 idx; @@ -1032,12 +1047,7 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count) virt_to_phys(result_buffer), H24x7_DATA_BUFFER_SIZE); if (ret) { - pr_devel_ratelimited(hcall failed: %d %#x %#x %d = - 0x%lx (%ld) detail=0x%x failing ix=%x\n, - req-performance_domain, req-data_offset, - idx, req-starting_lpar_ix, ret, ret, - result_buffer-detailed_rc, - result_buffer-failing_request_ix); + log_24x7_hcall(request_buffer, result_buffer, ret); goto out; } -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 10/10] powerpc/hv-24x7: Break up single_24x7_request
Break up the function single_24x7_request() into smaller functions. This would later enable us to prepare a multi-event request buffer and then submit a single hcall for several events. Changelog[v2]: [Michael Ellerman] Rename start_24x7_get_data() to init_24x7_request() and commit_24x7_get_data make_24x7_request(). Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- arch/powerpc/perf/hv-24x7.c | 56 + 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index cf82026..46be032 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -1003,6 +1003,44 @@ static void log_24x7_hcall(struct hv_24x7_request_buffer *request_buffer, } /* + * Start the process for a new H_GET_24x7_DATA hcall. + */ +static void init_24x7_request(struct hv_24x7_request_buffer *request_buffer, + struct hv_24x7_data_result_buffer *result_buffer) +{ + + memset(request_buffer, 0, 4096); + memset(result_buffer, 0, 4096); + + request_buffer-interface_version = HV_24X7_IF_VERSION_CURRENT; + /* memset above set request_buffer-num_requests to 0 */ +} + +/* + * Commit (i.e perform) the H_GET_24x7_DATA hcall using the data collected + * by 'init_24x7_request()' and 'add_event_to_24x7_request()'. + */ +static int make_24x7_request(struct hv_24x7_request_buffer *request_buffer, + struct hv_24x7_data_result_buffer *result_buffer) +{ + unsigned long ret; + + /* +* NOTE: Due to variable number of array elements in request and +* result buffer(s), sizeof() is not reliable. Use the actual +* allocated buffer size, H24x7_DATA_BUFFER_SIZE. +*/ + ret = plpar_hcall_norets(H_GET_24X7_DATA, + virt_to_phys(request_buffer), H24x7_DATA_BUFFER_SIZE, + virt_to_phys(result_buffer), H24x7_DATA_BUFFER_SIZE); + + if (ret) + log_24x7_hcall(request_buffer, result_buffer, ret); + + return ret; +} + +/* * Add the given @event to the next slot in the 24x7 request_buffer. * * Note that H_GET_24X7_DATA hcall allows reading several counters' @@ -1044,7 +1082,6 @@ static int add_event_to_24x7_request(struct perf_event *event, static unsigned long single_24x7_request(struct perf_event *event, u64 *count) { unsigned long ret; - struct hv_24x7_request_buffer *request_buffer; struct hv_24x7_data_result_buffer *result_buffer; struct hv_24x7_result *resb; @@ -1055,31 +1092,22 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count) request_buffer = (void *)get_cpu_var(hv_24x7_reqb); result_buffer = (void *)get_cpu_var(hv_24x7_resb); - memset(request_buffer, 0, 4096); - memset(result_buffer, 0, 4096); - - request_buffer-interface_version = HV_24X7_IF_VERSION_CURRENT; + init_24x7_request(request_buffer, result_buffer); ret = add_event_to_24x7_request(event, request_buffer); if (ret) return ret; - /* -* NOTE: Due to variable number of array elements in request and -* result buffer(s), sizeof() is not reliable. Use the actual -* allocated buffer size, H24x7_DATA_BUFFER_SIZE. -*/ - ret = plpar_hcall_norets(H_GET_24X7_DATA, - virt_to_phys(request_buffer), H24x7_DATA_BUFFER_SIZE, - virt_to_phys(result_buffer), H24x7_DATA_BUFFER_SIZE); - + ret = make_24x7_request(request_buffer, result_buffer); if (ret) { log_24x7_hcall(request_buffer, result_buffer, ret); goto out; } + /* process result from hcall */ resb = result_buffer-results[0]; *count = be64_to_cpu(resb-elements[0].element_data[0]); + out: return ret; } -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v3, 3/3] powerpc/powernv: Introduce sysfs control for fastsleep workaround behavior
On Mon, 2015-03-30 at 22:45 +0530, Shreyas B Prabhu wrote: On Monday 30 March 2015 03:51 PM, Michael Ellerman wrote: This sounds good, although the name is a bit vague. How about fastsleep_workaround_permanent, with default value = 0. User can make workaround permanent by echoing 1 to it. Yeah that's OK. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 04/19] powerpc: Create pci_controller_ops.dma_dev_setup and shim
Introduces the pci_controller_ops structure. Add pci_controller_ops.dma_dev_setup, shadowing ppc_md.pci_dma_dev_setup. Add a shim, and change the callsites to use the shim. Signed-off-by: Daniel Axtens d...@axtens.net --- v1 -- v2: - Better commit message - Use phb in favour of hose - Make shim name match ppc_md name, not pci_controller_ops name. --- arch/powerpc/include/asm/pci-bridge.h | 21 + arch/powerpc/kernel/pci-common.c | 3 +-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 546d036..347d49d 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -15,6 +15,13 @@ struct device_node; /* + * PCI controller operations + */ +struct pci_controller_ops { + void(*dma_dev_setup)(struct pci_dev *dev); +}; + +/* * Structure of a PCI controller (host bridge) */ struct pci_controller { @@ -46,6 +53,7 @@ struct pci_controller { resource_size_t isa_mem_phys; resource_size_t isa_mem_size; + struct pci_controller_ops controller_ops; struct pci_ops *ops; unsigned int __iomem *cfg_addr; void __iomem *cfg_data; @@ -258,5 +266,18 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address) } #endif /* CONFIG_PCI */ +/* + * Shims to prefer pci_controller version over ppc_md where available. + */ +static inline void pci_dma_dev_setup(struct pci_dev *dev) +{ + struct pci_controller *phb = pci_bus_to_host(dev-bus); + + if (phb-controller_ops.dma_dev_setup) + phb-controller_ops.dma_dev_setup(dev); + else if (ppc_md.pci_dma_dev_setup) + ppc_md.pci_dma_dev_setup(dev); +} + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 3d07d81..bce6356 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -969,8 +969,7 @@ static void pcibios_setup_device(struct pci_dev *dev) set_dma_offset(dev-dev, PCI_DRAM_OFFSET); /* Additional platform DMA/iommu setup */ - if (ppc_md.pci_dma_dev_setup) - ppc_md.pci_dma_dev_setup(dev); + pci_dma_dev_setup(dev); /* Read default IRQs and fixup if necessary */ pci_read_irq_line(dev); -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 18/19] powerpc: Remove shims for pci_controller_ops operations
Remove shims, patch callsites to use pci_controller_ops versions instead. Also move back the probe mode defines, as explained in the patch for pci_probe_mode. Signed-off-by: Daniel Axtens d...@axtens.net --- v1 -- v2: - Squash all the shim removal. - Prefer phb to hose. --- arch/powerpc/include/asm/machdep.h| 14 -- arch/powerpc/include/asm/pci-bridge.h | 84 --- arch/powerpc/include/asm/pci.h| 5 +++ arch/powerpc/kernel/pci-common.c | 43 ++ arch/powerpc/kernel/pci-hotplug.c | 6 ++- arch/powerpc/kernel/pci_of_scan.c | 6 ++- arch/powerpc/sysdev/dart_iommu.c | 5 --- 7 files changed, 50 insertions(+), 113 deletions(-) diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index 9d4a067..92b085b 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h @@ -103,9 +103,6 @@ struct machdep_calls { #endif #endif /* CONFIG_PPC64 */ - void(*pci_dma_dev_setup)(struct pci_dev *dev); - void(*pci_dma_bus_setup)(struct pci_bus *bus); - /* Platform set_dma_mask and dma_get_required_mask overrides */ int (*dma_set_mask)(struct device *dev, u64 dma_mask); u64 (*dma_get_required_mask)(struct device *dev); @@ -127,7 +124,6 @@ struct machdep_calls { /* PCI stuff */ /* Called after scanning the bus, before allocating resources */ void(*pcibios_fixup)(void); - int (*pci_probe_mode)(struct pci_bus *); void(*pci_irq_fixup)(struct pci_dev *dev); int (*pcibios_root_bridge_prepare)(struct pci_host_bridge *bridge); @@ -237,19 +233,9 @@ struct machdep_calls { /* Called for each PCI bus in the system when it's probed */ void (*pcibios_fixup_bus)(struct pci_bus *); - /* Called when pci_enable_device() is called. Returns true to -* allow assignment/enabling of the device. */ - bool (*pcibios_enable_device_hook)(struct pci_dev *); - /* Called after scan and before resource survey */ void (*pcibios_fixup_phb)(struct pci_controller *hose); - /* Called during PCI resource reassignment */ - resource_size_t (*pcibios_window_alignment)(struct pci_bus *, unsigned long type); - - /* Reset the secondary bus of bridge */ - void (*pcibios_reset_secondary_bus)(struct pci_dev *dev); - /* Called to shutdown machine specific hardware not already controlled * by other drivers. */ diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index d2cba2f..4f39ef9 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -12,11 +12,6 @@ #include linux/ioport.h #include asm-generic/pci-bridge.h -/* Return values for pci_controller_ops.probe_mode function */ -#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ -#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ -#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ - struct device_node; /* @@ -282,84 +277,5 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address) } #endif /* CONFIG_PCI */ -/* - * Shims to prefer pci_controller version over ppc_md where available. - */ -static inline void pci_dma_dev_setup(struct pci_dev *dev) -{ - struct pci_controller *phb = pci_bus_to_host(dev-bus); - - if (phb-controller_ops.dma_dev_setup) - phb-controller_ops.dma_dev_setup(dev); - else if (ppc_md.pci_dma_dev_setup) - ppc_md.pci_dma_dev_setup(dev); -} - -static inline void pci_dma_bus_setup(struct pci_bus *bus) -{ - struct pci_controller *phb = pci_bus_to_host(bus); - - if (phb-controller_ops.dma_bus_setup) - phb-controller_ops.dma_bus_setup(bus); - else if (ppc_md.pci_dma_bus_setup) - ppc_md.pci_dma_bus_setup(bus); -} - -static inline int pci_probe_mode(struct pci_bus *bus) -{ - struct pci_controller *phb = pci_bus_to_host(bus); - - if (phb-controller_ops.probe_mode) - return phb-controller_ops.probe_mode(bus); - if (ppc_md.pci_probe_mode) - return ppc_md.pci_probe_mode(bus); - return PCI_PROBE_NORMAL; -} - -static inline bool pcibios_enable_device_hook(struct pci_dev *dev) -{ - struct pci_controller *phb = pci_bus_to_host(dev-bus); - - if (phb-controller_ops.enable_device_hook) - return phb-controller_ops.enable_device_hook(dev); - if (ppc_md.pcibios_enable_device_hook) - return ppc_md.pcibios_enable_device_hook(dev); - return true; -} - -static inline resource_size_t pci_window_alignment(struct pci_bus *bus, - unsigned long type) -{ - struct
[PATCH v2 02/19] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/powermac/pci.c | 17 + arch/powerpc/platforms/powermac/pmac.h | 4 arch/powerpc/platforms/powermac/setup.c | 18 -- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index f4071a6..a792f45 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev) pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); + +#ifdef CONFIG_PPC64 +int pmac_pci_probe_mode(struct pci_bus *bus) +{ + struct device_node *node = pci_bus_to_OF_node(bus); + + /* We need to use normal PCI probing for the AGP bus, +* since the device for the AGP bridge isn't in the tree. +* Same for the PCIe host on U4 and the HT host bridge. +*/ + if (bus-self == NULL (of_device_is_compatible(node, u3-agp) || + of_device_is_compatible(node, u4-pcie) || + of_device_is_compatible(node, u3-ht))) + return PCI_PROBE_NORMAL; + return PCI_PROBE_DEVTREE; +} +#endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index 8327cce..46d2193 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); extern int pmac_nvram_init(void); extern void pmac_pic_init(void); +#ifdef CONFIG_PPC64 +extern int pmac_pci_probe_mode(struct pci_bus *bus); +#endif + #endif /* __PMAC_H__ */ diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 713d36d..efe172d 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c @@ -637,24 +637,6 @@ static int __init pmac_probe(void) return 1; } -#ifdef CONFIG_PPC64 -/* Move that to pci.c */ -static int pmac_pci_probe_mode(struct pci_bus *bus) -{ - struct device_node *node = pci_bus_to_OF_node(bus); - - /* We need to use normal PCI probing for the AGP bus, -* since the device for the AGP bridge isn't in the tree. -* Same for the PCIe host on U4 and the HT host bridge. -*/ - if (bus-self == NULL (of_device_is_compatible(node, u3-agp) || - of_device_is_compatible(node, u4-pcie) || - of_device_is_compatible(node, u3-ht))) - return PCI_PROBE_NORMAL; - return PCI_PROBE_DEVTREE; -} -#endif /* CONFIG_PPC64 */ - define_machine(powermac) { .name = PowerMac, .probe = pmac_probe, -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 06/19] powerpc: Create pci_controller_ops.probe_mode and shim
Add pci_controller_ops.probe_mode, shadowing ppc_md.pci_probe_mode. Add a shim, and changes the callsites to use the shim. We also need to move the probe mode defines to pci-bridge.h from pci.h. They are required by the shim in order to return a sensible default. Previously, the were defined in pci.h, but pci.h includes pci-bridge.h before the relevant #defines. This means the definitions are absent if pci.h is included before pci-bridge.h. This occurs in some drivers. So, move the definitons now, and move them back when we remove the shim. Anything that wants the defines would have had to include pci.h, and since pci.h includes pci-bridge.h, nothing will lose access to the defines. Signed-off-by: Daniel Axtens d...@axtens.net --- v1 -- v2: - Better commit message - Use phb in favour of hose - Make shim name match ppc_md name, not pci_controller_ops name. --- arch/powerpc/include/asm/pci-bridge.h | 18 ++ arch/powerpc/include/asm/pci.h| 5 - arch/powerpc/kernel/pci-common.c | 4 ++-- arch/powerpc/kernel/pci-hotplug.c | 3 +-- arch/powerpc/kernel/pci_of_scan.c | 3 +-- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 44305ac..65ffc16 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -12,6 +12,11 @@ #include linux/ioport.h #include asm-generic/pci-bridge.h +/* Return values for pci_controller_ops.probe_mode function */ +#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ +#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ +#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ + struct device_node; /* @@ -20,6 +25,8 @@ struct device_node; struct pci_controller_ops { void(*dma_dev_setup)(struct pci_dev *dev); void(*dma_bus_setup)(struct pci_bus *bus); + + int (*probe_mode)(struct pci_bus *); }; /* @@ -290,5 +297,16 @@ static inline void pci_dma_bus_setup(struct pci_bus *bus) ppc_md.pci_dma_bus_setup(bus); } +static inline int pci_probe_mode(struct pci_bus *bus) +{ + struct pci_controller *phb = pci_bus_to_host(bus); + + if (phb-controller_ops.probe_mode) + return phb-controller_ops.probe_mode(bus); + if (ppc_md.pci_probe_mode) + return ppc_md.pci_probe_mode(bus); + return PCI_PROBE_NORMAL; +} + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h index 1b0739b..8745067 100644 --- a/arch/powerpc/include/asm/pci.h +++ b/arch/powerpc/include/asm/pci.h @@ -22,11 +22,6 @@ #include asm-generic/pci-dma-compat.h -/* Return values for ppc_md.pci_probe_mode function */ -#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ -#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ -#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ - #define PCIBIOS_MIN_IO 0x1000 #define PCIBIOS_MIN_MEM0x1000 diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 317ed00..977859e 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -1622,8 +1622,8 @@ void pcibios_scan_phb(struct pci_controller *hose) /* Get probe mode and perform scan */ mode = PCI_PROBE_NORMAL; - if (node ppc_md.pci_probe_mode) - mode = ppc_md.pci_probe_mode(bus); + if (node) + mode = pci_probe_mode(bus); pr_debug(probe mode: %d\n, mode); if (mode == PCI_PROBE_DEVTREE) of_scan_bus(node, bus); diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 5b78917..2cc9ccb 100644 --- a/arch/powerpc/kernel/pci-hotplug.c +++ b/arch/powerpc/kernel/pci-hotplug.c @@ -78,8 +78,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus) eeh_add_device_tree_early(dn); mode = PCI_PROBE_NORMAL; - if (ppc_md.pci_probe_mode) - mode = ppc_md.pci_probe_mode(bus); + mode = pci_probe_mode(bus); if (mode == PCI_PROBE_DEVTREE) { /* use ofdt-based probe */ diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c index e6245e9..25f8c57 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c @@ -287,8 +287,7 @@ void of_scan_pci_bridge(struct pci_dev *dev) pr_debug(bus name: %s\n, bus-name); mode = PCI_PROBE_NORMAL; - if (ppc_md.pci_probe_mode) - mode = ppc_md.pci_probe_mode(bus); + mode = pci_probe_mode(bus); pr_debug(probe mode: %d\n, mode); if (mode == PCI_PROBE_DEVTREE) -- 2.1.4 ___ Linuxppc-dev
[PATCH v2 07/19] powerpc: Create pci_controller_ops.enable_device_hook and shim
Add pci_controller_ops.enable_device_hook, shadowing ppc_md.pcibios_enable_device_hook. Add a shim, and changes the callsites to use the shim. Signed-off-by: Daniel Axtens d...@axtens.net --- v1 -- v2: - Better commit message - Use phb in favour of hose - Make shim name match ppc_md name, not pci_controller_ops name. --- arch/powerpc/include/asm/pci-bridge.h | 15 +++ arch/powerpc/kernel/pci-common.c | 5 ++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 65ffc16..ece38e2 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -27,6 +27,10 @@ struct pci_controller_ops { void(*dma_bus_setup)(struct pci_bus *bus); int (*probe_mode)(struct pci_bus *); + + /* Called when pci_enable_device() is called. Returns true to +* allow assignment/enabling of the device. */ + bool(*enable_device_hook)(struct pci_dev *); }; /* @@ -308,5 +312,16 @@ static inline int pci_probe_mode(struct pci_bus *bus) return PCI_PROBE_NORMAL; } +static inline bool pcibios_enable_device_hook(struct pci_dev *dev) +{ + struct pci_controller *phb = pci_bus_to_host(dev-bus); + + if (phb-controller_ops.enable_device_hook) + return phb-controller_ops.enable_device_hook(dev); + if (ppc_md.pcibios_enable_device_hook) + return ppc_md.pcibios_enable_device_hook(dev); + return true; +} + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 977859e..fe8c893 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -1448,9 +1448,8 @@ EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); int pcibios_enable_device(struct pci_dev *dev, int mask) { - if (ppc_md.pcibios_enable_device_hook) - if (!ppc_md.pcibios_enable_device_hook(dev)) - return -EINVAL; + if (!pcibios_enable_device_hook(dev)) + return -EINVAL; return pci_enable_resources(dev, mask); } -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 11/19] powerpc/powermac: Move controller ops from ppc_md to controller_ops
This moves the Power Mac platform to use the pci_controller_ops structure rather than ppc_md for PCI controller operations. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/powermac/pci.c | 17 +++-- arch/powerpc/platforms/powermac/pmac.h | 5 + arch/powerpc/platforms/powermac/setup.c | 4 +--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index 9c89fd2..59ab16f 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c @@ -27,6 +27,8 @@ #include asm/grackle.h #include asm/ppc-pci.h +#include pmac.h + #undef DEBUG #ifdef DEBUG @@ -798,6 +800,7 @@ static int __init pmac_add_bridge(struct device_node *dev) return -ENOMEM; hose-first_busno = bus_range ? bus_range[0] : 0; hose-last_busno = bus_range ? bus_range[1] : 0xff; + hose-controller_ops = pmac_pci_controller_ops; disp_name = NULL; @@ -942,7 +945,7 @@ void __init pmac_pci_init(void) } #ifdef CONFIG_PPC32 -bool pmac_pci_enable_device_hook(struct pci_dev *dev) +static bool pmac_pci_enable_device_hook(struct pci_dev *dev) { struct device_node* node; int updatecfg = 0; @@ -1225,7 +1228,7 @@ static void fixup_u4_pcie(struct pci_dev* dev) DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); #ifdef CONFIG_PPC64 -int pmac_pci_probe_mode(struct pci_bus *bus) +static int pmac_pci_probe_mode(struct pci_bus *bus) { struct device_node *node = pci_bus_to_OF_node(bus); @@ -1240,3 +1243,13 @@ int pmac_pci_probe_mode(struct pci_bus *bus) return PCI_PROBE_DEVTREE; } #endif /* CONFIG_PPC64 */ + +struct pci_controller_ops pmac_pci_controller_ops = { +#ifdef CONFIG_PPC64 + .probe_mode = pmac_pci_probe_mode, +#endif +#ifdef CONFIG_PPC32 + .enable_device_hook = pmac_pci_enable_device_hook, +#endif +}; + diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index b8d5721..e7f8163 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h @@ -25,7 +25,6 @@ extern void pmac_pci_init(void); extern void pmac_nvram_update(void); extern unsigned char pmac_nvram_read_byte(int addr); extern void pmac_nvram_write_byte(int addr, unsigned char val); -extern bool pmac_pci_enable_device_hook(struct pci_dev *dev); extern void pmac_pcibios_after_init(void); extern int of_show_percpuinfo(struct seq_file *m, int i); @@ -39,8 +38,6 @@ extern void low_cpu_die(void) __attribute__((noreturn)); extern int pmac_nvram_init(void); extern void pmac_pic_init(void); -#ifdef CONFIG_PPC64 -extern int pmac_pci_probe_mode(struct pci_bus *bus); -#endif +extern struct pci_controller_ops pmac_pci_controller_ops; #endif /* __PMAC_H__ */ diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 71a353c..8dd78f4 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c @@ -473,7 +473,7 @@ static void __init pmac_init_early(void) udbg_adb_init(!!strstr(boot_command_line, btextdbg)); #ifdef CONFIG_PPC64 - iommu_init_early_dart(NULL); + iommu_init_early_dart(pmac_pci_controller_ops); #endif /* SMP Init has to be done early as we need to patch up @@ -656,12 +656,10 @@ define_machine(powermac) { .feature_call = pmac_do_feature_call, .progress = udbg_progress, #ifdef CONFIG_PPC64 - .pci_probe_mode = pmac_pci_probe_mode, .power_save = power4_idle, .enable_pmcs= power4_enable_pmcs, #endif /* CONFIG_PPC64 */ #ifdef CONFIG_PPC32 - .pcibios_enable_device_hook = pmac_pci_enable_device_hook, .pcibios_after_init = pmac_pcibios_after_init, .phys_mem_access_prot = pci_phys_mem_access_prot, #endif -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 14/19] powerpc/pasemi: Move controller ops from ppc_md to controller_ops
This moves the PaSemi platform to use the pci_controller_ops structure rather than ppc_md for PCI controller operations. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/pasemi/iommu.c | 6 -- arch/powerpc/platforms/pasemi/pasemi.h | 1 + arch/powerpc/platforms/pasemi/pci.c| 5 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c index 2e576f2..b8f567b 100644 --- a/arch/powerpc/platforms/pasemi/iommu.c +++ b/arch/powerpc/platforms/pasemi/iommu.c @@ -27,6 +27,8 @@ #include asm/machdep.h #include asm/firmware.h +#include pasemi.h + #define IOBMAP_PAGE_SHIFT 12 #define IOBMAP_PAGE_SIZE (1 IOBMAP_PAGE_SHIFT) #define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1) @@ -248,8 +250,8 @@ void __init iommu_init_early_pasemi(void) iob_init(NULL); - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pasemi; - ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi; + pasemi_pci_controller_ops.dma_dev_setup = pci_dma_dev_setup_pasemi; + pasemi_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pasemi; ppc_md.tce_build = iobmap_build; ppc_md.tce_free = iobmap_free; set_pci_dma_ops(dma_iommu_ops); diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h index ea65bf0..11f230a 100644 --- a/arch/powerpc/platforms/pasemi/pasemi.h +++ b/arch/powerpc/platforms/pasemi/pasemi.h @@ -30,5 +30,6 @@ static inline void restore_astate(int cpu) } #endif +extern struct pci_controller_ops pasemi_pci_controller_ops; #endif /* _PASEMI_PASEMI_H */ diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c index aa86271..f3a68a0 100644 --- a/arch/powerpc/platforms/pasemi/pci.c +++ b/arch/powerpc/platforms/pasemi/pci.c @@ -31,6 +31,8 @@ #include asm/ppc-pci.h +#include pasemi.h + #define PA_PXP_CFA(bus, devfn, off) (((bus) 20) | ((devfn) 12) | (off)) static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset) @@ -199,6 +201,7 @@ static int __init pas_add_bridge(struct device_node *dev) hose-first_busno = 0; hose-last_busno = 0xff; + hose-controller_ops = pasemi_pci_controller_ops; setup_pa_pxp(hose); @@ -239,3 +242,5 @@ void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset) return (void __iomem *)pa_pxp_cfg_addr(hose, dev-bus-number, dev-devfn, offset); } + +struct pci_controller_ops pasemi_pci_controller_ops; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 15/19] powerpc/maple: Move controller ops from ppc_md to controller_ops
This moves the Maple platform to use the pci_controller_ops structure rather than ppc_md for PCI controller operations. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/maple/maple.h | 2 ++ arch/powerpc/platforms/maple/pci.c | 4 arch/powerpc/platforms/maple/setup.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/maple/maple.h b/arch/powerpc/platforms/maple/maple.h index c6911dd..eecfa18 100644 --- a/arch/powerpc/platforms/maple/maple.h +++ b/arch/powerpc/platforms/maple/maple.h @@ -10,3 +10,5 @@ extern void maple_calibrate_decr(void); extern void maple_pci_init(void); extern void maple_pci_irq_fixup(struct pci_dev *dev); extern int maple_pci_get_legacy_ide_irq(struct pci_dev *dev, int channel); + +extern struct pci_controller_ops maple_pci_controller_ops; diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c index d3a1306..a923230 100644 --- a/arch/powerpc/platforms/maple/pci.c +++ b/arch/powerpc/platforms/maple/pci.c @@ -510,6 +510,7 @@ static int __init maple_add_bridge(struct device_node *dev) return -ENOMEM; hose-first_busno = bus_range ? bus_range[0] : 0; hose-last_busno = bus_range ? bus_range[1] : 0xff; + hose-controller_ops = maple_pci_controller_ops; disp_name = NULL; if (of_device_is_compatible(dev, u3-agp)) { @@ -660,3 +661,6 @@ static void quirk_ipr_msi(struct pci_dev *dev) } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, quirk_ipr_msi); + +struct pci_controller_ops maple_pci_controller_ops = { +}; diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index 3bf2e03..a837188 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c @@ -203,7 +203,7 @@ static void __init maple_init_early(void) { DBG( - maple_init_early\n); - iommu_init_early_dart(NULL); + iommu_init_early_dart(maple_pci_controller_ops); DBG( - maple_init_early\n); } -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 19/19] powerpc: dart_iommu: Remove check for controller_ops == NULL case
Now that we have ported the calls to iommu_init_early_dart to always supply a pci_controller_ops struct, we can safely drop the check. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/sysdev/dart_iommu.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 87b8000..d00a566 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -395,20 +395,17 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) if (dart_is_u4) ppc_md.dma_set_mask = dart_dma_set_mask; - if (controller_ops) { - controller_ops-dma_dev_setup = pci_dma_dev_setup_dart; - controller_ops-dma_bus_setup = pci_dma_bus_setup_dart; - } + controller_ops-dma_dev_setup = pci_dma_dev_setup_dart; + controller_ops-dma_bus_setup = pci_dma_bus_setup_dart; + /* Setup pci_dma ops */ set_pci_dma_ops(dma_iommu_ops); return; bail: /* If init failed, use direct iommu and null setup functions */ - if (controller_ops) { - controller_ops-dma_dev_setup = NULL; - controller_ops-dma_bus_setup = NULL; - } + controller_ops-dma_dev_setup = NULL; + controller_ops-dma_bus_setup = NULL; /* Setup pci_dma ops */ set_pci_dma_ops(dma_direct_ops); -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [1/4] powerpc/fsl-booke: Add device tree support for T1024/T1023 SoC
There are other differences between t1023 an t1024. Where do you describe t1024's QE? Where do you describe the DDR and IFC differences? can they be detected at runtime? t1024 supports deep sleep, but t1023 doesn't -- yet you label both chips as having t1024 rcpm. As QE IP block has not been upstream yet, Huh? arch/powerpc/sysdev/qe_lib/ arch/powerpc/boot/dts/fsl/qoriq-tdm1.0.dtsi has not been upstream by TDM owner. Ok, I will first send qoriq-tdm1.0.dtsi upstream in order to include QE in t1024 dts. DDR and IFC differences are in u-boot, not in dts. The differences are in hardware, which is what the dts is supposed to describe. Theoretically I think so, but not all hardware details must be described in dts as current IP driver doesn't take care of it from dts. If so, IP owners will have to update drivers, for now let's keep as it's. Both t1023 and t1024 support sleep, so label both chips as having t1024 rcpm. That's not how it works. Only t1024 has deep sleep, the difference is identified in *.c not in dts (confirmed with deep sleep owner). Even if the C code chooses to use SVR to identify the difference (why?), that doesn't mean it's OK for the device tree to contain wrong information. Where is the wrong information? rcpm: global-utilities@e2000 { compatible = fsl,t1024-rcpm, fsl,qoriq-rcpm-2.0; reg = 0xe2000 0x1000; }; sdhc@114000 { compatible = fsl,t1024-esdhc, fsl,esdhc; fsl,iommu-parent = pamu0; fsl,liodn-reg = guts 0x530; /* eSDHCLIODNR */ sdhci,auto-cmd12; no-1-8-v; sleep = rcpm 0x0080; }; t1023 also supports sleep(not deep sleep), it needs the info above. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 00/19] Refactor PCI controller operations
This patch set moves some PCI controller operations out of ppc_md and into a new pci_controller_ops struct. This is desirable for systems with more than one type of PCI controller. In particular, it's intended that this new interface will be used by the CXL (aka CAPI) driver. The design tries to balance a desire to avoid having yet another abstraction layer with a desire to make it easy for vendor kernels to pull in as little or as much as they are comfortable with. To this end, it's in 3 main parts: 1) Set up the pci_controller_ops structure. For each function we add to the structure, set up a shim that calls the controller_ops function if it exists, or the ppc_md function otherwise. Modify callsites to use the shims. 2) Move each affected platform over from using ppc_md to using the controller_ops structure. 3) Take out the shims and the ppc_md entries. Modify the callsites to use the controller_ops calls. MSI and some legacy functions have been deliberately deferred, and will be to be tackled at a later point. The set has been build tested for PowerNV, pSeries, Power Mac, Maple, Cell, PaSemi and Corenet 64 (for fsl_pci). It builds at every point in the series. The set depends on mpe's two recent cleanup patches to remove powernv RTAS support [1] and drop celleb [2]. Thanks for feedback from mpe, there is one functional change since v1, and a number of cosmetic ones. Functionally: - A mistake was made regarding in fsl_pci/swiotlb. I though that setting ppc_swiotlb_enable in fsl_pci.c couldn't have an effect, and removed it in patch #4. This was wrong. Drop the offending patch. In the patch that ports fsl_pci/swiotlb to the new structure, move the hook around so that it always has the correct value. Cosmetically: - Prefer phb over hose whenever possible. - Drop an unnecessary renaming patch. (prev #3) - Squash all the shim removal. - Squash the creation of the struct with the addition of the first member. - Better commit messages. (Thanks sfr mpe) - Shims now have names that (where possible) match the ppc_md names, rather than the new, non-namespaced names. The series has also been rebased onto -rc6; no changes were necessary. The full breakdown of the patches is as follows: Patches 1 - 3: minor necessary cleanups Patches 4 - 9: Introduce struct and shims Patches 10 - 17: Platform specific migrations Patch18: Remove shims Patch19: Final cleanup Daniel Axtens (19): powerpc: move find_and_init_phbs() to pSeries specific code powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c powerpc: pcibios_enable_device_hook: return bool rather than int powerpc: Create pci_controller_ops.dma_dev_setup and shims powerpc: Create pci_controller_ops.dma_bus_setup and shim powerpc: Create pci_controller_ops.probe_mode and shim powerpc: Create pci_controller_ops.enable_device_hook and shim powerpc: Create pci_controller_ops.window_alignment and shim powerpc: Create pci_controller_ops.reset_secondary_bus and shim powerpc: dart_iommu: optionally populate controller_ops on init powerpc/powermac: Move controller ops from ppc_md to controller_ops powerpc/pseries: Move controller ops from ppc_md to controller_ops powerpc/powernv: Move controller ops from ppc_md to controller_ops powerpc/pasemi: Move controller ops from ppc_md to controller_ops powerpc/maple: Move controller ops from ppc_md to controller_ops powerpc: fsl_pci, swiotlb: Move controller ops from ppc_md to controller_ops powerpc/cell: Move controller ops from ppc_md to controller_ops powerpc: Remove shims for pci_controller_ops operations powerpc: dart_iommu: Remove check for controller_ops == NULL case arch/powerpc/include/asm/iommu.h| 3 +- arch/powerpc/include/asm/machdep.h | 14 arch/powerpc/include/asm/pci-bridge.h | 19 +++ arch/powerpc/include/asm/pci.h | 2 +- arch/powerpc/include/asm/ppc-pci.h | 3 -- arch/powerpc/kernel/dma-swiotlb.c | 11 +++--- arch/powerpc/kernel/pci-common.c| 35 --- arch/powerpc/kernel/pci-hotplug.c | 7 ++-- arch/powerpc/kernel/pci_of_scan.c | 7 ++-- arch/powerpc/kernel/rtas_pci.c | 47 - arch/powerpc/platforms/cell/cell.h | 24 + arch/powerpc/platforms/cell/iommu.c | 7 ++-- arch/powerpc/platforms/cell/setup.c | 5 +++ arch/powerpc/platforms/maple/maple.h| 2 ++ arch/powerpc/platforms/maple/pci.c | 4 +++ arch/powerpc/platforms/maple/setup.c| 2 +- arch/powerpc/platforms/pasemi/iommu.c | 6 ++-- arch/powerpc/platforms/pasemi/pasemi.h | 1 + arch/powerpc/platforms/pasemi/pci.c | 5 +++ arch/powerpc/platforms/powermac/pci.c | 38 ++--- arch/powerpc/platforms/powermac/pmac.h | 3 +- arch/powerpc/platforms/powermac/setup.c | 22
[PATCH v2 01/19] powerpc: move find_and_init_phbs() to pSeries specific code
Previously, find_and_init_phbs() was used in both PowerNV and pSeries setup. However, since RTAS support has been dropped from PowerNV, we can move it into a platform-specific file. Signed-off-by: Daniel Axtens d...@axtens.net --- This patch depends on the patch to drop RTAS support from PowerNV: http://patchwork.ozlabs.org/patch/449316/ --- arch/powerpc/include/asm/ppc-pci.h | 3 --- arch/powerpc/kernel/rtas_pci.c | 47 -- arch/powerpc/platforms/pseries/setup.c | 47 ++ 3 files changed, 47 insertions(+), 50 deletions(-) diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h index db1e2b8..83f7e8e 100644 --- a/arch/powerpc/include/asm/ppc-pci.h +++ b/arch/powerpc/include/asm/ppc-pci.h @@ -23,8 +23,6 @@ extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary); extern struct list_head hose_list; -extern void find_and_init_phbs(void); - extern struct pci_dev *isa_bridge_pcidev; /* may be NULL if no ISA bus */ /** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */ @@ -76,7 +74,6 @@ static inline const char *eeh_driver_name(struct pci_dev *pdev) #endif /* CONFIG_EEH */ #else /* CONFIG_PCI */ -static inline void find_and_init_phbs(void) { } static inline void init_pci_config_tokens(void) { } #endif /* !CONFIG_PCI */ diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c index ce230da..42db314 100644 --- a/arch/powerpc/kernel/rtas_pci.c +++ b/arch/powerpc/kernel/rtas_pci.c @@ -277,50 +277,3 @@ int rtas_setup_phb(struct pci_controller *phb) return 0; } - -void __init find_and_init_phbs(void) -{ - struct device_node *node; - struct pci_controller *phb; - struct device_node *root = of_find_node_by_path(/); - - for_each_child_of_node(root, node) { - if (node-type == NULL || (strcmp(node-type, pci) != 0 - strcmp(node-type, pciex) != 0)) - continue; - - phb = pcibios_alloc_controller(node); - if (!phb) - continue; - rtas_setup_phb(phb); - pci_process_bridge_OF_ranges(phb, node, 0); - isa_bridge_find_early(phb); - } - - of_node_put(root); - pci_devs_phb_init(); - - /* -* PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties -* in chosen. -*/ - if (of_chosen) { - const int *prop; - - prop = of_get_property(of_chosen, - linux,pci-probe-only, NULL); - if (prop) { - if (*prop) - pci_add_flags(PCI_PROBE_ONLY); - else - pci_clear_flags(PCI_PROBE_ONLY); - } - -#ifdef CONFIG_PPC32 /* Will be made generic soon */ - prop = of_get_property(of_chosen, - linux,pci-assign-all-buses, NULL); - if (prop *prop) - pci_add_flags(PCI_REASSIGN_ALL_BUS); -#endif /* CONFIG_PPC32 */ - } -} diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index e445b67..1a5f884 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -461,6 +461,53 @@ static long pseries_little_endian_exceptions(void) } #endif +static void __init find_and_init_phbs(void) +{ + struct device_node *node; + struct pci_controller *phb; + struct device_node *root = of_find_node_by_path(/); + + for_each_child_of_node(root, node) { + if (node-type == NULL || (strcmp(node-type, pci) != 0 + strcmp(node-type, pciex) != 0)) + continue; + + phb = pcibios_alloc_controller(node); + if (!phb) + continue; + rtas_setup_phb(phb); + pci_process_bridge_OF_ranges(phb, node, 0); + isa_bridge_find_early(phb); + } + + of_node_put(root); + pci_devs_phb_init(); + + /* +* PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties +* in chosen. +*/ + if (of_chosen) { + const int *prop; + + prop = of_get_property(of_chosen, + linux,pci-probe-only, NULL); + if (prop) { + if (*prop) + pci_add_flags(PCI_PROBE_ONLY); + else + pci_clear_flags(PCI_PROBE_ONLY); + } + +#ifdef CONFIG_PPC32 /* Will be made generic soon */ + prop = of_get_property(of_chosen, + linux,pci-assign-all-buses, NULL); + if (prop
[PATCH v2 09/19] powerpc: Create pci_controller_ops.reset_secondary_bus and shim
Add pci_controller_ops.reset_secondary_bus, shadowing ppc_md.pcibios_reset_secondary_bus. Add a shim, and changes the callsites to use the shim. Use pcibios_reset_secondary_bus_shim, as both pcibios_reset_secondary_bus and pci_reset_secondary_bus are already taken. Signed-off-by: Daniel Axtens d...@axtens.net --- v1 -- v2: - Better commit message - Use phb in favour of hose - Make shim name namespaced, not the raw pci_controller_ops name. --- arch/powerpc/include/asm/pci-bridge.h | 17 + arch/powerpc/kernel/pci-common.c | 7 +-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index cc91bc0..d2cba2f 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -34,6 +34,7 @@ struct pci_controller_ops { /* Called during PCI resource reassignment */ resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type); + void(*reset_secondary_bus)(struct pci_dev *dev); }; /* @@ -344,5 +345,21 @@ static inline resource_size_t pci_window_alignment(struct pci_bus *bus, return 1; } +static inline void pcibios_reset_secondary_bus_shim(struct pci_dev *dev) +{ + struct pci_controller *phb = pci_bus_to_host(dev-bus); + + if (phb-controller_ops.reset_secondary_bus) + phb-controller_ops.reset_secondary_bus(dev); + else if (ppc_md.pcibios_reset_secondary_bus) + ppc_md.pcibios_reset_secondary_bus(dev); + else + /* +* Fallback to the generic function if no +* platform-specific one is provided +*/ + pci_reset_secondary_bus(dev); +} + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index f1512b5..8b3616a 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -114,12 +114,7 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus, void pcibios_reset_secondary_bus(struct pci_dev *dev) { - if (ppc_md.pcibios_reset_secondary_bus) { - ppc_md.pcibios_reset_secondary_bus(dev); - return; - } - - pci_reset_secondary_bus(dev); + pcibios_reset_secondary_bus_shim(dev); } static resource_size_t pcibios_io_size(const struct pci_controller *hose) -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 10/19] powerpc: dart_iommu: optionally populate controller_ops on init
If a pci_controller_ops struct is provided to iommu_init_early_dart, populate that with the DMA setup ops, rather than ppc_md. If NULL is provided, populate ppc_md as before. This also patches the call sites for Maple and Power Mac to pass NULL, so existing behaviour is preserved. The benefit of making this optional is that it means we don't have to change dart, Maple and Power Mac over to the controller_ops system in one fell swoop. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/include/asm/iommu.h| 3 ++- arch/powerpc/platforms/maple/setup.c| 2 +- arch/powerpc/platforms/powermac/setup.c | 2 +- arch/powerpc/sysdev/dart_iommu.c| 16 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h index f1ea597..0be7d9e 100644 --- a/arch/powerpc/include/asm/iommu.h +++ b/arch/powerpc/include/asm/iommu.h @@ -29,6 +29,7 @@ #include linux/bitops.h #include asm/machdep.h #include asm/types.h +#include asm/pci-bridge.h #define IOMMU_PAGE_SHIFT_4K 12 #define IOMMU_PAGE_SIZE_4K (ASM_CONST(1) IOMMU_PAGE_SHIFT_4K) @@ -169,7 +170,7 @@ extern void iommu_unmap_page(struct iommu_table *tbl, dma_addr_t dma_handle, struct dma_attrs *attrs); extern void iommu_init_early_pSeries(void); -extern void iommu_init_early_dart(void); +extern void iommu_init_early_dart(struct pci_controller_ops *controller_ops); extern void iommu_init_early_pasemi(void); extern void alloc_dart_table(void); diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index 56b85cd..3bf2e03 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c @@ -203,7 +203,7 @@ static void __init maple_init_early(void) { DBG( - maple_init_early\n); - iommu_init_early_dart(); + iommu_init_early_dart(NULL); DBG( - maple_init_early\n); } diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index efe172d..71a353c 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c @@ -473,7 +473,7 @@ static void __init pmac_init_early(void) udbg_adb_init(!!strstr(boot_command_line, btextdbg)); #ifdef CONFIG_PPC64 - iommu_init_early_dart(); + iommu_init_early_dart(NULL); #endif /* SMP Init has to be done early as we need to patch up diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 9e5353f..120e96a 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -369,7 +369,7 @@ static int dart_dma_set_mask(struct device *dev, u64 dma_mask) return 0; } -void __init iommu_init_early_dart(void) +void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) { struct device_node *dn; @@ -395,15 +395,23 @@ void __init iommu_init_early_dart(void) if (dart_is_u4) ppc_md.dma_set_mask = dart_dma_set_mask; - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart; - ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; - + if (controller_ops) { + controller_ops-dma_dev_setup = pci_dma_dev_setup_dart; + controller_ops-dma_bus_setup = pci_dma_bus_setup_dart; + } else { + ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart; + ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart; + } /* Setup pci_dma ops */ set_pci_dma_ops(dma_iommu_ops); return; bail: /* If init failed, use direct iommu and null setup functions */ + if (controller_ops) { + controller_ops-dma_dev_setup = NULL; + controller_ops-dma_bus_setup = NULL; + } ppc_md.pci_dma_dev_setup = NULL; ppc_md.pci_dma_bus_setup = NULL; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 16/19] powerpc: fsl_pci, swiotlb: Move controller ops from ppc_md to controller_ops
Moves the setup out of swiotlb's subsys init call, and into an new structure. fsl_pci.c is the only thing that checks the ppc_swiotlb_enable global, so we can be confident that patching it will cover all the PCI implementations affected by the changes to dma-swiotlb.c. We do have to make sure we do the changes late in the function, after setup_pci_atmu, because that can change ppc_swiotlb_enable. Signed-off-by: Daniel Axtens d...@axtens.net --- v1 -- v2: - Move the setup call to after setup_pci_atmu(). --- arch/powerpc/kernel/dma-swiotlb.c | 11 --- arch/powerpc/sysdev/fsl_pci.c | 19 +++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c index 7359797..6e8d764 100644 --- a/arch/powerpc/kernel/dma-swiotlb.c +++ b/arch/powerpc/kernel/dma-swiotlb.c @@ -116,16 +116,13 @@ void __init swiotlb_detect_4g(void) } } -static int __init swiotlb_late_init(void) +static int __init check_swiotlb_enabled(void) { - if (ppc_swiotlb_enable) { + if (ppc_swiotlb_enable) swiotlb_print_info(); - set_pci_dma_ops(swiotlb_dma_ops); - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; - } else { + else swiotlb_free(); - } return 0; } -subsys_initcall(swiotlb_late_init); +subsys_initcall(check_swiotlb_enabled); diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 4b74c27..b124e17 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -111,6 +111,22 @@ static struct pci_ops fsl_indirect_pcie_ops = #define MAX_PHYS_ADDR_BITS 40 static u64 pci64_dma_offset = 1ull MAX_PHYS_ADDR_BITS; +#ifdef CONFIG_SWIOTLB +static struct pci_controller_ops swiotlb_pci_controller_ops = { + .dma_dev_setup = pci_dma_dev_setup_swiotlb, +}; + +static void setup_swiotlb_ops(struct pci_controller *hose) +{ + if (ppc_swiotlb_enable) { + hose-controller_ops = swiotlb_pci_controller_ops; + set_pci_dma_ops(swiotlb_dma_ops); + } +} +#else +static inline void setup_swiotlb_ops(struct pci_controller *hose) {} +#endif + static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask) { if (!dev-dma_mask || !dma_supported(dev, dma_mask)) @@ -548,6 +564,9 @@ int fsl_add_bridge(struct platform_device *pdev, int is_primary) /* Setup PEX window registers */ setup_pci_atmu(hose); + /* Set up controller operations */ + setup_swiotlb_ops(hose); + return 0; no_bridge: -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [1/4] powerpc/fsl-booke: Add device tree support for T1024/T1023 SoC
On Mon, 2015-03-30 at 22:32 -0500, Liu Shengzhou-B36685 wrote: There are other differences between t1023 an t1024. Where do you describe t1024's QE? Where do you describe the DDR and IFC differences? can they be detected at runtime? t1024 supports deep sleep, but t1023 doesn't -- yet you label both chips as having t1024 rcpm. As QE IP block has not been upstream yet, Huh? arch/powerpc/sysdev/qe_lib/ arch/powerpc/boot/dts/fsl/qoriq-tdm1.0.dtsi has not been upstream by TDM owner. Ok, I will first send qoriq-tdm1.0.dtsi upstream in order to include QE in t1024 dts. Thanks, but make sure there's also a binding for it. DDR and IFC differences are in u-boot, not in dts. The differences are in hardware, which is what the dts is supposed to describe. Theoretically I think so, but not all hardware details must be described in dts No, but all hardware should be properly identified. as current IP driver doesn't take care of it from dts. The device tree describes the hardware, not the driver. If so, IP owners will have to update drivers, for now let's keep as it's. Please don't use the phrase IP owner in upstream discussions. Besides being a bad name for maintainer, SDK maintainership isn't relevant here. Both t1023 and t1024 support sleep, so label both chips as having t1024 rcpm. That's not how it works. Only t1024 has deep sleep, the difference is identified in *.c not in dts (confirmed with deep sleep owner). Even if the C code chooses to use SVR to identify the difference (why?), that doesn't mean it's OK for the device tree to contain wrong information. Where is the wrong information? rcpm: global-utilities@e2000 { compatible = fsl,t1024-rcpm, fsl,qoriq-rcpm-2.0; reg = 0xe2000 0x1000; }; sdhc@114000 { compatible = fsl,t1024-esdhc, fsl,esdhc; fsl,iommu-parent = pamu0; fsl,liodn-reg = guts 0x530; /* eSDHCLIODNR */ sdhci,auto-cmd12; no-1-8-v; sleep = rcpm 0x0080; }; t1023 also supports sleep(not deep sleep), it needs the info above. The part that's wrong is where it says t1024. It's not t1024 and for rcpm it's not 100% compatible with t1024. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
On Tue, 2015-03-31 at 08:46 +1100, Benjamin Herrenschmidt wrote: On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote: On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote: Why did we move it? Just for cleanliness? diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index 8327cce..46d2193 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); extern int pmac_nvram_init(void); extern void pmac_pic_init(void); +#ifdef CONFIG_PPC64 +extern int pmac_pci_probe_mode(struct pci_bus *bus); +#endif You don't need to ifdef declarations, and you don't need extern. I like extern :-) If the rest of the file use it, I prefer if he continues doing so. I like Ponies. It's fashionable to not use it, and I expect we'll start seeing treewide extern-removal series soon enough, but whatever. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 03/19] powerpc: pcibios_enable_device_hook: return bool rather than int
pcibios_enable_device_hook returned an int. Every implementation returned either -EINVAL or 0. The return value wasn't propagated by the caller: any non-zero return value caused pcibios_enable_device to return -EINVAL itself. Therefore, make the hook return a bool. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/include/asm/machdep.h| 4 ++-- arch/powerpc/kernel/pci-common.c | 2 +- arch/powerpc/platforms/powermac/pci.c | 8 arch/powerpc/platforms/powermac/pmac.h| 2 +- arch/powerpc/platforms/powernv/pci-ioda.c | 8 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index c8175a3..9d4a067 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h @@ -237,9 +237,9 @@ struct machdep_calls { /* Called for each PCI bus in the system when it's probed */ void (*pcibios_fixup_bus)(struct pci_bus *); - /* Called when pci_enable_device() is called. Returns 0 to + /* Called when pci_enable_device() is called. Returns true to * allow assignment/enabling of the device. */ - int (*pcibios_enable_device_hook)(struct pci_dev *); + bool (*pcibios_enable_device_hook)(struct pci_dev *); /* Called after scan and before resource survey */ void (*pcibios_fixup_phb)(struct pci_controller *hose); diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 2a525c9..3d07d81 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -1451,7 +1451,7 @@ EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); int pcibios_enable_device(struct pci_dev *dev, int mask) { if (ppc_md.pcibios_enable_device_hook) - if (ppc_md.pcibios_enable_device_hook(dev)) + if (!ppc_md.pcibios_enable_device_hook(dev)) return -EINVAL; return pci_enable_resources(dev, mask); diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index a792f45..9c89fd2 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c @@ -942,7 +942,7 @@ void __init pmac_pci_init(void) } #ifdef CONFIG_PPC32 -int pmac_pci_enable_device_hook(struct pci_dev *dev) +bool pmac_pci_enable_device_hook(struct pci_dev *dev) { struct device_node* node; int updatecfg = 0; @@ -958,11 +958,11 @@ int pmac_pci_enable_device_hook(struct pci_dev *dev) !node) { printk(KERN_INFO Apple USB OHCI %s disabled by firmware\n, pci_name(dev)); - return -EINVAL; + return false; } if (!node) - return 0; + return true; uninorth_child = node-parent of_device_is_compatible(node-parent, uni-north); @@ -1003,7 +1003,7 @@ int pmac_pci_enable_device_hook(struct pci_dev *dev) L1_CACHE_BYTES 2); } - return 0; + return true; } void pmac_pci_fixup_ohci(struct pci_dev *dev) diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index 46d2193..b8d5721 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h @@ -25,7 +25,7 @@ extern void pmac_pci_init(void); extern void pmac_nvram_update(void); extern unsigned char pmac_nvram_read_byte(int addr); extern void pmac_nvram_write_byte(int addr, unsigned char val); -extern int pmac_pci_enable_device_hook(struct pci_dev *dev); +extern bool pmac_pci_enable_device_hook(struct pci_dev *dev); extern void pmac_pcibios_after_init(void); extern int of_show_percpuinfo(struct seq_file *m, int i); diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 6c9ff2b..c18e191 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -1910,7 +1910,7 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus, /* Prevent enabling devices for which we couldn't properly * assign a PE */ -static int pnv_pci_enable_device_hook(struct pci_dev *dev) +static bool pnv_pci_enable_device_hook(struct pci_dev *dev) { struct pci_controller *hose = pci_bus_to_host(dev-bus); struct pnv_phb *phb = hose-private_data; @@ -1922,13 +1922,13 @@ static int pnv_pci_enable_device_hook(struct pci_dev *dev) * PEs isn't ready. */ if (!phb-initialized) - return 0; + return true; pdn = pci_get_pdn(dev); if (!pdn || pdn-pe_number == IODA_INVALID_PE) - return -EINVAL; + return false; - return 0; + return true; } static u32 pnv_ioda_bdfn_to_pe(struct pnv_phb *phb, struct pci_bus *bus, -- 2.1.4
[PATCH v2 08/19] powerpc: Create pci_controller_ops.window_alignment and shim
Add pci_controller_ops.window_alignment, shadowing ppc_md.pcibios_window_alignment. Add a shim, and changes the callsites to use the shim. Here, we use pci_window_alignment, as pcibios_window_alignment is already taken. Signed-off-by: Daniel Axtens d...@axtens.net --- v1 -- v2: - Better commit message - Use phb in favour of hose --- arch/powerpc/include/asm/pci-bridge.h | 21 + arch/powerpc/kernel/pci-common.c | 10 +- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index ece38e2..cc91bc0 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -31,6 +31,9 @@ struct pci_controller_ops { /* Called when pci_enable_device() is called. Returns true to * allow assignment/enabling of the device. */ bool(*enable_device_hook)(struct pci_dev *); + + /* Called during PCI resource reassignment */ + resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type); }; /* @@ -323,5 +326,23 @@ static inline bool pcibios_enable_device_hook(struct pci_dev *dev) return true; } +static inline resource_size_t pci_window_alignment(struct pci_bus *bus, + unsigned long type) +{ + struct pci_controller *phb = pci_bus_to_host(bus); + + if (phb-controller_ops.window_alignment) + return phb-controller_ops.window_alignment(bus, type); + if (ppc_md.pcibios_window_alignment) + return ppc_md.pcibios_window_alignment(bus, type); + + /* +* PCI core will figure out the default +* alignment: 4KiB for I/O and 1MiB for +* memory window. +*/ + return 1; +} + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index fe8c893..f1512b5 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -109,15 +109,7 @@ void pcibios_free_controller(struct pci_controller *phb) resource_size_t pcibios_window_alignment(struct pci_bus *bus, unsigned long type) { - if (ppc_md.pcibios_window_alignment) - return ppc_md.pcibios_window_alignment(bus, type); - - /* -* PCI core will figure out the default -* alignment: 4KiB for I/O and 1MiB for -* memory window. -*/ - return 1; + return pci_window_alignment(bus, type); } void pcibios_reset_secondary_bus(struct pci_dev *dev) -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 13/19] powerpc/powernv: Move controller ops from ppc_md to controller_ops
This moves the PowerNV platform to use the pci_controller_ops structure rather than ppc_md for PCI controller operations. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/powernv/pci-ioda.c | 7 --- arch/powerpc/platforms/powernv/pci-p5ioc2.c | 1 + arch/powerpc/platforms/powernv/pci.c| 5 - arch/powerpc/platforms/powernv/powernv.h| 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index c18e191..b4e46bf 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -1988,6 +1988,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, hose-last_busno = 0xff; } hose-private_data = phb; + hose-controller_ops = pnv_pci_controller_ops; phb-hub_id = hub_id; phb-opal_id = phb_id; phb-type = ioda_type; @@ -2104,9 +2105,9 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, * the child P2P bridges) can form individual PE. */ ppc_md.pcibios_fixup = pnv_pci_ioda_fixup; - ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook; - ppc_md.pcibios_window_alignment = pnv_pci_window_alignment; - ppc_md.pcibios_reset_secondary_bus = pnv_pci_reset_secondary_bus; + pnv_pci_controller_ops.enable_device_hook = pnv_pci_enable_device_hook; + pnv_pci_controller_ops.window_alignment = pnv_pci_window_alignment; + pnv_pci_controller_ops.reset_secondary_bus = pnv_pci_reset_secondary_bus; pci_add_flags(PCI_REASSIGN_ALL_RSRC); /* Reset IODA tables to a clean state */ diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c index 6ef6d4d..4729ca7 100644 --- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c +++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c @@ -133,6 +133,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id, phb-hose-first_busno = 0; phb-hose-last_busno = 0xff; phb-hose-private_data = phb; + phb-hose-controller_ops = pnv_pci_controller_ops; phb-hub_id = hub_id; phb-opal_id = phb_id; phb-type = PNV_PHB_P5IOC2; diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index c8939ad..63518b3 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c @@ -761,7 +761,6 @@ void __init pnv_pci_init(void) pci_devs_phb_init(); /* Configure IOMMU DMA hooks */ - ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup; ppc_md.tce_build = pnv_tce_build_vm; ppc_md.tce_free = pnv_tce_free_vm; ppc_md.tce_build_rm = pnv_tce_build_rm; @@ -777,3 +776,7 @@ void __init pnv_pci_init(void) } machine_subsys_initcall_sync(powernv, tce_iommu_bus_notifier_init); + +struct pci_controller_ops pnv_pci_controller_ops = { + .dma_dev_setup = pnv_pci_dma_dev_setup, +}; diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h index 604c48e..826d2c9 100644 --- a/arch/powerpc/platforms/powernv/powernv.h +++ b/arch/powerpc/platforms/powernv/powernv.h @@ -29,6 +29,8 @@ static inline u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev) } #endif +extern struct pci_controller_ops pnv_pci_controller_ops; + extern u32 pnv_get_supported_cpuidle_states(void); extern void pnv_lpc_init(void); -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 17/19] powerpc/cell: Move controller ops from ppc_md to controller_ops
This moves the Cell platform to use the pci_controller_ops structure rather than ppc_md for PCI controller operations. Signed-off-by: Daniel Axtens d...@axtens.net --- This depends on the patch to drop celleb support: http://patchwork.ozlabs.org/patch/451730/ --- arch/powerpc/platforms/cell/cell.h | 24 arch/powerpc/platforms/cell/iommu.c | 7 --- arch/powerpc/platforms/cell/setup.c | 5 + 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 arch/powerpc/platforms/cell/cell.h diff --git a/arch/powerpc/platforms/cell/cell.h b/arch/powerpc/platforms/cell/cell.h new file mode 100644 index 000..ef143df --- /dev/null +++ b/arch/powerpc/platforms/cell/cell.h @@ -0,0 +1,24 @@ +/* + * Cell Platform common data structures + * + * Copyright 2015, Daniel Axtens, IBM Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef CELL_H +#define CELL_H + +#include asm/pci-bridge.h + +extern struct pci_controller_ops cell_pci_controller_ops; + +#endif diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 31b1a67..4cb120f 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -39,6 +39,7 @@ #include asm/firmware.h #include asm/cell-regs.h +#include cell.h #include interrupt.h /* Define CELL_IOMMU_REAL_UNMAP to actually unmap non-used pages @@ -857,7 +858,7 @@ static int __init cell_iommu_init_disabled(void) cell_dma_direct_offset += base; if (cell_dma_direct_offset != 0) - ppc_md.pci_dma_dev_setup = cell_pci_dma_dev_setup; + cell_pci_controller_ops.dma_dev_setup = cell_pci_dma_dev_setup; printk(iommu: disabled, direct DMA offset is 0x%lx\n, cell_dma_direct_offset); @@ -1197,8 +1198,8 @@ static int __init cell_iommu_init(void) if (cell_iommu_init_disabled() == 0) goto bail; - /* Setup various ppc_md. callbacks */ - ppc_md.pci_dma_dev_setup = cell_pci_dma_dev_setup; + /* Setup various callbacks */ + cell_pci_controller_ops.dma_dev_setup = cell_pci_dma_dev_setup; ppc_md.dma_get_required_mask = cell_dma_get_required_mask; ppc_md.tce_build = tce_build_cell; ppc_md.tce_free = tce_free_cell; diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index d62aa98..d1be268 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c @@ -54,6 +54,7 @@ #include asm/cell-regs.h #include asm/io-workarounds.h +#include cell.h #include interrupt.h #include pervasive.h #include ras.h @@ -131,6 +132,8 @@ static int cell_setup_phb(struct pci_controller *phb) if (model == NULL || strcmp(np-name, pci)) return 0; + phb-controller_ops = cell_pci_controller_ops; + /* Setup workarounds for spider */ if (strcmp(model, Spider)) return 0; @@ -279,3 +282,5 @@ define_machine(cell) { .init_IRQ = cell_init_irq, .pci_setup_phb = cell_setup_phb, }; + +struct pci_controller_ops cell_pci_controller_ops; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 05/19] powerpc: Create pci_controller_ops.dma_bus_setup and shim
Add pci_controller_ops.dma_bus_setup, shadowing ppc_md.pci_dma_bus_setup. Add a shim, and changes the callsites to use the shim. Signed-off-by: Daniel Axtens d...@axtens.net --- v1 -- v2: - Better commit message - Use phb in favour of hose - Make shim name match ppc_md name, not pci_controller_ops name. --- arch/powerpc/include/asm/pci-bridge.h | 11 +++ arch/powerpc/kernel/pci-common.c | 3 +-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 347d49d..44305ac 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -19,6 +19,7 @@ struct device_node; */ struct pci_controller_ops { void(*dma_dev_setup)(struct pci_dev *dev); + void(*dma_bus_setup)(struct pci_bus *bus); }; /* @@ -279,5 +280,15 @@ static inline void pci_dma_dev_setup(struct pci_dev *dev) ppc_md.pci_dma_dev_setup(dev); } +static inline void pci_dma_bus_setup(struct pci_bus *bus) +{ + struct pci_controller *phb = pci_bus_to_host(bus); + + if (phb-controller_ops.dma_bus_setup) + phb-controller_ops.dma_bus_setup(bus); + else if (ppc_md.pci_dma_bus_setup) + ppc_md.pci_dma_bus_setup(bus); +} + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index bce6356..317ed00 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -953,8 +953,7 @@ void pcibios_setup_bus_self(struct pci_bus *bus) ppc_md.pcibios_fixup_bus(bus); /* Setup bus DMA mappings */ - if (ppc_md.pci_dma_bus_setup) - ppc_md.pci_dma_bus_setup(bus); + pci_dma_bus_setup(bus); } static void pcibios_setup_device(struct pci_dev *dev) -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 12/19] powerpc/pseries: Move controller ops from ppc_md to controller_ops
This moves the pSeries platform to use the pci_controller_ops structure, rather than ppc_md for PCI controller operations. Signed-off-by: Daniel Axtens d...@axtens.net --- arch/powerpc/platforms/pseries/iommu.c | 9 + arch/powerpc/platforms/pseries/pseries.h | 2 ++ arch/powerpc/platforms/pseries/setup.c | 6 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 7803a19..61d5a17 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -49,6 +49,7 @@ #include asm/mmzone.h #include asm/plpar_wrappers.h +#include pseries.h static void tce_invalidate_pSeries_sw(struct iommu_table *tbl, __be64 *startp, __be64 *endp) @@ -1307,16 +1308,16 @@ void iommu_init_early_pSeries(void) ppc_md.tce_free = tce_free_pSeriesLP; } ppc_md.tce_get = tce_get_pSeriesLP; - ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pSeriesLP; - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pSeriesLP; + pseries_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pSeriesLP; + pseries_pci_controller_ops.dma_dev_setup = pci_dma_dev_setup_pSeriesLP; ppc_md.dma_set_mask = dma_set_mask_pSeriesLP; ppc_md.dma_get_required_mask = dma_get_required_mask_pSeriesLP; } else { ppc_md.tce_build = tce_build_pSeries; ppc_md.tce_free = tce_free_pSeries; ppc_md.tce_get = tce_get_pseries; - ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pSeries; - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pSeries; + pseries_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pSeries; + pseries_pci_controller_ops.dma_dev_setup = pci_dma_dev_setup_pSeries; } diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h index 1796c54..cd64672 100644 --- a/arch/powerpc/platforms/pseries/pseries.h +++ b/arch/powerpc/platforms/pseries/pseries.h @@ -65,6 +65,8 @@ extern int dlpar_detach_node(struct device_node *); struct pci_host_bridge; int pseries_root_bridge_prepare(struct pci_host_bridge *bridge); +extern struct pci_controller_ops pseries_pci_controller_ops; + unsigned long pseries_memory_block_size(void); #endif /* _PSERIES_PSERIES_H */ diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 1a5f884..328e318 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -478,6 +478,7 @@ static void __init find_and_init_phbs(void) rtas_setup_phb(phb); pci_process_bridge_OF_ranges(phb, node, 0); isa_bridge_find_early(phb); + phb-controller_ops = pseries_pci_controller_ops; } of_node_put(root); @@ -840,6 +841,10 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus) void pSeries_final_fixup(void) { } #endif +struct pci_controller_ops pseries_pci_controller_ops = { + .probe_mode = pSeries_pci_probe_mode, +}; + define_machine(pseries) { .name = pSeries, .probe = pSeries_probe, @@ -848,7 +853,6 @@ define_machine(pseries) { .show_cpuinfo = pSeries_show_cpuinfo, .log_error = pSeries_log_error, .pcibios_fixup = pSeries_final_fixup, - .pci_probe_mode = pSeries_pci_probe_mode, .restart= rtas_restart, .halt = rtas_halt, .panic = rtas_os_term, -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev