Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
From: Linlin Zhang <linlin.zhang@oss.qualcomm.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: virtio-dev@lists.linux.dev, ebiggers@kernel.org,
	neeraj.soni@oss.qualcomm.com
Subject: Re: [PATCH v3 1/2] virtio-blk: Add the control virtqueue
Date: Tue, 22 Sep 2026 19:10:34 +0800	[thread overview]
Message-ID: <b1e4cbf9-6f5b-4f5c-bafa-4394ff3c666b@oss.qualcomm.com> (raw)
In-Reply-To: <20260917201647.GB331587@fedora>



On 9/18/2026 4:16 AM, Stefan Hajnoczi wrote:
> On Sun, Sep 13, 2026 at 09:16:14AM -0700, Linlin Zhang wrote:
>> From: linlzhan <linlin.zhang@oss.qualcomm.com>
>>
>> Add VIRTIO_BLK_F_CTRL_VQ to advertise control virtqueue support.
>>
>> Define the control virtqueue location, driver queue discovery,
>> and common control request buffer layout. This provides a
>> standard framework for block-device control commands.
>>
>> Signed-off-by: linlzhan <linlin.zhang@oss.qualcomm.com>
>> ---
>>  device-types/blk/description.tex | 19 +++++++++++++++++++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/device-types/blk/description.tex b/device-types/blk/description.tex
>> index 3b3a4e7..9bfdc4a 100644
>> --- a/device-types/blk/description.tex
>> +++ b/device-types/blk/description.tex
>> @@ -13,11 +13,16 @@ \subsection{Virtqueues}\label{sec:Device Types / Block Device / Virtqueues}
>>  \item[0] requestq1
>>  \item[\ldots]
>>  \item[N-1] requestqN
>> +\item[N] controlq, if VIRTIO_BLK_F_CTRL_VQ is negotiated
>>  \end{description}
>>  
>>   N=1 if VIRTIO_BLK_F_MQ is not negotiated, otherwise N is set by
>>   \field{num_queues}.
>>  
>> +If VIRTIO_BLK_F_CTRL_VQ is negotiated, the control virtqueue is appended
>> +after the request virtqueues. The control virtqueue is reserved for control
>> +requests defined by this specification.
>> +
>>  \subsection{Feature bits}\label{sec:Device Types / Block Device / Feature bits}
>>  
>>  \begin{description}
>> @@ -73,6 +78,8 @@ \subsection{Feature bits}\label{sec:Device Types / Block Device / Feature bits}
>>      VIRTIO_BLK_REQ_FLAG_OUT_FUA flag in the \field{flags} bitfield of the
>>      \field{virtio_blk_req} structure for VIRTIO_BLK_T_OUT requests.
>>  
>> +\item[VIRTIO_BLK_F_CTRL_VQ (22)] Device supports a control virtqueue.
>> +
>>  \end{description}
>>  
>>  \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Block Device / Feature bits / Legacy Interface: Feature bits}
>> @@ -274,6 +281,9 @@ \subsection{Device Initialization}\label{sec:Device Types / Block Device / Devic
>>  \item If the VIRTIO_BLK_F_MQ feature is negotiated, \field{num_queues} field
>>      can be read to determine the number of queues.
>>  
>> +\item If the VIRTIO_BLK_F_CTRL_VQ feature is negotiated, the driver MUST
>> +    identify the control virtqueue as queue N, after all request virtqueues.
>> +
>>  \item If the VIRTIO_BLK_F_SECURE_ERASE feature is negotiated,
>>      \field{max_secure_erase_sectors} and \field{max_secure_erase_seg} can be read
>>      to determine the maximum secure erase sectors and maximum number of
>> @@ -327,6 +337,10 @@ \subsection{Device Initialization}\label{sec:Device Types / Block Device / Devic
>>  The driver MUST NOT negotiate VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA without
>>  VIRTIO_BLK_F_REQ_FLAGS.
>>  
>> +If the VIRTIO_BLK_F_CTRL_VQ feature is negotiated, the driver MUST NOT submit
>> +any request to the control virtqueue unless the request is defined by this
>> +specification.
>> +
>>  \devicenormative{\subsubsection}{Device Initialization}{Device Types / Block Device / Device Initialization}
>>  
>>  Devices SHOULD always offer VIRTIO_BLK_F_FLUSH, and MUST offer it
>> @@ -454,6 +468,11 @@ \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope
>>  };
>>  \end{lstlisting}
>>  
>> +Control virtqueue requests consist of a type field in an output buffer,
> 
> Please move this paragraph to a separate subsection dedicate the control
> virtqueue (like virtio-net's 5.1.9.5 Control Virtqueue in VIRTIO 1.4,
> https://docs.oasis-open.org/virtio/virtio/v1.4/virtio-v1.4.html#x1-2850009:~:text=5%2E1%2E9%2E5%20Control%20Virtqueue).
> 
> I recommend defining a separate struct virtio_blk_ctrl similar to
> virtio-net's struct virtio_net_ctrl to illustrate the layout more
> clearly than a paragraph of text could.
> 

ACK. Thanks for your comment!

A separate struct virtio_blk_ctrl will be defined in the next patch.


>> +followed by an optional command-specific output buffer, an optional
>> +command-specific input buffer, and a status byte in an input buffer. The
>> +type field and status byte MUST each be in their own buffer.
> 
> Message framing is up to the driver and the device spec cannot dictate
> specific framing:
> https://docs.oasis-open.org/virtio/virtio/v1.4/virtio-v1.4.html#x1-390004
> 

ACK

The message framing will be defined in the format of the new struct virtio_blk_ctrl.

>> +
>>  The type of the request is either a read (VIRTIO_BLK_T_IN), a write
>>  (VIRTIO_BLK_T_OUT), a discard (VIRTIO_BLK_T_DISCARD), a write zeroes
>>  (VIRTIO_BLK_T_WRITE_ZEROES), a flush (VIRTIO_BLK_T_FLUSH), a get device ID
>> -- 
>> 2.34.1
>>


  reply	other threads:[~2026-09-22 11:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13 16:16 [PATCH v3 0/2] virtio-blk: Add inline encryption support Linlin Zhang
2026-09-13 16:16 ` [PATCH v3 1/2] virtio-blk: Add the control virtqueue Linlin Zhang
2026-09-17 20:16   ` Stefan Hajnoczi
2026-09-22 11:10     ` Linlin Zhang [this message]
2026-09-13 16:16 ` [PATCH v3 2/2] virtio-blk: Add inline encryption support Linlin Zhang
2026-09-17 21:05   ` Stefan Hajnoczi
2026-09-24  9:32     ` Linlin Zhang
2026-09-17 21:08 ` [PATCH v3 0/2] " Stefan Hajnoczi
2026-09-22  4:29   ` Linlin Zhang
2026-09-22 13:14     ` Stefan Hajnoczi
2026-09-24  9:35       ` Linlin Zhang
2026-09-29 22:46         ` Max Gurtovoy
2026-10-08  9:17           ` Linlin Zhang
2026-10-08 10:15             ` Michael S. Tsirkin
2026-10-09 11:21               ` Linlin Zhang
2026-10-09 12:25                 ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b1e4cbf9-6f5b-4f5c-bafa-4394ff3c666b@oss.qualcomm.com \
    --to=linlin.zhang@oss.qualcomm.com \
    --cc=ebiggers@kernel.org \
    --cc=neeraj.soni@oss.qualcomm.com \
    --cc=stefanha@redhat.com \
    --cc=virtio-dev@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox