Re: [PATCH 5/6] powerpc/powernv: implement opal_put_chars_nonatomic

2018-04-08 Thread Nicholas Piggin
On Mon, 09 Apr 2018 15:57:55 +1000 Benjamin Herrenschmidt wrote: > On Mon, 2018-04-09 at 15:40 +1000, Nicholas Piggin wrote: > > The RAW console does not need writes to be atomic, so implement a > > _nonatomic variant which does not take a spinlock. This API is used > > in xmon, so the less locki

Re: [PATCH v2 4/9] powerpc/powernv: OPAL console standardise OPAL_BUSY loops

2018-04-08 Thread Nicholas Piggin
On Mon, 09 Apr 2018 15:53:33 +1000 Benjamin Herrenschmidt wrote: > On Mon, 2018-04-09 at 15:24 +1000, Nicholas Piggin wrote: > > Convert to using the standard delay poll/delay form. > > > > The console code: > > > > - Did not previously delay or sleep in its busy loop. > > > > Cc: Benjamin Her

Re: [PATCH 6/6] drivers/tty/hvc: remove unexplained "just in case" spin delay

2018-04-08 Thread Benjamin Herrenschmidt
On Mon, 2018-04-09 at 15:40 +1000, Nicholas Piggin wrote: > This delay was in the very first OPAL console commit 6.5 years ago. > The firmware console has hardened sufficiently to remove it. > Reviewed-by: Benjamin Herrenschmidt > Signed-off-by: Nicholas Piggin > --- > drivers/tty/hvc/hvc_opal

Re: [PATCH 5/6] powerpc/powernv: implement opal_put_chars_nonatomic

2018-04-08 Thread Benjamin Herrenschmidt
On Mon, 2018-04-09 at 15:40 +1000, Nicholas Piggin wrote: > The RAW console does not need writes to be atomic, so implement a > _nonatomic variant which does not take a spinlock. This API is used > in xmon, so the less locking thta's used, the better chance there is > that a crash can be debugged.

Re: [PATCH v2 4/9] powerpc/powernv: OPAL console standardise OPAL_BUSY loops

2018-04-08 Thread Benjamin Herrenschmidt
On Mon, 2018-04-09 at 15:24 +1000, Nicholas Piggin wrote: > Convert to using the standard delay poll/delay form. > > The console code: > > - Did not previously delay or sleep in its busy loop. > > Cc: Benjamin Herrenschmidt > Signed-off-by: Nicholas Piggin Does it help with anything ? We don'

Re: [PATCH v2 3/9] powerpc/powernv: opal_put_chars partial write fix

2018-04-08 Thread Benjamin Herrenschmidt
On Mon, 2018-04-09 at 15:24 +1000, Nicholas Piggin wrote: > The intention here is to consume and discard the remaining buffer > upon error. This works if there has not been a previous partial write. > If there has been, then total_len is no longer total number of bytes > to copy. total_len is alway

[PATCH 6/6] drivers/tty/hvc: remove unexplained "just in case" spin delay

2018-04-08 Thread Nicholas Piggin
This delay was in the very first OPAL console commit 6.5 years ago. The firmware console has hardened sufficiently to remove it. Cc: Benjamin Herrenschmidt Signed-off-by: Nicholas Piggin --- drivers/tty/hvc/hvc_opal.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/dr

[PATCH 5/6] powerpc/powernv: implement opal_put_chars_nonatomic

2018-04-08 Thread Nicholas Piggin
The RAW console does not need writes to be atomic, so implement a _nonatomic variant which does not take a spinlock. This API is used in xmon, so the less locking thta's used, the better chance there is that a crash can be debugged. Cc: Benjamin Herrenschmidt Signed-off-by: Nicholas Piggin ---

[PATCH 4/6] powerpc/powernv: move opal console flushing to udbg

2018-04-08 Thread Nicholas Piggin
OPAL console writes do not have to synchronously flush firmware / hardware buffers unless they are going through the udbg path. Remove the unconditional flushing from opal_put_chars. Flush if there was no space in the buffer as an optimisation (callers loop waiting for success in that case). udbg

[PATCH 3/6] powerpc/powernv: Remove OPALv1 support from opal console driver

2018-04-08 Thread Nicholas Piggin
opal_put_chars deals with partial writes because in OPALv1, opal_console_write_buffer_space did not work correctly. That firmware is not supported. This reworks the opal_put_chars code to no longer deal with partial writes and turn them into full writes. Partial write handling is still supported i

[PATCH 2/6] powerpc/powernv: Implement and use opal_flush_console

