Re: [PATCH v3] virtio_blk: add SECURE ERASE command support
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: 2022-09-22 17:45:32
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@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@redhat.com>