|
|
6d3351 |
From 3b7b827deb9eb7f43f548aabd27c300ae24c7db3 Mon Sep 17 00:00:00 2001
|
|
|
6d3351 |
Message-Id: <3b7b827deb9eb7f43f548aabd27c300ae24c7db3@dist-git>
|
|
|
6d3351 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
6d3351 |
Date: Tue, 16 May 2017 10:44:56 +0200
|
|
|
6d3351 |
Subject: [PATCH] conf: add caching_mode attribute to iommu device
|
|
|
6d3351 |
MIME-Version: 1.0
|
|
|
6d3351 |
Content-Type: text/plain; charset=UTF-8
|
|
|
6d3351 |
Content-Transfer-Encoding: 8bit
|
|
|
6d3351 |
|
|
|
6d3351 |
Add a new attribute to control the caching mode.
|
|
|
6d3351 |
|
|
|
6d3351 |
https://bugzilla.redhat.com/show_bug.cgi?id=1427005
|
|
|
6d3351 |
(cherry picked from commit d12781b47eb0c9f3a498d88b632c327aa08aaf8a)
|
|
|
6d3351 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
6d3351 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d3351 |
---
|
|
|
6d3351 |
docs/formatdomain.html.in | 9 ++++
|
|
|
6d3351 |
docs/schemas/domaincommon.rng | 5 +++
|
|
|
6d3351 |
src/conf/domain_conf.c | 24 +++++++++--
|
|
|
6d3351 |
src/conf/domain_conf.h | 1 +
|
|
|
6d3351 |
.../qemuxml2argv-intel-iommu-caching-mode.xml | 50 ++++++++++++++++++++++
|
|
|
6d3351 |
.../qemuxml2xmlout-intel-iommu-caching-mode.xml | 1 +
|
|
|
6d3351 |
tests/qemuxml2xmltest.c | 1 +
|
|
|
6d3351 |
7 files changed, 88 insertions(+), 3 deletions(-)
|
|
|
6d3351 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml
|
|
|
6d3351 |
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
|
|
6d3351 |
index 41b8bfb50..43a75c1ee 100644
|
|
|
6d3351 |
--- a/docs/formatdomain.html.in
|
|
|
6d3351 |
+++ b/docs/formatdomain.html.in
|
|
|
6d3351 |
@@ -7424,6 +7424,15 @@ qemu-kvm -net nic,model=? /dev/null
|
|
|
6d3351 |
Since 3.4.0 (QEMU/KVM only)
|
|
|
6d3351 |
|
|
|
6d3351 |
|
|
|
6d3351 |
+ caching_mode
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ The caching_mode attribute with possible values
|
|
|
6d3351 |
+ on and off can be used to
|
|
|
6d3351 |
+ turn on the VT-d caching mode (useful for assigned devices).
|
|
|
6d3351 |
+ Since 3.4.0 (QEMU/KVM only)
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+
|
|
|
6d3351 |
|
|
|
6d3351 |
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
|
|
6d3351 |
index a400d961b..12ccbd4e2 100644
|
|
|
6d3351 |
--- a/docs/schemas/domaincommon.rng
|
|
|
6d3351 |
+++ b/docs/schemas/domaincommon.rng
|
|
|
6d3351 |
@@ -3900,6 +3900,11 @@
|
|
|
6d3351 |
<ref name="virOnOff"/>
|
|
|
6d3351 |
</attribute>
|
|
|
6d3351 |
</optional>
|
|
|
6d3351 |
+ <optional>
|
|
|
6d3351 |
+ <attribute name="caching_mode">
|
|
|
6d3351 |
+ <ref name="virOnOff"/>
|
|
|
6d3351 |
+ </attribute>
|
|
|
6d3351 |
+ </optional>
|
|
|
6d3351 |
</element>
|
|
|
6d3351 |
</optional>
|
|
|
6d3351 |
</element>
|
|
|
6d3351 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
6d3351 |
index 45473f65b..e77b542f3 100644
|
|
|
6d3351 |
--- a/src/conf/domain_conf.c
|
|
|
6d3351 |
+++ b/src/conf/domain_conf.c
|
|
|
6d3351 |
@@ -14167,6 +14167,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
|
|
|
6d3351 |
iommu->intremap = val;
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
+ VIR_FREE(tmp);
|
|
|
6d3351 |
+ if ((tmp = virXPathString("string(./driver/@caching_mode)", ctxt))) {
|
|
|
6d3351 |
+ if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
|
|
|
6d3351 |
+ virReportError(VIR_ERR_XML_ERROR, _("unknown caching_mode value: %s"), tmp);
|
|
|
6d3351 |
+ goto cleanup;
|
|
|
6d3351 |
+ }
|
|
|
6d3351 |
+ iommu->caching_mode = val;
|
|
|
6d3351 |
+ }
|
|
|
6d3351 |
+
|
|
|
6d3351 |
ret = iommu;
|
|
|
6d3351 |
iommu = NULL;
|
|
|
6d3351 |
|
|
|
6d3351 |
@@ -24114,9 +24123,18 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
|
|
|
6d3351 |
|
|
|
6d3351 |
virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2);
|
|
|
6d3351 |
|
|
|
6d3351 |
- if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
|
|
|
6d3351 |
- virBufferAsprintf(&childBuf, "<driver intremap='%s'/>\n",
|
|
|
6d3351 |
- virTristateSwitchTypeToString(iommu->intremap));
|
|
|
6d3351 |
+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT ||
|
|
|
6d3351 |
+ iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
|
|
|
6d3351 |
+ virBufferAddLit(&childBuf, "
|
|
|
6d3351 |
+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
|
|
|
6d3351 |
+ virBufferAsprintf(&childBuf, " intremap='%s'",
|
|
|
6d3351 |
+ virTristateSwitchTypeToString(iommu->intremap));
|
|
|
6d3351 |
+ }
|
|
|
6d3351 |
+ if (iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
|
|
|
6d3351 |
+ virBufferAsprintf(&childBuf, " caching_mode='%s'",
|
|
|
6d3351 |
+ virTristateSwitchTypeToString(iommu->caching_mode));
|
|
|
6d3351 |
+ }
|
|
|
6d3351 |
+ virBufferAddLit(&childBuf, "/>\n");
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
virBufferAsprintf(buf, "
|
|
|
6d3351 |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
6d3351 |
index 8eb422a57..825158a7d 100644
|
|
|
6d3351 |
--- a/src/conf/domain_conf.h
|
|
|
6d3351 |
+++ b/src/conf/domain_conf.h
|
|
|
6d3351 |
@@ -2210,6 +2210,7 @@ typedef enum {
|
|
|
6d3351 |
struct _virDomainIOMMUDef {
|
|
|
6d3351 |
virDomainIOMMUModel model;
|
|
|
6d3351 |
virTristateSwitch intremap;
|
|
|
6d3351 |
+ virTristateSwitch caching_mode;
|
|
|
6d3351 |
};
|
|
|
6d3351 |
/*
|
|
|
6d3351 |
* Guest VM main configuration
|
|
|
6d3351 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml
|
|
|
6d3351 |
new file mode 100644
|
|
|
6d3351 |
index 000000000..5f3384da7
|
|
|
6d3351 |
--- /dev/null
|
|
|
6d3351 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml
|
|
|
6d3351 |
@@ -0,0 +1,50 @@
|
|
|
6d3351 |
+<domain type='qemu'>
|
|
|
6d3351 |
+ <name>QEMUGuest1</name>
|
|
|
6d3351 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
6d3351 |
+ <memory unit='KiB'>219100</memory>
|
|
|
6d3351 |
+ <currentMemory unit='KiB'>219100</currentMemory>
|
|
|
6d3351 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
6d3351 |
+ <os>
|
|
|
6d3351 |
+ <type arch='x86_64' machine='q35'>hvm</type>
|
|
|
6d3351 |
+ <boot dev='hd'/>
|
|
|
6d3351 |
+ </os>
|
|
|
6d3351 |
+ <clock offset='utc'/>
|
|
|
6d3351 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
6d3351 |
+ <on_reboot>restart</on_reboot>
|
|
|
6d3351 |
+ <on_crash>destroy</on_crash>
|
|
|
6d3351 |
+ <devices>
|
|
|
6d3351 |
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
|
|
6d3351 |
+ <controller type='pci' index='0' model='pcie-root'/>
|
|
|
6d3351 |
+ <controller type='pci' index='1' model='dmi-to-pci-bridge'>
|
|
|
6d3351 |
+ <model name='i82801b11-bridge'/>
|
|
|
6d3351 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
|
|
|
6d3351 |
+ </controller>
|
|
|
6d3351 |
+ <controller type='pci' index='2' model='pci-bridge'>
|
|
|
6d3351 |
+ <model name='pci-bridge'/>
|
|
|
6d3351 |
+ <target chassisNr='2'/>
|
|
|
6d3351 |
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
|
|
6d3351 |
+ </controller>
|
|
|
6d3351 |
+ <controller type='pci' index='3' model='pcie-root-port'>
|
|
|
6d3351 |
+ <model name='ioh3420'/>
|
|
|
6d3351 |
+ <target chassis='3' port='0x10'/>
|
|
|
6d3351 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
|
|
6d3351 |
+ </controller>
|
|
|
6d3351 |
+ <controller type='sata' index='0'>
|
|
|
6d3351 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
|
|
|
6d3351 |
+ </controller>
|
|
|
6d3351 |
+ <controller type='usb' index='0' model='ich9-ehci1'>
|
|
|
6d3351 |
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
|
|
|
6d3351 |
+ </controller>
|
|
|
6d3351 |
+ <interface type='user'>
|
|
|
6d3351 |
+ <mac address='52:54:00:ab:0c:5c'/>
|
|
|
6d3351 |
+ <model type='rtl8139'/>
|
|
|
6d3351 |
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
|
|
|
6d3351 |
+ </interface>
|
|
|
6d3351 |
+ <input type='mouse' bus='ps2'/>
|
|
|
6d3351 |
+ <input type='keyboard' bus='ps2'/>
|
|
|
6d3351 |
+ <memballoon model='none'/>
|
|
|
6d3351 |
+ <iommu model='intel'>
|
|
|
6d3351 |
+ <driver intremap='on' caching_mode='on'/>
|
|
|
6d3351 |
+ </iommu>
|
|
|
6d3351 |
+ </devices>
|
|
|
6d3351 |
+</domain>
|
|
|
6d3351 |
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml
|
|
|
6d3351 |
new file mode 120000
|
|
|
6d3351 |
index 000000000..d971a35dc
|
|
|
6d3351 |
--- /dev/null
|
|
|
6d3351 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml
|
|
|
6d3351 |
@@ -0,0 +1 @@
|
|
|
6d3351 |
+../qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml
|
|
|
6d3351 |
\ No newline at end of file
|
|
|
6d3351 |
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
|
|
6d3351 |
index 0482ad9cb..e1938421a 100644
|
|
|
6d3351 |
--- a/tests/qemuxml2xmltest.c
|
|
|
6d3351 |
+++ b/tests/qemuxml2xmltest.c
|
|
|
6d3351 |
@@ -1129,6 +1129,7 @@ mymain(void)
|
|
|
6d3351 |
QEMU_CAPS_MACHINE_OPT,
|
|
|
6d3351 |
QEMU_CAPS_MACHINE_IOMMU);
|
|
|
6d3351 |
DO_TEST("intel-iommu-ioapic", NONE);
|
|
|
6d3351 |
+ DO_TEST("intel-iommu-caching-mode", NONE);
|
|
|
6d3351 |
|
|
|
6d3351 |
DO_TEST("cpu-check-none", NONE);
|
|
|
6d3351 |
DO_TEST("cpu-check-partial", NONE);
|
|
|
6d3351 |
--
|
|
|
6d3351 |
2.13.0
|
|
|
6d3351 |
|