Skip to contentSkip to conversation

sed-opal: add support flag for SUM in status ioctl

PATCH Applied [email protected] 3 participants 5 messages Feb 10, 2023 – Feb 17, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sed-opal: add support flag for SUM in status ioctl

From: Luca Boccassi <[email protected]>

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).

---
 block/sed-opal.c              | 2 ++
 include/uapi/linux/sed-opal.h | 1 +
 2 files changed, 3 insertions(+)
block/sed-opal.c +2 -0
index 463873f61e01..c320093c14f1 100644
@@ -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);
include/uapi/linux/sed-opal.h +1 -0
index 1fed3c9294fc..d7a1524023db 100644
@@ -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;
Signature · 1 line
2.39.1
#1 lore raw
Quoted 33 lines · On Fri, 10 Feb 2023 at 01:06, <[email protected]> wrote:

From: Luca Boccassi <[email protected]>

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).

---
 block/sed-opal.c              | 2 ++
 include/uapi/linux/sed-opal.h | 1 +
 2 files changed, 3 insertions(+)
block/sed-opal.c +2 -0
index 463873f61e01..c320093c14f1 100644
@@ -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);
include/uapi/linux/sed-opal.h +0 -0
index 1fed3c9294fc..d7a1524023db 100644

include/uapi/linux/sed-opal.h struct opal_read_write_table { · line 150

Quoted 7 lines
include/uapi/linux/sed-opal.h +1 -0
@@ -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

#2 lore raw
Quoted 40 lines · Luca Boccassi
Quoted 38 lines · On Fri, 10 Feb 2023 at 01:06, <[email protected]> wrote:

From: Luca Boccassi <[email protected]>

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).

---
 block/sed-opal.c              | 2 ++
 include/uapi/linux/sed-opal.h | 1 +
 2 files changed, 3 insertions(+)
block/sed-opal.c +2 -0
index 463873f61e01..c320093c14f1 100644
@@ -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);
include/uapi/linux/sed-opal.h +1 -0
index 1fed3c9294fc..d7a1524023db 100644
@@ -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
 
Quoted 8 lines

include/uapi/linux/sed-opal.h struct opal_read_write_table { · line 150

Quoted 2 lines
include/uapi/linux/sed-opal.h +0 -0
 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!

CC'ed couple more reviewers as suggested by Christian

Kind regards,
Luca Boccassi

maintainer
#3 lore raw
In reply to [email protected]
Quoted 7 lines · On 2/9/23 6:06 PM, [email protected] wrote:

From: Luca Boccassi <[email protected]>

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).

Looks fine to me - Jonathan, are you still maintaining this code? We can still get this done for 6.3. I just sent out the first merge request, but there will be more down the line. I'll queue it up on top for now.

Signature · 1 line
Jens Axboe
maintainer Applied
#4 lore raw
In reply to [email protected]
Quoted 8 lines · On Fri, 10 Feb 2023 01:06:12 +0000, [email protected] wrote:

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).

[...]

Applied, thanks!

[1/1] sed-opal: add support flag for SUM in status ioctl

      commit: 0ac12f4afb4d0a6a2c4e42b350b6b9d71b88fa35

Best regards,

Signature · 1 line
Jens Axboe