linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Donnellan <ajd@linux.ibm.com>
To: Russell Currey <ruscur@russell.cc>, linuxppc-dev@lists.ozlabs.org
Cc: gregkh@linuxfoundation.org, nayna@linux.ibm.com,
	linux-kernel@vger.kernel.org, zohar@linux.ibm.com,
	gcwilson@linux.ibm.com
Subject: Re: [PATCH v2 5/7] powerpc/secvar: Handle max object size in the consumer
Date: Wed, 04 Jan 2023 18:50:05 +1100	[thread overview]
Message-ID: <01993c7ec9d4d97906dc54c165c32b6d8a30f1ec.camel@linux.ibm.com> (raw)
In-Reply-To: <20221230042014.154483-6-ruscur@russell.cc>

On Fri, 2022-12-30 at 15:20 +1100, Russell Currey wrote:
> Currently the max object size is handled in the core secvar code with
> an
> entirely OPAL-specific implementation, so create a new max_size() op
> and
> move the existing implementation into the powernv platform.  Should
> be
> no functional change.
> 
> Signed-off-by: Russell Currey <ruscur@russell.cc>

LGTM

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

> ---
>  arch/powerpc/include/asm/secvar.h            |  1 +
>  arch/powerpc/kernel/secvar-sysfs.c           | 17 +++--------------
>  arch/powerpc/platforms/powernv/opal-secvar.c | 19
> +++++++++++++++++++
>  3 files changed, 23 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/secvar.h
> b/arch/powerpc/include/asm/secvar.h
> index 3b7e5a3625bd..92d2c051918b 100644
> --- a/arch/powerpc/include/asm/secvar.h
> +++ b/arch/powerpc/include/asm/secvar.h
> @@ -21,6 +21,7 @@ struct secvar_operations {
>         int (*set)(const char *key, uint64_t key_len, u8 *data,
>                    uint64_t data_size);
>         ssize_t (*format)(char *buf);
> +       int (*max_size)(uint64_t *max_size);
>  };
>  
>  #ifdef CONFIG_PPC_SECURE_BOOT
> diff --git a/arch/powerpc/kernel/secvar-sysfs.c
> b/arch/powerpc/kernel/secvar-sysfs.c
> index 190238f51335..aa1daec480e1 100644
> --- a/arch/powerpc/kernel/secvar-sysfs.c
> +++ b/arch/powerpc/kernel/secvar-sysfs.c
> @@ -122,27 +122,16 @@ static struct kobj_type secvar_ktype = {
>  static int update_kobj_size(void)
>  {
>  
> -       struct device_node *node;
>         u64 varsize;
> -       int rc = 0;
> +       int rc = secvar_ops->max_size(&varsize);
>  
> -       node = of_find_compatible_node(NULL, NULL, "ibm,secvar-
> backend");
> -       if (!of_device_is_available(node)) {
> -               rc = -ENODEV;
> -               goto out;
> -       }
> -
> -       rc = of_property_read_u64(node, "max-var-size", &varsize);
>         if (rc)
> -               goto out;
> +               return rc;
>  
>         data_attr.size = varsize;
>         update_attr.size = varsize;
>  
> -out:
> -       of_node_put(node);
> -
> -       return rc;
> +       return 0;
>  }
>  
>  static int secvar_sysfs_load(void)
> diff --git a/arch/powerpc/platforms/powernv/opal-secvar.c
> b/arch/powerpc/platforms/powernv/opal-secvar.c
> index 5e9de06b2533..07260460e966 100644
> --- a/arch/powerpc/platforms/powernv/opal-secvar.c
> +++ b/arch/powerpc/platforms/powernv/opal-secvar.c
> @@ -125,11 +125,30 @@ static ssize_t opal_secvar_format(char *buf)
>         return rc;
>  }
>  
> +static int opal_secvar_max_size(uint64_t *max_size)
> +{
> +       int rc;
> +       struct device_node *node;
> +
> +       node = of_find_compatible_node(NULL, NULL, "ibm,secvar-
> backend");
> +       if (!of_device_is_available(node)) {
> +               rc = -ENODEV;
> +               goto out;
> +       }
> +
> +       rc = of_property_read_u64(node, "max-var-size", max_size);
> +
> +out:
> +       of_node_put(node);
> +       return rc;
> +}
> +
>  static const struct secvar_operations opal_secvar_ops = {
>         .get = opal_get_variable,
>         .get_next = opal_get_next_variable,
>         .set = opal_set_variable,
>         .format = opal_secvar_format,
> +       .max_size = opal_secvar_max_size,
>  };
>  
>  static int opal_secvar_probe(struct platform_device *pdev)

-- 
Andrew Donnellan    OzLabs, ADL Canberra
ajd@linux.ibm.com   IBM Australia Limited

  reply	other threads:[~2023-01-04  7:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30  4:20 [PATCH v2 0/7] pseries dynamic secure boot interface using secvar Russell Currey
2022-12-30  4:20 ` [PATCH v2 1/7] powerpc/pseries: Log hcall return codes for PLPKS debug Russell Currey
2023-01-04  4:45   ` Andrew Donnellan
2022-12-30  4:20 ` [PATCH v2 2/7] powerpc/secvar: WARN_ON_ONCE() if multiple secvar ops are set Russell Currey
2023-01-04  7:10   ` Andrew Donnellan
2022-12-30  4:20 ` [PATCH v2 3/7] powerpc/secvar: Use sysfs_emit() instead of sprintf() Russell Currey
2023-01-04  7:12   ` Andrew Donnellan
2022-12-30  4:20 ` [PATCH v2 4/7] powerpc/secvar: Handle format string in the consumer Russell Currey
2023-01-04  7:31   ` Andrew Donnellan
2022-12-30  4:20 ` [PATCH v2 5/7] powerpc/secvar: Handle max object size " Russell Currey
2023-01-04  7:50   ` Andrew Donnellan [this message]
2022-12-30  4:20 ` [PATCH v2 6/7] powerpc/secvar: Extend sysfs to include config vars Russell Currey
2023-01-05  7:28   ` Andrew Donnellan
2023-01-06  6:33     ` Russell Currey
2023-01-06  4:15   ` Michael Ellerman
2023-01-06  6:35     ` Russell Currey
2022-12-30  4:20 ` [PATCH v2 7/7] powerpc/pseries: Implement secvars for dynamic secure boot Russell Currey
2023-01-05  8:15   ` Andrew Donnellan
2023-01-06  6:49     ` Russell Currey
2023-01-09  4:42       ` Andrew Donnellan
2023-01-06 10:49   ` Michael Ellerman
2023-01-09  3:33     ` Andrew Donnellan
2023-01-09  3:34     ` Russell Currey
2023-01-09  5:20       ` Andrew Donnellan
2023-01-10  1:27         ` Russell Currey
2023-01-10  3:59     ` Andrew Donnellan
2023-01-11  3:57     ` Andrew Donnellan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01993c7ec9d4d97906dc54c165c32b6d8a30f1ec.camel@linux.ibm.com \
    --to=ajd@linux.ibm.com \
    --cc=gcwilson@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nayna@linux.ibm.com \
    --cc=ruscur@russell.cc \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).