History

block: Make blk-integrity preclude hardware inline encryption

Whenever a device supports blk-integrity, make the kernel pretend that the device doesn't support inline encryption (essentially by setting the keyslot manager in the request queue to NULL). There's no hardware currently that supports both integrity and inline encryption. However, it seems possible that there will be such hardware in the near future (like the NVMe key per I/O support that might support both inline encryption and PI). But properly integrating both features is not trivial, and without real hardware that implements both, it is difficult to tell if it will be done correctly by the majority of hardware that support both. So it seems best not to support both features together right now, and to decide what to do at probe time.

Satya Tangirala committed 6 years ago

Commit d145dc21 parent a892c8d4 files · +59 −0Browse files

Showing the changes to include/linux/blkdev.h (1 of 4 files). Show all

Unified · Split

include/linux/blkdev.h+30−0
@@ -1583,6 +1583,12 @@ struct blk_integrity *bdev_get_integrity(struct block_device *bdev) · 1582 unmodified lines
15831583 return blk_get_integrity(bdev->bd_disk);
15841584 }
15851585
1586+static inline bool
1587+blk_integrity_queue_supports_integrity(struct request_queue *q)
1588+{
1589+ return q->integrity.profile;
1590+}
1591+
15861592 static inline bool blk_integrity_rq(struct request *rq)
15871593 {
15881594 return rq->cmd_flags & REQ_INTEGRITY;
@@ -1663,6 +1669,11 @@ static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk) · 74 unmodified lines
16631669 {
16641670 return NULL;
16651671 }
1672+static inline bool
1673+blk_integrity_queue_supports_integrity(struct request_queue *q)
1674+{
1675+ return false;
1676+}
16661677 static inline int blk_integrity_compare(struct gendisk *a, struct gendisk *b)
16671678 {
16681679 return 0;
@@ -1714,6 +1725,25 @@ static inline struct bio_vec *rq_integrity_vec(struct request *rq) · 45 unmodified lines
17141725
17151726 #endif /* CONFIG_BLK_DEV_INTEGRITY */
17161727
1728+#ifdef CONFIG_BLK_INLINE_ENCRYPTION
1729+
1730+bool blk_ksm_register(struct blk_keyslot_manager *ksm, struct request_queue *q);
1731+
1732+void blk_ksm_unregister(struct request_queue *q);
1733+
1734+#else /* CONFIG_BLK_INLINE_ENCRYPTION */
1735+
1736+static inline bool blk_ksm_register(struct blk_keyslot_manager *ksm,
1737+ struct request_queue *q)
1738+{
1739+ return true;
1740+}
1741+
1742+static inline void blk_ksm_unregister(struct request_queue *q) { }
1743+
1744+#endif /* CONFIG_BLK_INLINE_ENCRYPTION */
1745+
1746+
17171747 struct block_device_operations {
17181748 int (*open) (struct block_device *, fmode_t);
17191749 void (*release) (struct gendisk *, fmode_t);