Subject: Re: [virtio] [PATCH] virtqueue: flexible layout, size, alignment
On Wed, Sep 11, 2013 at 05:46:39PM +0300, Michael S. Tsirkin wrote: > diff --git a/virtio-v1.0-wd01-part1-specification.txt b/virtio-v1.0-wd01-part1-specification.txt > index fcd9fd7..9a40973 100644 > --- a/virtio-v1.0-wd01-part1-specification.txt > +++ b/virtio-v1.0-wd01-part1-specification.txt > @@ -223,6 +223,45 @@ transmit and one for receive. Each queue has a 16-bit queue size > parameter, which sets the number of entries and implies the total size > of the queue. > > +Each virtqueue consists of three parts: > + > + Descriptor Table > + Available Ring > + Used Ring > + > +where each part is physically-contiguous in guest memory, > +and has different alignment requirements. > + > +The Queue Size field controls the total number of bytes > +required for each part of the virtqueue. I'm lost here because I don't know where the Queue Size field comes from. I think the table needs to be shown first, then the explanation can be given: ...table... The Size column gives the total number of bytes required for each part of the virtqueue. > + > +The memory aligment and size requirements, in bytes, of each part of the > +virtqueue are summarized in the following table (qsz is the Queue Size field): Perhaps it's clearer to say: qsz is the maximum number of buffers. For example, if qsz is 4 then at most 4 buffers can be transferred at any given time. > @@ -814,9 +852,11 @@ This is done as follows, for each virtqueue a device has: > always a power of 2. This controls how big the virtqueue is > (see "2.1.4. Virtqueues"). If this field is 0, the virtqueue does not exist. > > -3. Allocate and zero virtqueue in contiguous physical memory, on > - a 4096 byte alignment. Write the physical address, divided by > - 4096 to the Queue Address field. > +3. Optionally, select a smaller virtqueue size and write it in the Queue Size > + field. 3... > +3. Allocate and zero Descriptor Table, Available and Used rings for the > + virtqueue in contiguous physical memory. ...and 3. Should this list be renumbered?