2018-04-08 Thread Nicholas Piggin
A new console flushing firmware API was introduced to replace event polling loops, and implemented in opal-kmsg with affddff69c55e ("powerpc/powernv: Add a kmsg_dumper that flushes console output on panic"), to flush the console in the panic path. The OPAL console driver has other situations where

[PATCH 1/6] powerpc/powernv: opal-kmsg use flush fallback from console code

2018-04-08 Thread Nicholas Piggin
Use the more refined and tested event polling loop from opal_put_chars as the fallback console flush in the opal-kmsg path. This loop is used by the console driver today, whereas the opal-kmsg fallback is not likely to have been used for years. Use WARN_ONCE rather than a printk when the fallback

[PATCH 0/6] improve OPAL cosole flushing and locking

2018-04-08 Thread Nicholas Piggin
This series of patches aims to improve the robustness of the OPAL console by simplifying and removing locks. If this code is interrupted due to a panic or xmon request, it may block the xmon IO or panic console flush because they use the opal console too. So reducing locking and relaxing atomicity

[PATCH v2 9/9] powerpc/powernv: opal-kmsg standardise OPAL_BUSY handling

2018-04-08 Thread Nicholas Piggin
OPAL_CONSOLE_FLUSH is documented as being able to return OPAL_BUSY, so implement the standard OPAL_BUSY handling for it. Cc: Russell Currey Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powernv/opal-kmsg.c | 24 ++ 1 file changed, 16 insertions(+), 8 deletions(-)

[PATCH v2 8/9] powerpc/xive: standardise OPAL_BUSY delays

2018-04-08 Thread Nicholas Piggin
Convert to using the standard delay poll/delay form. The XIVE driver: - Did not previously loop on the OPAL_BUSY_EVENT case. - Used a 1ms sleep. Cc: Benjamin Herrenschmidt Signed-off-by: Nicholas Piggin --- arch/powerpc/sysdev/xive/native.c | 193 +- 1 file changed

[PATCH v2 7/9] powerpc/powernv: OPAL dump support standardise OPAL_BUSY delays

2018-04-08 Thread Nicholas Piggin
Convert to using the standard delay poll/delay form. The dump code: - Did not previously delay or sleep in the OPAL_BUSY case. - Used a 20ms sleep. Cc: Vasant Hegde Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powernv/opal-dump.c | 6 -- 1 file changed, 4 insertions(+), 2 del

[PATCH v2 6/9] powerpc/powernv: OPAL NVRAM driver standardise OPAL_BUSY delays

2018-04-08 Thread Nicholas Piggin
Convert to using the standard delay poll/delay form. The NVRAM driver: - Did not previously delay or sleep in its busy loop. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powernv/opal-nvram.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/pla

[PATCH v2 5/9] powerpc/powernv: OPAL platform standardise OPAL_BUSY loops

2018-04-08 Thread Nicholas Piggin
Convert to using the standard delay poll/delay form. The platform code: - Used delay when called from a schedule()able context. - Did not previously delay or sleep in the OPAL_BUSY_EVENT case. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powernv/opal.c | 8 +--- arch/powerpc

[PATCH v2 4/9] powerpc/powernv: OPAL console standardise OPAL_BUSY loops

2018-04-08 Thread Nicholas Piggin
Convert to using the standard delay poll/delay form. The console code: - Did not previously delay or sleep in its busy loop. Cc: Benjamin Herrenschmidt Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powernv/opal.c | 38 --- 1 file changed, 23 insertions(+),

[PATCH v2 3/9] powerpc/powernv: opal_put_chars partial write fix

2018-04-08 Thread Nicholas Piggin
The intention here is to consume and discard the remaining buffer upon error. This works if there has not been a previous partial write. If there has been, then total_len is no longer total number of bytes to copy. total_len is always "bytes left to copy", so it should be added to written bytes. T

[PATCH v2 2/9] powerpc/powernv: OPAL RTC driver standardise OPAL_BUSY loops

2018-04-08 Thread Nicholas Piggin
Convert to using the standard delay poll/delay form. The OPAL RTC driver: - Did not previously delay or sleep in the OPAL_BUSY_EVENT case. There have been scheduling delays of up to 50 seconds observed here (BMC reboot can do it), which this should fix. Cc: linux-...@vger.kernel.org Signed-o

[PATCH v2 1/9] powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops

2018-04-08 Thread Nicholas Piggin
This is the start of an effort to tidy up and standardise all the delays. Existing loops have a range of delay/sleep periods from 1ms to 20ms, and some have no delay. They all loop forever except rtc, which times out after 10 retries, and that uses 10ms delays. So use 10ms as our standard delay. Th

[PATCH v2 0/9] first step of standardising OPAL_BUSY handling

