History

sed-opal: geometry feature reporting command

Locking range start and locking range length attributes may be require to satisfy restrictions exposed by OPAL2 geometry feature reporting. Geometry reporting feature is described in TCG OPAL SSC, section 3.1.1.4 (ALIGN, LogicalBlockSize, AlignmentGranularity and LowestAlignedLBA). 4.3.5.2.1.1 RangeStart Behavior: [ StartAlignment = (RangeStart modulo AlignmentGranularity) - LowestAlignedLBA ] When processing a Set method or CreateRow method on the Locking table for a non-Global Range row, if: a) the AlignmentRequired (ALIGN above) column in the LockingInfo table is TRUE; b) RangeStart is non-zero; and c) StartAlignment is non-zero, then the method SHALL fail and return an error status code INVALID_PARAMETER. 4.3.5.2.1.2 RangeLength Behavior: If RangeStart is zero, then [ LengthAlignment = (RangeLength modulo AlignmentGranularity) - LowestAlignedLBA ] If RangeStart is non-zero, then [ LengthAlignment = (RangeLength modulo AlignmentGranularity) ] When processing a Set method or CreateRow method on the Locking table for a non-Global Range row, if: a) the AlignmentRequired (ALIGN above) column in the LockingInfo table is TRUE; b) RangeLength is non-zero; and c) LengthAlignment is non-zero, then the method SHALL fail and return an error status code INVALID_PARAMETER In userspace we stuck to logical block size reported by general block device (via sysfs or ioctl), but we can not read 'AlignmentGranularity' or 'LowestAlignedLBA' anywhere else and we need to get those values from sed-opal interface otherwise we will not be able to report or avoid locking range setup INVALID_PARAMETER errors above.

Ondrej Kozina committed 3 years ago

Commit 9e05a251 parent 63f87933 files · +42 −1Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/sed-opal.h+13−0
@@ -161,6 +161,18 @@ struct opal_status { · 160 unmodified lines
161161 __u32 reserved;
162162 };
163163
164+/*
165+ * Geometry Reporting per TCG Storage OPAL SSC
166+ * section 3.1.1.4
167+ */
168+struct opal_geometry {
169+ __u8 align;
170+ __u32 logical_block_size;
171+ __u64 alignment_granularity;
172+ __u64 lowest_aligned_lba;
173+ __u8 __align[3];
174+};
175+
164176 #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
165177 #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
166178 #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
@@ -179,5 +191,6 @@ struct opal_status { · 12 unmodified lines
179191 #define IOC_OPAL_GENERIC_TABLE_RW _IOW('p', 235, struct opal_read_write_table)
180192 #define IOC_OPAL_GET_STATUS _IOR('p', 236, struct opal_status)
181193 #define IOC_OPAL_GET_LR_STATUS _IOW('p', 237, struct opal_lr_status)
194+#define IOC_OPAL_GET_GEOMETRY _IOR('p', 238, struct opal_geometry)
182195
183196 #endif /* _UAPI_SED_OPAL_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t