Stefan Hajnoczi
2022-Sep-22 17:45 UTC
[PATCH v3] virtio_blk: add SECURE ERASE command support
On Wed, Sep 21, 2022 at 11:27:29AM +0300, Alvaro Karsz wrote:> Support for the VIRTIO_BLK_F_SECURE_ERASE VirtIO feature. > > A device that offers this feature can receive VIRTIO_BLK_T_SECURE_ERASE > commands. > > A device which supports this feature has the following fields in the > virtio config: > > - max_secure_erase_sectors > - max_secure_erase_seg > - secure_erase_sector_alignment > > max_secure_erase_sectors and secure_erase_sector_alignment are expressed > in 512-byte units. > > Every secure erase command has the following fields: > > - sectors: The starting offset in 512-byte units. > - num_sectors: The number of sectors. > > Signed-off-by: Alvaro Karsz <alvaro.karsz at solid-run.com> > --- > v2: > - Set queue max discard segments as the minimum between > max_secure_erase_seg and max_discard_seg. > - Set queue discard granularity as the minimum between > secure_erase_sector_alignment and discard_sector_alignment. > > v3: > - Usage of min_not_zero. > - Fail probe if any of the secure erase parameters in the virtio > config is 0. > - Add a comment explaining why we use the minimum between the discard > and secure erase limits. > --- > drivers/block/virtio_blk.c | 110 ++++++++++++++++++++++++++------ > include/uapi/linux/virtio_blk.h | 19 ++++++ > 2 files changed, 111 insertions(+), 18 deletions(-)Reviewed-by: Stefan Hajnoczi <stefanha at redhat.com> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: not available URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20220922/2094ec4d/attachment.sig>
Alvaro Karsz
2022-Sep-28 10:48 UTC
[PATCH v3] virtio_blk: add SECURE ERASE command support
> What I worry about is that down the road we might want to add > special meaning to currently unused values. > If doing that just clears VIRTIO_BLK_F_SECURE_ERASE then > we have forward compatibility. If it fails probe then we > won't be able to do use these values.They are not exactly unused, we are using them to calculate the "discard sector alignment" and the "max discard sectors" values. The values are even used directly if VIRTIO_BLK_F_DISCARD is not negotiated.