diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2019-02-21 11:33:07 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2019-02-22 09:42:16 +0000 |
commit | 5c81161f804144b146607f890e84613a4cbad95c (patch) | |
tree | df55db0d4d94ecb8f75a3f62c3e2e789425d2d2b /hw/block | |
parent | bbe8bd4d85d80442f87774d7bffaca11f2c02b9b (diff) | |
download | qemu-5c81161f804144b146607f890e84613a4cbad95c.zip qemu-5c81161f804144b146607f890e84613a4cbad95c.tar.gz qemu-5c81161f804144b146607f890e84613a4cbad95c.tar.bz2 |
virtio-blk: add "discard" and "write-zeroes" properties
In order to avoid migration issues, we enable DISCARD and
WRITE_ZEROES features only for machine type >= 4.0
As discussed with Michael S. Tsirkin and Stefan Hajnoczi on the
list [1], DISCARD operation should not have security implications
(eg. page cache attacks), so we can enable it by default.
[1] https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg00504.html
Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20190221103314.58500-4-sgarzare@redhat.com
Message-Id: <20190221103314.58500-4-sgarzare@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/virtio-blk.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 7813237..f7cd322 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1027,6 +1027,10 @@ static Property virtio_blk_properties[] = { DEFINE_PROP_UINT16("queue-size", VirtIOBlock, conf.queue_size, 128), DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD, IOThread *), + DEFINE_PROP_BIT64("discard", VirtIOBlock, host_features, + VIRTIO_BLK_F_DISCARD, true), + DEFINE_PROP_BIT64("write-zeroes", VirtIOBlock, host_features, + VIRTIO_BLK_F_WRITE_ZEROES, true), DEFINE_PROP_END_OF_LIST(), }; |