summaryrefslogtreecommitdiff
path: root/virtio-v1.0-wd01-part1-specification.txt
diff options
context:
space:
mode:
authorrusty <rusty@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>2013-10-04 02:49:00 +0000
committerrusty <rusty@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>2013-10-04 02:49:00 +0000
commit6df98f70033813e7fbedf08b572869e9e0e6c9c2 (patch)
tree2c9efe883e87698409e6dfccc31bd88878d63f6d /virtio-v1.0-wd01-part1-specification.txt
parentedeffd1cbda10a7aa62fbc25797049e972c04aa3 (diff)
Copy linear layout to CCW, MMIO sections.
Revision r49 "virtqueue: flexible layout, size, alignment" moved the linear assumption into the legacy section. We also need it in the per-transport sections until (if?) those two transports go non-linear. Just copied the paragraph, with variable names changed to match the particular transport field nomenclature. Signed-off-by: Rusty Russell <rusty@au1.ibm.com> git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@52 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652
Diffstat (limited to 'virtio-v1.0-wd01-part1-specification.txt')
-rw-r--r--virtio-v1.0-wd01-part1-specification.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/virtio-v1.0-wd01-part1-specification.txt b/virtio-v1.0-wd01-part1-specification.txt
index 73e1e8b..b5a5835 100644
--- a/virtio-v1.0-wd01-part1-specification.txt
+++ b/virtio-v1.0-wd01-part1-specification.txt
@@ -1396,6 +1396,27 @@ Writing to registers described as “R” and reading from
registers described as “W” is not permitted and can cause
undefined behavior.
+100.3.2.2.1. Virtqueue Layout
+------------------------------
+
+The virtqueue is physically contiguous, with padded added to make the
+used ring meet the QueueAlign value:
+
++-------------------+-----------------------------------+-----------+
+| Descriptor Table | Available Ring (padding) | Used Ring |
++-------------------+-----------------------------------+-----------+
+
+The calculation for total size is as follows:
+
+ #define ALIGN(x) (((x) + QueueAlign) & ~QueueAlign)
+ static inline unsigned vring_size(unsigned int QueueNum)
+ {
+ return ALIGN(sizeof(struct vring_desc)*QueueNum
+ + sizeof(u16)*(3 + QueueNum))
+ + ALIGN(sizeof(u16)*3 + sizeof(struct vring_used_elem)*QueueNum);
+ }
+
+
2.3.2.3. MMIO-specific Initialization And Device Operation
---------------------------------------------------------
@@ -1542,6 +1563,26 @@ queue contains the guest address for queue index. The actual
number of allocated buffers is transmitted in num and their
alignment in align.
+100.3.3.2.1. Virtqueue Layout
+------------------------------
+
+The virtqueue is physically contiguous, with padded added to make the
+used ring meet the align value:
+
++-------------------+-----------------------------------+-----------+
+| Descriptor Table | Available Ring (padding) | Used Ring |
++-------------------+-----------------------------------+-----------+
+
+The calculation for total size is as follows:
+
+ #define ALIGN(x) (((x) + align) & ~align)
+ static inline unsigned vring_size(unsigned int num)
+ {
+ return ALIGN(sizeof(struct vring_desc)*num
+ + sizeof(u16)*(3 + num))
+ + ALIGN(sizeof(u16)*3 + sizeof(struct vring_used_elem)*num);
+ }
+
2.3.3.2.2. Communicating Status Information
-------------------------------------------