[PATCH V2 1/2] powerpc/powernv: new function to access OPAL msglog

Joel Stanley joel at jms.id.au
Thu Feb 11 18:14:54 AEDT 2016


On Tue, Feb 9, 2016 at 5:47 PM, Andrew Donnellan
<andrew.donnellan at au1.ibm.com> wrote:
> Currently, the OPAL msglog/console buffer is exposed as a sysfs file, with
> the sysfs read handler responsible for retrieving the log from the OPAL
> buffer. We'd like to be able to use it in xmon as well.
>
> Refactor the OPAL msglog code to create a new function, opal_msglog_copy(),
> that copies to an arbitrary buffer. Separate the initialisation code into
> generic memcons init and sysfs file creation.
>
> Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

Looks like you didn't break it much. Congratulations on being the new
memcons maintainer!

There's one issue with your error handling.

> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index 4e0da5a..0256d07 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -724,6 +724,9 @@ static int __init opal_init(void)
>                 of_node_put(leds);
>         }
>
> +       /* Initialise OPAL message log interface */
> +       opal_msglog_init();

If this fails due to eg. the magic number being wrong.

> +
>         /* Create "opal" kobject under /sys/firmware */
>         rc = opal_sysfs_init();
>         if (rc == 0) {
> @@ -739,8 +742,8 @@ static int __init opal_init(void)
>                 opal_platform_dump_init();
>                 /* Setup system parameters interface */
>                 opal_sys_param_init();
> -               /* Setup message log interface. */
> -               opal_msglog_init();
> +               /* Setup message log sysfs interface. */
> +               opal_msglog_sysfs_init();

This will succeed, leaving you with a sysfs file attached to a broken driver.

>         }
>
>         /* Initialize platform devices: IPMI backend, PRD & flash interface */


More information about the Linuxppc-dev mailing list