From patchwork Wed Feb 10 13:00:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 45031 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 762E9B7DA1 for ; Thu, 11 Feb 2010 00:04:50 +1100 (EST) Received: from localhost ([127.0.0.1]:39040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfCFL-0008Me-Ih for incoming@patchwork.ozlabs.org; Wed, 10 Feb 2010 08:04:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfCEl-0008Ld-5y for qemu-devel@nongnu.org; Wed, 10 Feb 2010 08:04:11 -0500 Received: from [199.232.76.173] (port=54212 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfCEk-0008LK-En for qemu-devel@nongnu.org; Wed, 10 Feb 2010 08:04:10 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfCEh-0000DB-SH for qemu-devel@nongnu.org; Wed, 10 Feb 2010 08:04:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37605) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfCEh-0000D5-DN for qemu-devel@nongnu.org; Wed, 10 Feb 2010 08:04:07 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1AD3tS4020276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 10 Feb 2010 08:03:55 -0500 Received: from redhat.com (vpn1-6-192.ams2.redhat.com [10.36.6.192]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o1AD3pcF014018; Wed, 10 Feb 2010 08:03:52 -0500 Date: Wed, 10 Feb 2010 15:00:39 +0200 From: "Michael S. Tsirkin" To: rusty@rustcorp.com.au, virtualization@lists.linux-foundation.org Message-ID: <20100210130026.GA19271@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: markmc@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH] virtio-spec: document indirect descriptors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add documentation for indirect descriptors Signed-off-by: Michael S. Tsirkin --- virtio-spec.lyx | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 114 insertions(+), 4 deletions(-) diff --git a/virtio-spec.lyx b/virtio-spec.lyx index 8062e11..b5a8fbd 100644 --- a/virtio-spec.lyx +++ b/virtio-spec.lyx @@ -1,4 +1,4 @@ -#LyX 1.6.4 created this file. For more info see http://www.lyx.org/ +#LyX 1.6.5 created this file. For more info see http://www.lyx.org/ \lyxformat 345 \begin_document \begin_header @@ -36,8 +36,7 @@ \paperpagestyle default \tracking_changes true \output_changes true -\author "" -\author "" +\author "Michael S. Tsirkin" \author "" \end_header @@ -1441,7 +1440,28 @@ struct vring_desc { \begin_layout Plain Layout -#define VRING_DESC_F_WRITE 2 +#define VRING_DESC_F_WRITE 2 +\change_deleted 0 1265802057 + +\change_inserted 0 1265802048 + +\end_layout + +\begin_layout Plain Layout + +\change_inserted 0 1265802054 + +/* This means the buffer contains a list of buffer descriptors. + */ +\end_layout + +\begin_layout Plain Layout + +\change_inserted 0 1265802049 + +#define VRING_DESC_F_INDIRECT 4 +\change_unchanged + \end_layout \begin_layout Plain Layout @@ -1478,6 +1498,96 @@ struct vring_desc { \begin_layout Standard The number of descriptors in the table is specified by the Queue Size field for this virtqueue. +\change_deleted 0 1265801065 + +\end_layout + +\begin_layout Subsubsection + +\change_inserted 0 1265801341 +Indirect Descriptors +\end_layout + +\begin_layout Standard + +\change_inserted 0 1265805736 +Some devices benefit by concurrently dispatching a large number of large + requests. + To increase ring capacity it is possible to store a table of +\emph on +indirect descriptors +\emph default + anywhere in memory, and insert a descriptor in main virtqueue (with flags&INDIRECT on) that refers to memory buffer containing this +\emph on +indirect descriptor table +\emph default +; fields +\emph on +addr +\emph default + and +\emph on +len +\emph default + refer to the indirect table address and length in bytes, respectively. + The indirect table layout structure looks like this (len is the length + of the descriptor that refers to this table, which is a variable, so this + code won't compile): +\end_layout + +\begin_layout Standard + +\change_inserted 0 1265804397 +\begin_inset listings +inline false +status open + +\begin_layout Plain Layout + +\change_inserted 0 1265804526 + +struct indirect_descriptor_table { +\end_layout + +\begin_layout Plain Layout + +\change_inserted 0 1265804397 + + /* The actual descriptors (16 bytes each) */ +\end_layout + +\begin_layout Plain Layout + +\change_inserted 0 1265804473 + + struct vring_desc desc[len / 16]; +\end_layout + +\begin_layout Plain Layout + +\change_inserted 0 1265804397 + +}; +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard + +\change_inserted 0 1265805219 +The first indirect descriptor is located at start of the indirect descriptor + table (index 0), additional indirect descriptors are chained by next field. + An indirect descriptor without next field (with flags&NEXT off) signals + the end of the indirect descriptor table, and transfers control back to + the main virtqueue. + An indirect descriptor can not refer to another indirect descriptor table + (flags&INDIRECT must be off). + A single indirect descriptor table can include both read-only and write-only + descriptors; write-only flag (flags&WRITE) in the descriptor that refers + to it is ignored. \end_layout \begin_layout Subsection