Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/powernv: opal-kmsg use flush fallback from console code

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 is invoked to
prepare for moving the console flush into a common function.

Reviewed-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Nicholas Piggin and committed by
Michael Ellerman
e00da0f2 3a80bfc7

+6 -9
+6 -9
arch/powerpc/platforms/powernv/opal-kmsg.c
··· 51 51 } while (rc == OPAL_PARTIAL); /* More to flush */ 52 52 53 53 } else { 54 - int i; 54 + __be64 evt; 55 55 56 + WARN_ONCE(1, "opal: OPAL_CONSOLE_FLUSH missing.\n"); 56 57 /* 57 58 * If OPAL_CONSOLE_FLUSH is not implemented in the firmware, 58 59 * the console can still be flushed by calling the polling 59 - * function enough times to flush the buffer. We don't know 60 - * how much output still needs to be flushed, but we can be 61 - * generous since the kernel is in panic and doesn't need 62 - * to do much else. 60 + * function while it has OPAL_EVENT_CONSOLE_OUTPUT events. 63 61 */ 64 - printk(KERN_NOTICE "opal: OPAL_CONSOLE_FLUSH missing.\n"); 65 - for (i = 0; i < 1024; i++) { 66 - opal_poll_events(NULL); 67 - } 62 + do { 63 + opal_poll_events(&evt); 64 + } while (be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_OUTPUT); 68 65 } 69 66 } 70 67