virtio-scsi spec: add per-LUN parameter query
PATCH 1/1 virtio-scsi spec: add per-LUN parameter query
Each virtio scsi HBA has global request queue limits. But the passthrough LUNs (scsi-generic) come from different host HBAs may have different request queue limits. If the guest sends commands that exceed the host limits, the commands will be rejected by host HAB.
To address this issue, this patch adds a per-LUN parameter query via the control queue, and defines some parameter query types. The driver can query and set the needed per-LUN parameters if the device enables this feature.
--
virtio-spec.lyx | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 218 insertions(+), 0 deletions(-)
virtio-spec.lyx +218 -0
@@ -58,6 +58,7 @@ \html_be_strict false \author -608949062 "Rusty Russell,,," \author 1531152142 "Paolo Bonzini,,," +\author 2090695081 "Cong Meng,,," \end_header \begin_body
@@ -7028,6 +7029,19 @@ VIRTIO_SCSI_F_CHANGE (2) The host will report changes to LUN parameters via a VIRTIO_SCSI_T_PARAM_CHA NGE event. +\change_inserted 2090695081 1345439613 + +\end_layout + +\begin_layout Description + +\change_inserted 2090695081 1345442620 +VIRTIO_SCSI_F_PER_LUN_QUERY +\begin_inset space ~ +\end_inset + +(3) The host will support the per-LUN parameter query. + \change_unchanged \end_layout
@@ -8178,6 +8192,210 @@ response \begin_layout Standard No command-specific values are defined for the response byte. +\change_inserted 2090695081 1345439679 + +\end_layout + +\end_deeper +\begin_layout Description + +\change_inserted 2090695081 1345441715 +Per +\begin_inset space \space{} +\end_inset + +LUN +\begin_inset space \space{} +\end_inset + +query +\begin_inset space ~ +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Standard + +\change_inserted 2090695081 1345440230 +\begin_inset listings +inline false +status open + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345441722 + +#define VIRTIO_SCSI_T_PER_LUN_QUERY 3 +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345440248 + +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345441801 + +/* query type */ +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345441725 + +#define VIRTIO_SCSI_T_PLQ_MAX_SECTORS 0 +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345441726 + +#define VIRTIO_SCSI_T_PLQ_MAX_SEGMENTS 1 +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345441727 + +#define VIRTIO_SCSI_T_PLQ_MAX_SEGMENT_SIZE 2 +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345440248 + +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345441729 + +struct virtio_scsi_ctrl_plq { +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345440248 + + // Read-only part +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345440248 + + u32 type; +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345441767 + + u8 lun[8]; +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345441807 + + u32 query_type; +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345440248 + + // Write-only part +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345440248 + + u8 response; +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345445844 + + u32 parameter; +\end_layout + +\begin_layout Plain Layout + +\change_inserted 2090695081 1345440248 + +} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard + +\change_inserted 2090695081 1345443439 +The type field should be VIRTIO_SCSI_T_PER_LUN_QUERY. + +\end_layout + +\begin_layout Standard + +\change_inserted 2090695081 1345445951 +The query_type field is defined as below: +\end_layout + +\begin_layout Itemize + +\change_inserted 2090695081 1345445082 +VIRTIO_SCSI_T_PLQ_MAX_SECTORS: Maximum request size of the LUN's request + queue. + The unit is KB (1024 bytes). +\end_layout + +\begin_layout Itemize + +\change_inserted 2090695081 1345446052 +VIRTIO_SCSI_T_PLQ_MAX_SEGMENTS: Maximum sg list segments of the LUN's request + queue. +\end_layout + +\begin_layout Itemize + +\change_inserted 2090695081 1345445058 +VIRTIO_SCSI_T_PLQ_MAX_SEGMENT_SIZE: Maximum segment size of the LUN's request + queue. + The unit is byte. +\end_layout + +\begin_layout Standard + +\change_inserted 2090695081 1345445877 +By sending this command, the driver asks the specified LUN to report the + parameter specified by the query_type field. + The device responds by writing the parameter that it supports into the + parameter field, and VIRTIO_SCSI_S_OK into the response field. + Otherwise the device should write the corresponding failure response value + into the response field. +\end_layout + +\begin_layout Standard + +\change_inserted 2090695081 1345443070 +All fields of the read-only part are written by the driver. + All fields of the write-only part are written by the device. +\end_layout + +\begin_layout Standard + +\change_inserted 2090695081 1345440259 +No command-specific values are defined for the response byte. \end_layout \end_deeper
Signature · 1 line
1.7.7.6
Il 20/08/2012 11:03, Cong Meng ha scritto:
Quoted 5 lines
Each virtio scsi HBA has global request queue limits. But the passthrough LUNs (scsi-generic) come from different host HBAs may have different request queue limits. If the guest sends commands that exceed the host limits, the commands will be rejected by host HAB.
Quoted 8 lines
To address this issue, this patch adds a per-LUN parameter query via the control queue, and defines some parameter query types. The driver can query and set the needed per-LUN parameters if the device enables this feature.
Signed-off-by Cong Meng <[email protected]>--
virtio-spec.lyx | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 218 insertions(+), 0 deletions(-)
Do you have kernel and QEMU patches for this? That would help me evaluate whether the interface is the correct one.
In any case, I'd rather have a single command returning all three values (VIRTIO_SCSI_T_LUN_QUEUE_PARAMS), since it's unlikely that you need just one.
Paolo
Quoted 3 lines · 在 2012-8-20 下午9:18,"Paolo Bonzini" <[email protected]>写道:
Il 20/08/2012 11:03, Cong Meng ha scritto:
Quoted 1 line
Each virtio scsi HBA has global request queue limits. But the
passthrough
Quoted 1 line
Quoted 1 line
LUNs (scsi-generic) come from different host HBAs may have different
request
Quoted 1 line
Quoted 1 line
queue limits. If the guest sends commands that exceed the host limits,
the
Quoted 3 lines
Quoted 3 lines
commands will be rejected by host HAB.
To address this issue, this patch adds a per-LUN parameter query via
the control
Quoted 1 line
Quoted 1 line
queue, and defines some parameter query types. The driver can query and
set the
Quoted 5 lines
Quoted 5 lines
needed per-LUN parameters if the device enables this feature.
Signed-off-by Cong Meng <[email protected]>--
virtio-spec.lyx | 218
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Quoted 5 lines
Quoted 1 line
1 files changed, 218 insertions(+), 0 deletions(-)Do you have kernel and QEMU patches for this? That would help me evaluate whether the interface is the correct one.
yes,I have a demo. I will post it after I polish it tomorrow.
Quoted 3 lines
In any case, I'd rather have a single command returning all three values (
VIRTIO_SCSI_T_LUN_QUEUE_PARAMS), since it's unlikely that you need just one.
I intend to seperat them one by one. As there is opportunity that other new parameters are needed for other features.
Thanks.
Cong.
Quoted 6 lines
Paolo
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Il 20/08/2012 16:44, McPacino ha scritto:
Quoted 29 lines
Quoted 3 lines · 在 2012-8-20 下午9:18,"Paolo Bonzini" <[email protected]…
Il 20/08/2012 11:03, Cong Meng ha scritto:
Quoted 1 line
Each virtio scsi HBA has global request queue limits. But the
passthrough
Quoted 1 line
Quoted 1 line
LUNs (scsi-generic) come from different host HBAs may have different
request
Quoted 1 line
Quoted 1 line
queue limits. If the guest sends commands that exceed the host
limits, the
Quoted 3 lines
Quoted 3 lines
commands will be rejected by host HAB.
To address this issue, this patch adds a per-LUN parameter query via
the control
Quoted 1 line
Quoted 1 line
queue, and defines some parameter query types. The driver can query
and set the
Quoted 3 lines
Quoted 3 lines
needed per-LUN parameters if the device enables this feature.
Signed-off-by Cong Meng <[email protected]<mailto:[email protected]>>
Quoted 2 lines
Quoted 2 lines
--
virtio-spec.lyx | 218+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Quoted 5 lines
Quoted 1 line
1 files changed, 218 insertions(+), 0 deletions(-)Do you have kernel and QEMU patches for this? That would help me evaluate whether the interface is the correct one.
Quoted 8 lines
yes,I have a demo. I will post it after I polish it tomorrow.
Quoted 3 lines
In any case, I'd rather have a single command returning all three values (
VIRTIO_SCSI_T_LUN_QUEUE_PARAMS), since it's unlikely that you need just one.I intend to seperat them one by one. As there is opportunity that other new parameters are needed for other features.
You can use more feature bits to dictate which bits are present.
Paolo
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization