]> git.proxmox.com Git - mirror_qemu.git/commit
intel_iommu: Sanity check vfio-pci config on machine init done
authorPeter Xu <peterx@redhat.com>
Mon, 16 Sep 2019 08:07:15 +0000 (16:07 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 16 Sep 2019 10:57:24 +0000 (06:57 -0400)
commit28cf553afeb29b0c4f339c600171552a72a68cb7
tree45beade86683e74af6af773b0b08d66de75c8c5b
parentb8487a357855e78957d8c9bddbbcf58548e1aa51
intel_iommu: Sanity check vfio-pci config on machine init done

This check was previously only happened when the IOMMU is enabled in
the guest.  It was always too late because the enabling of IOMMU
normally only happens during the boot of guest OS.  It means that we
can bail out and exit directly during the guest OS boots if the
configuration of devices are not supported.  Or, if the guest didn't
enable vIOMMU at all, then the user can use the guest normally but as
long as it reconfigure the guest OS to enable the vIOMMU then reboot,
the user will see the panic right after the reset when the next boot
starts.

Let's make this failure even earlier so that we force the user to use
caching-mode for vfio-pci devices when with the vIOMMU.  So the user
won't get surprise at least during execution of the guest, which seems
a bit nicer.

This will affect some user who didn't enable vIOMMU in the guest OS
but was using vfio-pci and the vtd device in the past.  However I hope
it's not a majority because not enabling vIOMMU with the device
attached is actually meaningless.

We still keep the old assertion for safety so far because the hotplug
path could still reach it, so far.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190916080718.3299-2-peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/intel_iommu.c