Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
* [PATCH v6 0/4] Add inline encryption support
@ 2026-10-27  9:09 Linlin Zhang
  2026-10-27  9:09 ` [PATCH v6 1/4] virtio-blk: Add inline encryption feature bit and configuration Linlin Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Linlin Zhang @ 2026-10-27  9:09 UTC (permalink / raw)
  To: virtio-dev, virtio-comment, stefanha, mst, mgurtovoy, parav,
	ebiggers
  Cc: neeraj.soni

This series adds inline encryption support to virtio-blk, for devices
backed by storage with an inline crypto engine, such as UFS or eMMC.

The device reports its capabilities in the configuration space: the
number of keyslots, the maximum Data Unit Number (DUN) size and the
supported key types (raw and hardware-wrapped). Keys are managed, and
the supported crypto modes are discovered, with group administration
commands of the Self group type, so the feature depends on
VIRTIO_F_ADMIN_VQ. Encrypted reads and writes are still submitted on
the request virtqueues; each of them identifies a programmed keyslot
and carries a 256-bit DUN.

Patch summary:
1. Add the feature bit and the configuration fields
2. Add the administration commands to manage the keys and to query the
   supported crypto modes
3. Add the encrypted request types
4. Describe what inline encryption does and does not protect against,
   in particular for confidential guests

This series is independent of, but is intended to be used together
with, the series adding administration virtqueue support to the MMIO
transport:
https://lore.kernel.org/all/20261017114556.1701355-1-parav@nvidia.com/

For background on inline encryption, see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/block/inline-encryption.rst

The new administration command opcodes are allocated from 0x0013, not
from 0x0012: the group administration commands table in the current
specification lists 0x0013 - 0x7FFF as the range of commands using
struct virtio_admin_cmd, so the new commands start at the first opcode
of that range.

changes in v6:
 - Remove the dedicated control virtqueue and VIRTIO_BLK_F_CTRL_VQ; use
   group administration commands of the Self group type on the
   administration virtqueue instead, with opcodes 0x0013 - 0x0019
 - Change feature bit VIRTIO_BLK_F_INLINE_ENCRYPTION to 20
 - Require VIRTIO_F_ADMIN_VQ to be offered with
   VIRTIO_BLK_F_INLINE_ENCRYPTION
 - Never offer VIRTIO_BLK_F_INLINE_ENCRYPTION together with
   VIRTIO_BLK_F_ZONED, as the zoned write constraints do not guarantee
   that I/O addresses are aligned to the encryption data unit size
 - Widen max_slots to 32 bits, matching the 32-bit slot fields
 - Only report the commands in VIRTIO_ADMIN_CMD_LIST_QUERY if the
   device offers VIRTIO_BLK_F_INLINE_ENCRYPTION, and the
   hardware-wrapped key commands only if the device supports
   hardware-wrapped keys; fail VIRTIO_ADMIN_CMD_LIST_USE enabling them
   if the feature has not been negotiated
 - Define the long-term and ephemerally-wrapped forms of
   hardware-wrapped keys, and which form each command takes and returns
 - Do not program or evict a keyslot while requests using it are
   outstanding
 - Change struct virtio_blk_crypto_key_desc and struct
   virtio_blk_crypto_key_blob to use variable-length arrays; the key
   length is given by key_size, and buffer lengths follow the generic
   administration command rules, except that a command fails if a key
   would be truncated. Remove VIRTIO_BLK_CRYPTO_MAX_KEY_SIZE
 - Empty all keyslots on device reset, and fail requests using an empty
   keyslot with VIRTIO_BLK_S_IOERR
 - Report a failed GENERATE_KEY with any status other than
   VIRTIO_ADMIN_STATUS_OK; require a successful DERIVE_SW_SECRET to
   return the whole software secret; KEYSLOT_EVICT ignores all fields
   other than slot
 - Add a 'Security Considerations' subsection
 - Split the series into four patches

changes in v5:
 - Change feature bit value of VIRTIO_BLK_F_CTRL_VQ and
   VIRTIO_BLK_F_INLINE_ENCRYPTION to 20 and 21 respectively

changes in v4:
 - Add a control virtqueue specific subsection for virtio block
 - Move all control virtqueue request related to this new subsection
 - Add the precise semantics, error codes, etc for the new control
   virtqueue commands
 - Move 'MUST' to the normative section
 - Use c struct to describe control virtqueue request

changes in v3:
 - Add a control virtqueue
 - Move key program/evict/derive_sw_secret/generate/prepare/import to
   the control virtqueue
 - Add the driver and device requirements for the request in the control
   virtqueue
 - Extend DUN in crypto message to a fixed four-element array of 64-bit
   fields

changes in v2:
 - Remove virtualization-specific terminology
 - Move MUST sentence to the device/driver normative section
 - Add explicit rejection for CRYPTO request if IE feature bit
   isn't negotiated
 - Modify the support list of crypto modes and the definition of
   the size of the crypto modes buffer
---

Linlin Zhang (4):
  virtio-blk: Add inline encryption feature bit and configuration
  virtio-blk: Add inline encryption administration commands
  virtio-blk: Add inline encryption request types
  virtio-blk: Add inline encryption security considerations

 admin.tex                               |  16 +-
 device-types/blk/description.tex        | 827 +++++++++++++++++++++++-
 device-types/blk/device-conformance.tex |   1 +
 device-types/blk/driver-conformance.tex |   1 +
 4 files changed, 835 insertions(+), 10 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-27  9:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27  9:09 [PATCH v6 0/4] Add inline encryption support Linlin Zhang
2026-10-27  9:09 ` [PATCH v6 1/4] virtio-blk: Add inline encryption feature bit and configuration Linlin Zhang
2026-10-27  9:09 ` [PATCH v6 2/4] virtio-blk: Add inline encryption administration commands Linlin Zhang
2026-10-27  9:09 ` [PATCH v6 3/4] virtio-blk: Add inline encryption request types Linlin Zhang
2026-10-27  9:09 ` [PATCH v6 4/4] virtio-blk: Add inline encryption security considerations Linlin Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox