linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: gjoyce@linux.vnet.ibm.com
Cc: linux-block@vger.kernel.org, keyrings@vger.kernel.org,
	dhowells@redhat.com, jarkko@kernel.org,
	jonathan.derrick@linux.dev, brking@linux.vnet.ibm.com,
	greg@gilhooley.com, gjoyce@ibm.com
Subject: Re: [PATCH 2/4] block: sed-opal: Implement IOC_OPAL_REVERT_LSP
Date: Wed, 20 Jul 2022 00:44:31 -0700	[thread overview]
Message-ID: <YteyX+pvMOBE/jiS@infradead.org> (raw)
In-Reply-To: <20220718210156.1535955-3-gjoyce@linux.vnet.ibm.com>

On Mon, Jul 18, 2022 at 04:01:54PM -0500, gjoyce@linux.vnet.ibm.com wrote:
> From: Greg Joyce <gjoyce@linux.vnet.ibm.com>
> 
> This is used in conjunction with IOC_OPAL_REVERT_TPR to return a drive to
> Original Factory State without erasing the data. If IOC_OPAL_REVERT_LSP
> is called with opal_revert_lsp.options bit OPAL_PRESERVE set prior
> to calling IOC_OPAL_REVERT_TPR, the drive global locking range will not
> be erased.
> 
> Signed-off-by: Greg Joyce <gjoyce@linux.vnet.ibm.com>
> ---
>  block/opal_proto.h            |  4 ++++
>  block/sed-opal.c              | 42 ++++++++++++++++++++++++++++++++++-
>  include/linux/sed-opal.h      |  1 +
>  include/uapi/linux/sed-opal.h |  9 ++++++++
>  4 files changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/block/opal_proto.h b/block/opal_proto.h
> index b486b3ec7dc4..6127c08267f8 100644
> --- a/block/opal_proto.h
> +++ b/block/opal_proto.h
> @@ -210,6 +210,10 @@ enum opal_parameter {
>  	OPAL_SUM_SET_LIST = 0x060000,
>  };
>  
> +enum opal_revertlsp {
> +	OPAL_KEEP_GLOBAL_RANGE_KEY = 0x060000,
> +};
> +
>  /* Packets derived from:
>   * TCG_Storage_Architecture_Core_Spec_v2.01_r1.00
>   * Secion: 3.2.3 ComPackets, Packets & Subpackets
> diff --git a/block/sed-opal.c b/block/sed-opal.c
> index 4b9a7ffbf00f..feba36e54ae0 100644
> --- a/block/sed-opal.c
> +++ b/block/sed-opal.c
> @@ -448,7 +448,7 @@ static int opal_discovery0_end(struct opal_dev *dev, void *data)
>  
>  	if (discv_out) {
>  		buf_out = (u8 __user *)(uintptr_t)discv_out->data;
> -		len_out = min(discv_out->size, (u64)hlen);
> +		len_out = min_t(u64, discv_out->size, hlen);

This seems like it should go into the previous patch (or just dropped).

> +
>  struct opal_lr_act {
>  	struct opal_key key;
>  	__u32 sum;
> @@ -137,6 +141,10 @@ struct opal_discovery {
>  	__u64 size;
>  };
>  
> +struct opal_revert_lsp {
> +	struct opal_key key;
> +	__u32 options;

this wants a __u32 __pad at the end to avoid struct padding problems.

  reply	other threads:[~2022-07-20  7:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 21:01 [PATCH 0/4] sed-opal: keyrings, discovery, revert and key store gjoyce
2022-07-18 21:01 ` [PATCH 1/4] block: sed-opal: Implement IOC_OPAL_DISCOVERY gjoyce
2022-07-20  7:42   ` Christoph Hellwig
2022-07-18 21:01 ` [PATCH 2/4] block: sed-opal: Implement IOC_OPAL_REVERT_LSP gjoyce
2022-07-20  7:44   ` Christoph Hellwig [this message]
2022-07-18 21:01 ` [PATCH 3/4] block: sed-opal: keyring support for SED Opal keys gjoyce
2022-07-19  6:49   ` Hannes Reinecke
2022-07-20  7:49   ` Christoph Hellwig
2022-07-18 21:01 ` [PATCH 4/4] arch_vars: create arch specific permanent store gjoyce
2022-07-20  7:50   ` Christoph Hellwig
2022-07-26 18:53     ` Greg Joyce
2022-07-28  7:43 ` [PATCH 0/4] sed-opal: keyrings, discovery, revert and key store Jarkko Sakkinen
  -- strict thread matches above, loose matches on Subject: below --
2022-07-06  2:39 gjoyce
2022-07-06  2:39 ` [PATCH 2/4] block: sed-opal: Implement IOC_OPAL_REVERT_LSP gjoyce

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=YteyX+pvMOBE/jiS@infradead.org \
    --to=hch@infradead.org \
    --cc=brking@linux.vnet.ibm.com \
    --cc=dhowells@redhat.com \
    --cc=gjoyce@ibm.com \
    --cc=gjoyce@linux.vnet.ibm.com \
    --cc=greg@gilhooley.com \
    --cc=jarkko@kernel.org \
    --cc=jonathan.derrick@linux.dev \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    /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).