From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org
Cc: Rusty Russell <rusty@rustcorp.com.au>,
cornelia.huck@de.ibm.com,
virtualization@lists.linux-foundation.org,
linux-api@vger.kernel.org
Subject: [PATCH v3 12/16] virtio-pci: define layout for virtio 1.0
Date: Wed, 14 Jan 2015 19:28:09 +0200 [thread overview]
Message-ID: <1421256142-11512-13-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1421256142-11512-1-git-send-email-mst@redhat.com>
From: Rusty Russell <rusty@rustcorp.com.au>
Based on patches by Michael S. Tsirkin <mst@redhat.com>, but I found it
hard to follow so changed to use structures which are more
self-documenting.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/uapi/linux/virtio_pci.h | 62 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h
index 509d630..4e05423 100644
--- a/include/uapi/linux/virtio_pci.h
+++ b/include/uapi/linux/virtio_pci.h
@@ -99,4 +99,66 @@
/* Vector value used to disable MSI for queue */
#define VIRTIO_MSI_NO_VECTOR 0xffff
+#ifndef VIRTIO_PCI_NO_MODERN
+
+/* IDs for different capabilities. Must all exist. */
+
+/* Common configuration */
+#define VIRTIO_PCI_CAP_COMMON_CFG 1
+/* Notifications */
+#define VIRTIO_PCI_CAP_NOTIFY_CFG 2
+/* ISR access */
+#define VIRTIO_PCI_CAP_ISR_CFG 3
+/* Device specific confiuration */
+#define VIRTIO_PCI_CAP_DEVICE_CFG 4
+
+/* This is the PCI capability header: */
+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 type_and_bar; /* Upper 3 bits: bar.
+ * Lower 3 is VIRTIO_PCI_CAP_*_CFG. */
+ __le32 offset; /* Offset within bar. */
+ __le32 length; /* Length. */
+};
+
+#define VIRTIO_PCI_CAP_BAR_SHIFT 5
+#define VIRTIO_PCI_CAP_BAR_MASK 0x7
+#define VIRTIO_PCI_CAP_TYPE_SHIFT 0
+#define VIRTIO_PCI_CAP_TYPE_MASK 0x7
+
+struct virtio_pci_notify_cap {
+ struct virtio_pci_cap cap;
+ __le32 notify_off_multiplier; /* Multiplier for queue_notify_off. */
+};
+
+/* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */
+struct virtio_pci_common_cfg {
+ /* About the whole device. */
+ __le32 device_feature_select; /* read-write */
+ __le32 device_feature; /* read-only */
+ __le32 guest_feature_select; /* read-write */
+ __le32 guest_feature; /* read-write */
+ __le16 msix_config; /* read-write */
+ __le16 num_queues; /* read-only */
+ __u8 device_status; /* read-write */
+ __u8 config_generation; /* read-only */
+
+ /* About a specific virtqueue. */
+ __le16 queue_select; /* read-write */
+ __le16 queue_size; /* read-write, power of 2. */
+ __le16 queue_msix_vector; /* read-write */
+ __le16 queue_enable; /* read-write */
+ __le16 queue_notify_off; /* read-only */
+ __le32 queue_desc_lo; /* read-write */
+ __le32 queue_desc_hi; /* read-write */
+ __le32 queue_avail_lo; /* read-write */
+ __le32 queue_avail_hi; /* read-write */
+ __le32 queue_used_lo; /* read-write */
+ __le32 queue_used_hi; /* read-write */
+};
+
+#endif /* VIRTIO_PCI_NO_MODERN */
+
#endif
--
MST
next prev parent reply other threads:[~2015-01-14 17:28 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 17:27 [PATCH v3 00/16] virtio-pci: towards virtio 1.0 guest support Michael S. Tsirkin
2015-01-14 17:27 ` [PATCH v3 01/16] virtio_pci: drop virtio_config dependency Michael S. Tsirkin
2015-01-14 17:27 ` [PATCH v3 02/16] virtio/9p: verify device has config space Michael S. Tsirkin
2015-01-14 17:27 ` [PATCH v3 03/16] virtio/blk: " Michael S. Tsirkin
2015-01-14 17:27 ` [PATCH v3 04/16] virtio/console: " Michael S. Tsirkin
2015-01-20 10:40 ` Amit Shah
2015-01-20 11:09 ` Michael S. Tsirkin
2015-01-21 6:14 ` Amit Shah
2015-01-21 6:44 ` Michael S. Tsirkin
2015-01-14 17:27 ` [PATCH v3 05/16] virtio/net: " Michael S. Tsirkin
2015-01-14 17:27 ` [PATCH v3 06/16] virtio/scsi: " Michael S. Tsirkin
2015-01-14 17:27 ` [PATCH v3 07/16] virtio/balloon: " Michael S. Tsirkin
2015-01-14 17:27 ` [PATCH v3 08/16] mn10300: drop dead code Michael S. Tsirkin
2015-01-23 23:08 ` Bjorn Helgaas
2015-01-14 17:27 ` [PATCH v3 09/16] pci: add pci_iomap_range Michael S. Tsirkin
2015-01-23 23:08 ` Bjorn Helgaas
2015-01-14 17:27 ` [PATCH v3 10/16] s390: " Michael S. Tsirkin
2015-01-16 10:11 ` Sebastian Ott
2015-01-21 0:43 ` Rusty Russell
2015-01-14 17:28 ` [PATCH v3 11/16] virtio_pci: move probe/remove code to common Michael S. Tsirkin
2015-01-14 17:28 ` Michael S. Tsirkin [this message]
2015-01-14 17:28 ` [PATCH v3 13/16] virtio_pci: modern driver Michael S. Tsirkin
2015-01-14 17:28 ` [PATCH v3 14/16] virtio_pci: macros for PCI layout offsets Michael S. Tsirkin
2015-01-14 17:28 ` [PATCH v3 15/16] virtio_pci_modern: reduce number of mappings Michael S. Tsirkin
2015-01-14 17:28 ` [PATCH v3 16/16] virtio_pci_modern: support devices with no config Michael S. Tsirkin
2015-01-15 21:18 ` [PATCH v3 00/16] virtio-pci: towards virtio 1.0 guest support Gerd Hoffmann
2015-01-15 21:32 ` Michael S. Tsirkin
2015-01-16 8:32 ` Gerd Hoffmann
2015-01-16 8:45 ` Michael S. Tsirkin
2015-01-16 13:27 ` Gerd Hoffmann
2015-01-19 10:54 ` Gerd Hoffmann
2015-01-20 16:38 ` Michael S. Tsirkin
2015-01-19 11:07 ` Gerd Hoffmann
2015-01-19 22:11 ` Michael S. Tsirkin
2015-01-20 16:32 ` Michael S. Tsirkin
2015-01-21 11:31 ` Gerd Hoffmann
2015-01-21 11:36 ` Michael S. Tsirkin
2015-01-21 13:43 ` Gerd Hoffmann
2015-01-21 14:19 ` 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=1421256142-11512-13-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).