From 9a42c29745aaaf17724104ef3c896ff958ac2c63 Mon Sep 17 00:00:00 2001 From: rusty Date: Mon, 14 Oct 2013 09:57:19 +0000 Subject: virtio_blk: deprecate flush. This is partially a port of Paolo Bonzini 's WCE spec changes, but puts them in the legacy section. It reserves the writeback field for compatibility. Flush is now required. Approved at 2013-10-08 meeting: https://lists.oasis-open.org/archives/virtio/201310/msg00087.html See: https://lists.oasis-open.org/archives/virtio-comment/201308/msg00078.html Signed-off-by: Rusty Russell git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@62 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652 --- virtio-v1.0-wd01-part1-specification.txt | 54 +++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 15 deletions(-) (limited to 'virtio-v1.0-wd01-part1-specification.txt') diff --git a/virtio-v1.0-wd01-part1-specification.txt b/virtio-v1.0-wd01-part1-specification.txt index 36f630c..e8fbe69 100644 --- a/virtio-v1.0-wd01-part1-specification.txt +++ b/virtio-v1.0-wd01-part1-specification.txt @@ -2224,8 +2224,6 @@ device except where noted. VIRTIO_BLK_F_BLK_SIZE (6) Block size of disk is in “blk_size”. - VIRTIO_BLK_F_FLUSH (9) Cache flush command support. - VIRTIO_BLK_F_TOPOLOGY (10) Device exports information on optimal I/O alignment. @@ -2258,9 +2256,19 @@ bits as indicated above. u16 min_io_size; u32 opt_io_size; } topology; + u8 reserved; }; + VIRTIO_BLK_F_FLUSH (9) Cache flush command support. + + VIRTIO_BLK_F_CONFIG_WCE (11) Device can toggle its cache between writeback + and writethrough modes. + +VIRTIO_BLK_F_FLUSH was also called VIRTIO_BLK_F_WCE: Legacy drivers +should only negotiate this feature if they are capable of sending +VIRTIO_BLK_T_FLUSH commands. + 2.4.2.4. Device Initialization ----------------------------- @@ -2282,6 +2290,21 @@ bits as indicated above. I/O lengths for the driver to use. This also does not affect the units in the protocol, only performance. +2.4.2.4.1. Legacy Interface: Device Initialization +----------------------------- + +The reserved field used to be called writeback. If the +VIRTIO_BLK_F_CONFIG_WCE feature is offered, the cache mode should be +read from the writeback field of the configuration if available; the +driver can also write to the field in order to toggle the cache +between writethrough (0) and writeback (1) mode. If the feature is +not available, the driver can instead look at the result of +negotiating VIRTIO_BLK_F_FLUSH: the cache will be in writeback mode +after reset if and only if VIRTIO_BLK_F_FLUSH is negotiated. + +Some older legacy devices did not operate in writethrough mode even +after a guest announced lack of support for VIRTIO_BLK_F_FLUSH. + 2.4.2.5. Device Operation ------------------------ @@ -2317,12 +2340,26 @@ error or VIRTIO_BLK_S_UNSUPP for a request unsupported by host: #define VIRTIO_BLK_S_IOERR 1 #define VIRTIO_BLK_S_UNSUPP 2 +Any writes completed before the submission of the flush command should +be committed to non-volatile storage by the device. + 2.4.2.5.1 Legacy Interface: Device Operation ------------------------ The 'reserved' field was previously called ioprio. The ioprio field is a hint about the relative priorities of requests to the device: higher numbers indicate more important requests. + #define VIRTIO_BLK_T_BARRIER 0x80000000 + +If the device has VIRTIO_BLK_F_BARRIER +feature the high bit (VIRTIO_BLK_T_BARRIER) indicates that this +request acts as a barrier and that all preceeding requests must be +complete before this one, and all following requests must not be +started until this is complete. Note that a barrier does not flush +caches in the underlying backend device in host, and thus does not +serve as data consistency guarantee. Driver must use FLUSH request to +flush the host cache. + If the device has VIRTIO_BLK_F_SCSI feature, it can also support scsi packet command requests, each of these requests is of form: @@ -2382,19 +2419,6 @@ data_len, sense_len and residual in a single write-only buffer; and the status field is a separate read-only buffer of size 1 byte, by itself. -2.4.2.5.1. Legacy Interface: Device Operation ------------------------- - #define VIRTIO_BLK_T_BARRIER 0x80000000 - -If the device has VIRTIO_BLK_F_BARRIER -feature the high bit (VIRTIO_BLK_T_BARRIER) indicates that this -request acts as a barrier and that all preceeding requests must be -complete before this one, and all following requests must not be -started until this is complete. Note that a barrier does not flush -caches in the underlying backend device in host, and thus does not -serve as data consistency guarantee. Driver must use FLUSH request to -flush the host cache. - 2.4.3. Console Device ==================== -- cgit v1.2.3