On Tue, Jun 09, 2020 at 04:43:42PM -0500, Jonathon Jongsma wrote:
Mediated devices support arbitrary vendor-specific attributes that
can
be attached to a mediated device. These attributes are ordered, and are
written to sysfs in order after a device is created. This patch adds
support for these attributes to the mdev data types and XML schema.
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
docs/formatnode.html.in | 7 +++++
docs/schemas/nodedev.rng | 6 ++++
src/conf/node_device_conf.c | 59 +++++++++++++++++++++++++++++++++++--
src/conf/node_device_conf.h | 2 ++
src/libvirt_private.syms | 2 ++
src/util/virmdev.c | 12 ++++++++
src/util/virmdev.h | 11 +++++++
7 files changed, 96 insertions(+), 3 deletions(-)
diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in
index 76eae928de..a46b73254b 100644
--- a/docs/formatnode.html.in
+++ b/docs/formatnode.html.in
@@ -393,6 +393,13 @@
which holds the IOMMU group number the mediated device belongs
to.
</dd>
+ <dt><code>attr</code></dt>
+ <dd>
+ This optional element can occur multiple times. It represents a
+ vendor-specific attribute that is used to configure this
+ mediated device. It has two required attributes:
+ <code>name</code> and <code>value</code>.
+ </dd>
</dl>
</dd>
<dt><code>ccw</code></dt>
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index fe6ffa0b53..a1ce09af54 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -634,6 +634,12 @@
<ref name='unsignedInt'/>
</attribute>
</element>
+ <zeroOrMore>
+ <element name="attr">
+ <attribute name="name"/>
+ <attribute name="value"/>
+ </element>
+ </zeroOrMore>
Only contextually related, but this patch should be preceded by one that makes
iommugroup an optional element (this change would have to go to the parser as
well). Since before this series, mdev XMLs were either not internally parsed
at all or it would have come from inside libvirt, I'm saying this because even
though we wouldn't break backwards compatibility, because we'd be relaxing the
RNG and parser (which is ok), but I'd still like to see that change to take
effect before this series is fully applied.
With Michal's comments:
Reviewed-by: Erik Skultety <eskultet(a)redhat.com>