KVM Not Starting After Upgrade On QEMU

Known Issue: Upgrading from QEMU 3.10 to 4.2.1 can prevent existing KVM guests from starting on Oracle Linux 7.

Description:

When upgrading a KVM host from QEMU version 3.10 to version 4.2.1 a libvirt server error appears that prevents KVM guests on an Oracle Linux 7 host from starting.

For example, an error similar to the following appears:

Upgrade qemu-3.1.0-7.el7.x86_64 to qemu-4.2.1-4.el7.x86_64, kvm can not be
started, got below libvirt service error:

Dec 21 15:10:48 ca-ex05db01.us.oracle.com libvirtd[23588]: Unable to read
from monitor: Connection reset by peer
Dec 21 15:10:48 ca-ex05db01.us.oracle.com libvirtd[23588]: internal error:
qemu unexpectedly closed the monitor: 2020-12-21T23:10:48.306929Z
qemu-system-x86_64: We need to set caching-mode=on for intel-iommu to enable
device assignment with IOMMU protection.
Dec 21 15:10:52 ca-ex05db01.us.oracle.com libvirtd[23588]: internal error:
Failed to autostart VM 'ca-ex05db01vm01.us.oracle.com': internal error: qemu
unexpectedly closed the monitor: 2020-12-21T23:10:48.306929Z
qemu-system-x86_64: We need to set caching-mode=on for intel-iommu to enable
device assignment with IOMMU protection.
Dec 21 15:10:52 ca-ex05db01.us.oracle.com libvirtd[23588]: nl_recv returned
with error: No buffer space available
Workaround:

To work around this issue so that KVM guests can run the updated qemu version, edit the XML file of each KVM guest, adding the caching_mode='on' parameter to the iommu model='intel' section for each driver sub-element, as shown in the following example:

For example:

<iommu model='intel'>
      <driver aw_bits='48' caching_mode='on'/>
    </iommu>

(Bug ID 32312933)