From 22c616e2c3dcf2e1db58af038a39bea33919fb8c Mon Sep 17 00:00:00 2001
From: rusty <rusty@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>
Date: Wed, 26 Feb 2014 03:16:44 +0000
Subject: PCI: better document driver and device requirements

Feedback:
10) 4.1.3.1.2 Queue Vector Configuration
Some of the information from section 8.4 needs to be moved to
here, for example that the device may have an MSI-X table size
other than 2048.
Otherwise, this reads as though the MSI-X table must always have
2048 entries.

11) Please explicitly describe the device behavior when writing
a vector value beyond the MSI-X table size.

Address these comments.

Cc: Arun Subbarao <asubbarao@lnxw.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@255 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652
---
 content.tex | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

(limited to 'content.tex')

diff --git a/content.tex b/content.tex
index 797e8f2..d68511a 100644
--- a/content.tex
+++ b/content.tex
@@ -1329,12 +1329,28 @@ driver attempts to drive them:
    of BAR0 by presenting zeroes on every BAR and ignoring writes.
 \end{enumerate}
 
-\paragraph{Queue Vector Configuration}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Device Initialization / Queue Vector Configuration}
+\paragraph{MSI-X Vector Configuration}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Device Initialization / MSI-X Vector Configuration}
 
 When MSI-X capability is present and enabled in the device
 (through standard PCI configuration space) \field{config_msix_vector} and \field{queue_msix_vector} are used to map configuration change and queue
 interrupts to MSI-X vectors. In this case, the ISR Status is unused.
 
+A device that has an MSI-X capability SHOULD support at least 2
+and at most 0x800 MSI-X vectors.
+Device MUST report the number of vectors supported in
+\field{Table Size} in the MSI-X Capability as specified in
+\hyperref[intro:PCI]{[PCI]}.
+Driver MUST support device with any MSI-X Table Size 0 to 0x7FF.
+Driver MAY fall back on using INT\#x interrupts for a device
+which only supports one MSI-X vector (MSI-X Table Size = 0).
+
+Driver MAY intepret the Table Size as a hint from the device
+for the suggested number of MSI-X vectors to use.
+Therefore, devices SHOULD restrict the reported MSI-X Table Size field
+to a value that might benefit system performance.
+For example, a device which does not expect to send
+interrupts at a high rate might only specify 2 MSI-X vectors.
+
 Writing a valid MSI-X Table entry number, 0 to 0x7FF, to
 \field{config_msix_vector}/\field{queue_msix_vector} maps interrupts triggered
 by the configuration change/selected queue events respectively to
@@ -1347,6 +1363,13 @@ value:
 #define VIRTIO_MSI_NO_VECTOR            0xffff
 \end{lstlisting}
 
+Driver MUST NOT attempt to map an event to a vector
+outside the MSI-X Table supported by the device,
+as reported by \field{Table Size} in the MSI-X Capability.
+Device MUST support mapping any event type to any valid
+vector 0 to MSI-X \field{Table Size}.
+Device MUST support unmapping any event type.
+
 Reading these registers returns vector mapped to a given event,
 or NO_VECTOR if unmapped. All queue and configuration change
 events are unmapped by default.
@@ -1361,6 +1384,10 @@ failure, NO_VECTOR is returned. If a mapping failure is detected,
 the driver MAY retry mapping with fewer vectors, disable MSI-X
 or report device failure.
 
+Devices SHOULD NOT cause mapping an event to vector to fail
+unless it is impossible for the device to satisfy the mapping
+request.
+
 \paragraph{Virtqueue Configuration}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Device Initialization / Virtqueue Configuration}
 
 As a device can have zero or more virtqueues for bulk data
-- 
cgit v1.2.3