2018-04-08 Thread Nicholas Piggin
Since v1: - Added console and opal-kmsg - Fix a missing case in opal_shutdown that would delay even if OPAL_SUCCESS was returned. Thanks, Nick Nicholas Piggin (9): powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops powerpc/powernv: OPAL RTC driver standardise OPAL_B

Re: [alsa-devel] [PATCH] ASoC: fsl_esai: Fix divisor calculation failure at lower ratio

2018-04-08 Thread Fabio Estevam
Hi Nicolin, On Sun, Apr 8, 2018 at 8:57 PM, Nicolin Chen wrote: > When the desired ratio is less than 256, the savesub (tolerance) > in the calculation would become 0. This will then fail the loop- > search immediately without reporting any errors. > > But if the ratio is smaller enough, there is

Re: [alsa-devel] [PATCH] ASoC: fsl_esai: Add freq check in set_dai_sysclk()

2018-04-08 Thread Fabio Estevam
On Sun, Apr 8, 2018 at 9:33 PM, Nicolin Chen wrote: > The freq parameter indicates the physical frequency of an actual > input clock or a desired frequency of an output clock for HCKT/R. > It should never be passed 0. This might cause Division-by-zero. > > So this patch adds a check to fix it. > >

[PATCH] ASoC: fsl_esai: Add freq check in set_dai_sysclk()

2018-04-08 Thread Nicolin Chen
The freq parameter indicates the physical frequency of an actual input clock or a desired frequency of an output clock for HCKT/R. It should never be passed 0. This might cause Division-by-zero. So this patch adds a check to fix it. Signed-off-by: Nicolin Chen --- sound/soc/fsl/fsl_esai.c | 6 +

[PATCH] ASoC: fsl_esai: Fix divisor calculation failure at lower ratio

2018-04-08 Thread Nicolin Chen
When the desired ratio is less than 256, the savesub (tolerance) in the calculation would become 0. This will then fail the loop- search immediately without reporting any errors. But if the ratio is smaller enough, there is no need to calculate the tolerance because PM divisor alone is enough to g

Re: [PATCH] powerpc/mm/radix: add missing braces for single statement block

2018-04-08 Thread Randy Dunlap
On 04/08/2018 12:44 PM, Mathieu Malaterre wrote: > In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for > disable_radix") an `if` statement was added for a possible empty body > (prom_debug). > > Fix the following warning, treated as error with W=1: > > arch/powerpc/kernel

[PATCH v2] powerpc/32: Make some functions static

2018-04-08 Thread Mathieu Malaterre
In commit 4aea909eeba3 ("powerpc: Add missing prototypes in setup_32.c") prototypes for - ppc_setup_l2cr - ppc_setup_l3cr - ppc_init were added but at the same time in commit d15a261d876d ("powerpc/32: Make some functions static") those same functions were made static. Fix conflicting changes by

[PATCH] powerpc/mm/radix: add missing braces for single statement block

2018-04-08 Thread Mathieu Malaterre
In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for disable_radix") an `if` statement was added for a possible empty body (prom_debug). Fix the following warning, treated as error with W=1: arch/powerpc/kernel/prom_init.c:656:46: error: suggest braces around empty body i

[PATCH] powerpc/32: Make some functions static

2018-04-08 Thread Mathieu Malaterre
In commit 4aea909eeba3 ("powerpc: Add missing prototypes in setup_32.c") prototypes for - ppc_setup_l2cr - ppc_setup_l3cr - ppc_init were added but at the same time in commit d15a261d876d ("powerpc/32: Make some functions static") those same functions were made static. Fix conflicting changes by

Re: [PATCH 1/2] KVM: PPC: Book3S HV: trace_tlbie must not be called in realmode

2018-04-08 Thread Nicholas Piggin
On Sun, 8 Apr 2018 20:17:47 +1000 Balbir Singh wrote: > On Fri, Apr 6, 2018 at 3:56 AM, Nicholas Piggin wrote: > > This crashes with a "Bad real address for load" attempting to load > > from the vmalloc region in realmode (faulting address is in DAR). > > > > Oops: Bad interrupt in KVM entry/e

Re: [PATCH 1/2] KVM: PPC: Book3S HV: trace_tlbie must not be called in realmode

2018-04-08 Thread Balbir Singh
On Fri, Apr 6, 2018 at 3:56 AM, Nicholas Piggin wrote: > This crashes with a "Bad real address for load" attempting to load > from the vmalloc region in realmode (faulting address is in DAR). > > Oops: Bad interrupt in KVM entry/exit code, sig: 6 [#1] > LE SMP NR_CPUS=2048 NUMA PowerNV > CPU