From: "Derrick, Jonathan" <jonathan.derrick@intel.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"zub@linux.fjfi.cvut.cz" <zub@linux.fjfi.cvut.cz>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"sbauer@plzdonthack.me" <sbauer@plzdonthack.me>,
"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "jonas.rabenstein@studium.uni-erlangen.de"
<jonas.rabenstein@studium.uni-erlangen.de>
Subject: Re: [PATCH 1/3] block: sed-opal: add ioctl for done-mark of shadow mbr
Date: Mon, 6 May 2019 20:02:36 +0000 [thread overview]
Message-ID: <e032c71d0b3a49211cb5989fc5255dbcf70fdfae.camel@intel.com> (raw)
In-Reply-To: <1556666459-17948-2-git-send-email-zub@linux.fjfi.cvut.cz>
[-- Attachment #1: Type: text/plain, Size: 4204 bytes --]
LGTM
Reviewed-by: Jon Derrick <jonathan.derrick@intel.com>
On Wed, 2019-05-01 at 01:20 +0200, David Kozub wrote:
> From: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
>
> Enable users to mark the shadow mbr as done without completely
> deactivating the shadow mbr feature. This may be useful on reboots,
> when the power to the disk is not disconnected in between and the
> shadow
> mbr stores the required boot files. Of course, this saves also the
> (few) commands required to enable the feature if it is already
> enabled
> and one only wants to mark the shadow mbr as done.
>
> Co-authored-by: David Kozub <zub@linux.fjfi.cvut.cz>
> Signed-off-by: Jonas Rabenstein <
> jonas.rabenstein@studium.uni-erlangen.de>
> Signed-off-by: David Kozub <zub@linux.fjfi.cvut.cz>
> ---
> block/sed-opal.c | 27 +++++++++++++++++++++++++++
> include/linux/sed-opal.h | 1 +
> include/uapi/linux/sed-opal.h | 12 ++++++++++++
> 3 files changed, 40 insertions(+)
>
> diff --git a/block/sed-opal.c b/block/sed-opal.c
> index b1aa0cc25803..f1eb9c18e335 100644
> --- a/block/sed-opal.c
> +++ b/block/sed-opal.c
> @@ -1986,6 +1986,30 @@ static int
> opal_enable_disable_shadow_mbr(struct opal_dev *dev,
> return ret;
> }
>
> +static int opal_set_mbr_done(struct opal_dev *dev,
> + struct opal_mbr_done *mbr_done)
> +{
> + u8 mbr_done_tf = mbr_done->done_flag == OPAL_MBR_DONE ?
> + OPAL_TRUE : OPAL_FALSE;
> +
> + const struct opal_step mbr_steps[] = {
> + { start_admin1LSP_opal_session, &mbr_done->key },
> + { set_mbr_done, &mbr_done_tf },
> + { end_opal_session, }
> + };
> + int ret;
> +
> + if (mbr_done->done_flag != OPAL_MBR_DONE &&
> + mbr_done->done_flag != OPAL_MBR_NOT_DONE)
> + return -EINVAL;
> +
> + mutex_lock(&dev->dev_lock);
> + setup_opal_dev(dev);
> + ret = execute_steps(dev, mbr_steps, ARRAY_SIZE(mbr_steps));
> + mutex_unlock(&dev->dev_lock);
> + return ret;
> +}
> +
> static int opal_save(struct opal_dev *dev, struct opal_lock_unlock
> *lk_unlk)
> {
> struct opal_suspend_data *suspend;
> @@ -2299,6 +2323,9 @@ int sed_ioctl(struct opal_dev *dev, unsigned
> int cmd, void __user *arg)
> case IOC_OPAL_ENABLE_DISABLE_MBR:
> ret = opal_enable_disable_shadow_mbr(dev, p);
> break;
> + case IOC_OPAL_MBR_DONE:
> + ret = opal_set_mbr_done(dev, p);
> + break;
> case IOC_OPAL_ERASE_LR:
> ret = opal_erase_locking_range(dev, p);
> break;
> diff --git a/include/linux/sed-opal.h b/include/linux/sed-opal.h
> index 04b124fca51e..42b2ce5da7b3 100644
> --- a/include/linux/sed-opal.h
> +++ b/include/linux/sed-opal.h
> @@ -47,6 +47,7 @@ static inline bool is_sed_ioctl(unsigned int cmd)
> case IOC_OPAL_ENABLE_DISABLE_MBR:
> case IOC_OPAL_ERASE_LR:
> case IOC_OPAL_SECURE_ERASE_LR:
> + case IOC_OPAL_MBR_DONE:
> return true;
> }
> return false;
> diff --git a/include/uapi/linux/sed-opal.h b/include/uapi/linux/sed-
> opal.h
> index e092e124dd16..81dd0e8886a1 100644
> --- a/include/uapi/linux/sed-opal.h
> +++ b/include/uapi/linux/sed-opal.h
> @@ -29,6 +29,11 @@ enum opal_mbr {
> OPAL_MBR_DISABLE = 0x01,
> };
>
> +enum opal_mbr_done_flag {
> + OPAL_MBR_NOT_DONE = 0x0,
> + OPAL_MBR_DONE = 0x01
> +};
> +
> enum opal_user {
> OPAL_ADMIN1 = 0x0,
> OPAL_USER1 = 0x01,
> @@ -104,6 +109,12 @@ struct opal_mbr_data {
> __u8 __align[7];
> };
>
> +struct opal_mbr_done {
> + struct opal_key key;
> + __u8 done_flag;
> + __u8 __align[7];
> +};
> +
> #define IOC_OPAL_SAVE _IOW('p', 220, struct
> opal_lock_unlock)
> #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct
> opal_lock_unlock)
> #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct
> opal_key)
> @@ -116,5 +127,6 @@ struct opal_mbr_data {
> #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct
> opal_mbr_data)
> #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct
> opal_session_info)
> #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct
> opal_session_info)
> +#define IOC_OPAL_MBR_DONE _IOW('p', 232, struct
> opal_mbr_done)
>
> #endif /* _UAPI_SED_OPAL_H */
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3278 bytes --]
next prev parent reply other threads:[~2019-05-06 20:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 23:20 [PATCH 0/3] block: sed-opal: add support for shadow MBR done flag and write David Kozub
2019-04-30 23:20 ` [PATCH 1/3] block: sed-opal: add ioctl for done-mark of shadow mbr David Kozub
2019-05-01 10:36 ` David Kozub
2019-05-01 13:46 ` Christoph Hellwig
2019-05-05 14:16 ` Scott Bauer
2019-05-06 20:02 ` Derrick, Jonathan [this message]
2019-04-30 23:20 ` [PATCH 2/3] block: sed-opal: ioctl for writing to " David Kozub
2019-05-01 13:48 ` Christoph Hellwig
2019-05-05 14:22 ` Scott Bauer
2019-04-30 23:20 ` [PATCH 3/3] block: sed-opal: check size of " David Kozub
2019-05-05 14:27 ` Scott Bauer
2019-05-06 20:15 ` Derrick, Jonathan
2019-05-01 13:49 ` [PATCH 0/3] block: sed-opal: add support for shadow MBR done flag and write Christoph Hellwig
2019-05-03 20:32 ` David Kozub
2019-05-05 14:43 ` Scott Bauer
2019-05-09 19:31 ` Derrick, Jonathan
2019-05-13 22:12 ` David Kozub
2019-05-02 12:30 ` Scott Bauer
2019-05-02 16:03 ` David Kozub
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=e032c71d0b3a49211cb5989fc5255dbcf70fdfae.camel@intel.com \
--to=jonathan.derrick@intel.com \
--cc=axboe@kernel.dk \
--cc=jonas.rabenstein@studium.uni-erlangen.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sbauer@plzdonthack.me \
--cc=zub@linux.fjfi.cvut.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.