Re: [PATCH] sed-opal: add support flag for SUM in status ioctl
From: Luca Boccassi <hidden>
Date: 2023-02-16 20:57:30
On Fri, 10 Feb 2023 at 01:06, [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Luca Boccassi <redacted> Not every OPAL drive supports SUM (Single User Mode), so report this information to userspace via the get-status ioctl so that we can adjust the formatting options accordingly. Tested on a kingston drive (which supports it) and a samsung one (which does not). Signed-off-by: Luca Boccassi <redacted> --- block/sed-opal.c | 2 ++ include/uapi/linux/sed-opal.h | 1 + 2 files changed, 3 insertions(+)diff --git a/block/sed-opal.c b/block/sed-opal.c index 463873f61e01..c320093c14f1 100644 --- a/block/sed-opal.c +++ b/block/sed-opal.c@@ -487,6 +487,8 @@ static int opal_discovery0_end(struct opal_dev *dev) break; case FC_SINGLEUSER: single_user = check_sum(body->features); + if (single_user) + dev->flags |= OPAL_FL_SUM_SUPPORTED; break; case FC_GEOMETRY: check_geometry(dev, body);diff --git a/include/uapi/linux/sed-opal.h b/include/uapi/linux/sed-opal.h index 1fed3c9294fc..d7a1524023db 100644 --- a/include/uapi/linux/sed-opal.h +++ b/include/uapi/linux/sed-opal.h@@ -144,6 +144,7 @@ struct opal_read_write_table { #define OPAL_FL_LOCKED 0x00000008 #define OPAL_FL_MBR_ENABLED 0x00000010 #define OPAL_FL_MBR_DONE 0x00000020 +#define OPAL_FL_SUM_SUPPORTED 0x00000040 struct opal_status { __u32 flags;
Hi, Any chance for a quick review, please? Would have loved to have this for the 6.3 merge window, it's a super simple change. Thanks! Kind regards, Luca Boccassi