Re: [PATCH v2 1/4] powerpc/powernv: Add OPAL API interface to access secure variable

From: Oliver O'Halloran
Date: Thu Aug 22 2019 - 09:44:00 EST


On Thu, Aug 22, 2019 at 3:02 PM Oliver O'Halloran <oohall@xxxxxxxxx> wrote:
>
> On Wed, 2019-08-21 at 11:08 -0400, Nayna Jain wrote:
> > diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> > index aba443be7daa..ffe6f1cf0830 100644
> > --- a/arch/powerpc/platforms/powernv/opal.c
> > +++ b/arch/powerpc/platforms/powernv/opal.c
> > @@ -32,6 +32,8 @@
> > #include <asm/mce.h>
> > #include <asm/imc-pmu.h>
> > #include <asm/bug.h>
> > +#include <asm/secvar.h>
> > +#include <asm/secboot.h>
> >
> > #include "powernv.h"
> >
> > @@ -988,6 +990,9 @@ static int __init opal_init(void)
> > /* Initialise OPAL Power control interface */
> > opal_power_control_init();
> >
> > + if (is_powerpc_secvar_supported())
> > + secvar_init();
> > +
>
> The usual pattern here is to have the init function check for support
> internally.
>
> Also, is_powerpc_secvar_supported() doesn't appear to be defined
> anywhere. Is that supposed to be is_opal_secvar_supported()? Or is this
> series supposed to be applied on top of another series?

To answer my own question, yes it depends on the series at [1] which
adds IMA support. Turns out actually reading the cover letter helps,
who knew.

That said, I'm still not entirely sure about this. The implementation
of is_powerpc_secvar_supported() in [2] parses the DT and seems to
assume the DT bindings that OPAL produces. Are those common with the
DT bindings produced by OF when running on pseries?

[1] http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=125961
[2] http://patchwork.ozlabs.org/patch/1149257/

>
> > return 0;
> > }
> > machine_subsys_initcall(powernv, opal_init);
>