libvirt/d12781b4-conf-iommu-cache-mode-attr.patch
James Fehlig 8f756c33df Accepting request 495125 from home:jfehlig:branches:Virtualization
- qemu: add support for 288 VCPUS
  aeda1b8c-qemu-no-error-shutdown.patch,
  8023b21a-conf-ioapic.patch,
  6b5c6314-qemu-irqchip.patch,
  2020e2c6-conf-intremap.patch,
  04028a9d-qemu-intremap.patch,
  d12781b4-conf-iommu-cache-mode-attr.patch,
  a5691448-qemu-iommu-cache-mode.patch,
  3a276c65-conf-iommu-def-stability-check.patch,
  935d927a-conf-iommu-ABI-stability-check.patch
  FATE#321335
- revert commit 2841e675: qemu: propagate bridge MTU into qemu
  "host_mtu"
  revert-2841e675-mtu.patch
  bsc#1037774

OBS-URL: https://build.opensuse.org/request/show/495125
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=602
2017-05-15 23:02:52 +00:00

223 lines
8.6 KiB
Diff

commit d12781b47eb0c9f3a498d88b632c327aa08aaf8a
Author: Ján Tomko <jtomko@redhat.com>
Date: Fri Mar 17 08:27:49 2017 +0100
conf: add caching_mode attribute to iommu device
Add a new attribute to control the caching mode.
https://bugzilla.redhat.com/show_bug.cgi?id=1427005
Index: libvirt-3.3.0/docs/formatdomain.html.in
===================================================================
--- libvirt-3.3.0.orig/docs/formatdomain.html.in
+++ libvirt-3.3.0/docs/formatdomain.html.in
@@ -7427,6 +7427,15 @@ qemu-kvm -net nic,model=? /dev/null
<span class="since">Since 3.4.0</span> (QEMU/KVM only)
</p>
</dd>
+ <dt><code>caching_mode</code></dt>
+ <dd>
+ <p>
+ The <code>caching_mode</code> attribute with possible values
+ <code>on</code> and <code>off</code> can be used to
+ turn on the VT-d caching mode (useful for assigned devices).
+ <span class="since">Since 3.4.0</span> (QEMU/KVM only)
+ </p>
+ </dd>
</dl>
</dd>
</dl>
Index: libvirt-3.3.0/docs/schemas/domaincommon.rng
===================================================================
--- libvirt-3.3.0.orig/docs/schemas/domaincommon.rng
+++ libvirt-3.3.0/docs/schemas/domaincommon.rng
@@ -3954,6 +3954,11 @@
<ref name="virOnOff"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="caching_mode">
+ <ref name="virOnOff"/>
+ </attribute>
+ </optional>
</element>
</optional>
</element>
Index: libvirt-3.3.0/src/conf/domain_conf.c
===================================================================
--- libvirt-3.3.0.orig/src/conf/domain_conf.c
+++ libvirt-3.3.0/src/conf/domain_conf.c
@@ -14176,6 +14176,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr nod
iommu->intremap = val;
}
+ VIR_FREE(tmp);
+ if ((tmp = virXPathString("string(./driver/@caching_mode)", ctxt))) {
+ if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR, _("unknown caching_mode value: %s"), tmp);
+ goto cleanup;
+ }
+ iommu->caching_mode = val;
+ }
+
ret = iommu;
iommu = NULL;
@@ -24143,9 +24152,18 @@ virDomainIOMMUDefFormat(virBufferPtr buf
virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2);
- if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
- virBufferAsprintf(&childBuf, "<driver intremap='%s'/>\n",
- virTristateSwitchTypeToString(iommu->intremap));
+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT ||
+ iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAddLit(&childBuf, "<driver");
+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&childBuf, " intremap='%s'",
+ virTristateSwitchTypeToString(iommu->intremap));
+ }
+ if (iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&childBuf, " caching_mode='%s'",
+ virTristateSwitchTypeToString(iommu->caching_mode));
+ }
+ virBufferAddLit(&childBuf, "/>\n");
}
virBufferAsprintf(buf, "<iommu model='%s'",
Index: libvirt-3.3.0/src/conf/domain_conf.h
===================================================================
--- libvirt-3.3.0.orig/src/conf/domain_conf.h
+++ libvirt-3.3.0/src/conf/domain_conf.h
@@ -2210,6 +2210,7 @@ typedef enum {
struct _virDomainIOMMUDef {
virDomainIOMMUModel model;
virTristateSwitch intremap;
+ virTristateSwitch caching_mode;
};
/*
* Guest VM main configuration
Index: libvirt-3.3.0/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml
===================================================================
--- /dev/null
+++ libvirt-3.3.0/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml
@@ -0,0 +1,50 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+ <model name='i82801b11-bridge'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+ </controller>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='2'/>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='pci' index='3' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='3' port='0x10'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </controller>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-ehci1'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
+ </controller>
+ <interface type='user'>
+ <mac address='52:54:00:ab:0c:5c'/>
+ <model type='rtl8139'/>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ <iommu model='intel'>
+ <driver intremap='on' caching_mode='on'/>
+ </iommu>
+ </devices>
+</domain>
Index: libvirt-3.3.0/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml
===================================================================
--- /dev/null
+++ libvirt-3.3.0/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml
@@ -0,0 +1,50 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+ <model name='i82801b11-bridge'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+ </controller>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='2'/>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='pci' index='3' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='3' port='0x10'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </controller>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-ehci1'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
+ </controller>
+ <interface type='user'>
+ <mac address='52:54:00:ab:0c:5c'/>
+ <model type='rtl8139'/>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ <iommu model='intel'>
+ <driver intremap='on' caching_mode='on'/>
+ </iommu>
+ </devices>
+</domain>
Index: libvirt-3.3.0/tests/qemuxml2xmltest.c
===================================================================
--- libvirt-3.3.0.orig/tests/qemuxml2xmltest.c
+++ libvirt-3.3.0/tests/qemuxml2xmltest.c
@@ -1123,6 +1123,7 @@ mymain(void)
QEMU_CAPS_MACHINE_OPT,
QEMU_CAPS_MACHINE_IOMMU);
DO_TEST("intel-iommu-ioapic", NONE);
+ DO_TEST("intel-iommu-caching-mode", NONE);
DO_TEST("cpu-check-none", NONE);
DO_TEST("cpu-check-partial", NONE);