From ad147dd69e8f9ad4d22814686f1442166c1190d7 Mon Sep 17 00:00:00 2001
From: rusty <rusty@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>
Date: Thu, 22 May 2014 04:43:13 +0000
Subject: content.tex: add support for protection information (VIRTIO-108)

This is a new feature that was suggested by Nicholas Bellinger, who
also provided a prototype implementation for vhost-scsi.

(As per minutes of meeting 2014-05-20:
	https://lists.oasis-open.org/archives/virtio/201405/msg00034.html )

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Rusty Russell <rusty@au1.ibm.com>

git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@371 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652
---
 content.tex | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

(limited to 'content.tex')

diff --git a/content.tex b/content.tex
index a745599..7e88411 100644
--- a/content.tex
+++ b/content.tex
@@ -4420,6 +4420,9 @@ This section relies on definitions from \hyperref[intro:SAM]{SAM}.
 
 \item[VIRTIO_SCSI_F_CHANGE (2)] The host will report changes to LUN
     parameters via a VIRTIO_SCSI_T_PARAM_CHANGE event.
+
+\item[VIRTIO_SCSI_F_T10_PI (3)] The extended fields for T10 protection
+    information (DIF/DIX) are included in the SCSI request header.
 \end{description}
 
 \subsection{Device configuration layout}\label{sec:Device Types / SCSI Host Device / Device configuration layout}
@@ -4532,7 +4535,12 @@ struct virtio_scsi_req_cmd {
         u8 prio;
         u8 crn;
         u8 cdb[cdb_size];
+        // The next two fields are only present if VIRTIO_SCSI_F_T10_PI
+        // is negotiated.
+        u32 pi_bytesout;
+        u8 pi_out[pi_bytesout];
         u8 dataout[];
+
         // Device-writable part
         le32 sense_len;
         le32 residual;
@@ -4540,6 +4548,10 @@ struct virtio_scsi_req_cmd {
         u8 status;
         u8 response;
         u8 sense[sense_size];
+        // The next two fields are only present if VIRTIO_SCSI_F_T10_PI
+        // is negotiated
+        u32 pi_bytesin;
+        u8 pi_in[pi_bytesin];
         u8 datain[];
 };
 
@@ -4580,13 +4592,25 @@ by clients, but is generally expected to be 0. The maximum CRN
 value defined by the protocol is 255, since CRN is stored in an
 8-bit integer.
 
-All of these fields are defined in \hyperref[intro:SAM]{SAM}. They are always
-device-readable, as are \field{cdb} and \field{dataout}. \field{cdb_size} is
-taken from the configuration space.
+The CDB is included in \field{cdb} and its size, \field{cdb_size},
+is taken from the configuration space.
+
+All of these fields are defined in \hyperref[intro:SAM]{SAM} and are
+always device-readable.
+
+\field{pi_bytesout} determines the size of the \field{pi_out} field
+in bytes.  If it is nonzero, the \field{pi_out} field contains outgoing
+protection information for write operations.  Both fields are only
+present if VIRTIO_SCSI_F_T10_PI has been negotiated.
+
+The remainder of the device-readable part is the data output buffer,
+\field{dataout}.
 
 \field{sense} and subsequent fields are always device-writable. \field{sense_len}
 indicates the number of bytes actually written to the sense
-buffer. \field{residual} indicates the residual size,
+buffer.
+
+\field{residual} indicates the residual size,
 calculated as ``data_length - number_of_transferred_bytes'', for
 read or write operations. For bidirectional commands, the
 number_of_transferred_bytes includes both read and written bytes.
@@ -4596,6 +4620,15 @@ exceeds the size of \field{datain} means that \field{dataout} was
 processed partially and \field{datain} was not processed at
 all.
 
+\field{pi_bytesin} determines the size of the \field{pi_in} field
+in bytes.  If it is nonzero, the \field{pi_in} field contains incoming
+protection information for read operations.  Both fields are only present
+if VIRTIO_SCSI_F_T10_PI has been negotiated.
+
+The remainder of the device-writable part is the data input buffer,
+\field{datain}.
+
+
 \devicenormative{\paragraph}{Device Operation: Request Queues}{Device Types / SCSI Host Device / Device Operation / Device Operation: Request Queues}
 
 The device MUST write the \field{status} byte as the status code as
-- 
cgit v1.2.3

