All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: virtualization@lists.linux-foundation.org, kvm@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org, Dave Jones <davej@redhat.com>
Subject: [PATCH] virtio_pci: fix capability format, comments
Date: Tue, 28 May 2013 11:08:16 +0300	[thread overview]
Message-ID: <20130528080816.GA23399@redhat.com> (raw)

- queue size can actually be 0 which is not a power of 2
- fix capability format. PCI spec says:
	The layout of the information is vendor specific, except that the byte
	immediately following the “Next” pointer in the capability structure is
	defined to be a length field.
	This length field provides the number of bytes in the capability
	structure (including the ID and Next pointer bytes).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

This patch is on top of the new layout branch, too

 include/uapi/linux/virtio_pci.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h
index cda688f..a5ef8cd 100644
--- a/include/uapi/linux/virtio_pci.h
+++ b/include/uapi/linux/virtio_pci.h
@@ -129,6 +129,7 @@
 struct virtio_pci_cap {
 	__u8 cap_vndr;	/* Generic PCI field: PCI_CAP_ID_VNDR */
 	__u8 cap_next;	/* Generic PCI field: next ptr. */
+	__u8 cap_len;	/* Generic PCI field: capability length */
 	__u8 cfg_type;	/* One of the VIRTIO_PCI_CAP_*_CFG. */
 	__u8 bar;		/* Where to find it. */
 	__le32 offset;	/* Offset within bar. */
@@ -154,7 +155,7 @@ struct virtio_pci_common_cfg {
 
 	/* About a specific virtqueue. */
 	__le16 queue_select;		/* read-write */
-	__le16 queue_size;		/* read-write, power of 2. */
+	__le16 queue_size;		/* read-write, power of 2, or 0. */
 	__le16 queue_msix_vector;	/* read-write */
 	__le16 queue_enable;		/* read-write */
 	__le16 queue_notify_off;	/* read-only */
-- 
MST
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: virtualization@lists.linux-foundation.org, kvm@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	David Howells <dhowells@redhat.com>,
	Dave Jones <davej@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] virtio_pci: fix capability format, comments
Date: Tue, 28 May 2013 11:08:16 +0300	[thread overview]
Message-ID: <20130528080816.GA23399@redhat.com> (raw)

- queue size can actually be 0 which is not a power of 2
- fix capability format. PCI spec says:
	The layout of the information is vendor specific, except that the byte
	immediately following the “Next” pointer in the capability structure is
	defined to be a length field.
	This length field provides the number of bytes in the capability
	structure (including the ID and Next pointer bytes).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

This patch is on top of the new layout branch, too

 include/uapi/linux/virtio_pci.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h
index cda688f..a5ef8cd 100644
--- a/include/uapi/linux/virtio_pci.h
+++ b/include/uapi/linux/virtio_pci.h
@@ -129,6 +129,7 @@
 struct virtio_pci_cap {
 	__u8 cap_vndr;	/* Generic PCI field: PCI_CAP_ID_VNDR */
 	__u8 cap_next;	/* Generic PCI field: next ptr. */
+	__u8 cap_len;	/* Generic PCI field: capability length */
 	__u8 cfg_type;	/* One of the VIRTIO_PCI_CAP_*_CFG. */
 	__u8 bar;		/* Where to find it. */
 	__le32 offset;	/* Offset within bar. */
@@ -154,7 +155,7 @@ struct virtio_pci_common_cfg {
 
 	/* About a specific virtqueue. */
 	__le16 queue_select;		/* read-write */
-	__le16 queue_size;		/* read-write, power of 2. */
+	__le16 queue_size;		/* read-write, power of 2, or 0. */
 	__le16 queue_msix_vector;	/* read-write */
 	__le16 queue_enable;		/* read-write */
 	__le16 queue_notify_off;	/* read-only */
-- 
MST

             reply	other threads:[~2013-05-28  8:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28  8:08 Michael S. Tsirkin [this message]
2013-05-28  8:08 ` [PATCH] virtio_pci: fix capability format, comments Michael S. Tsirkin
2013-05-30  1:33 ` Rusty Russell
2013-05-30  1:33   ` Rusty Russell

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=20130528080816.GA23399@redhat.com \
    --to=mst@redhat.com \
    --cc=davej@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.