[PATCH 0/8] pci/iommu: Fail early if vfio-pci detected before vIOMMU

Peter Xu posted 8 patches 2 years, 6 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211021104259.57754-1-peterx@redhat.com
Maintainers: Cornelia Huck <cohuck@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, David Hildenbrand <david@redhat.com>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Paul Durrant <paul@xen.org>, Christian Borntraeger <borntraeger@de.ibm.com>, Ani Sinha <ani@anisinha.ca>, Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Eduardo Habkost <ehabkost@redhat.com>, Stefano Stabellini <sstabellini@kernel.org>, Halil Pasic <pasic@linux.ibm.com>, Greg Kurz <groug@kaod.org>, Matthew Rosato <mjrosato@linux.ibm.com>, Igor Mammedov <imammedo@redhat.com>, Eric Farman <farman@linux.ibm.com>, "Michael S. Tsirkin" <mst@redhat.com>, Anthony Perard <anthony.perard@citrix.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Shannon Zhao <shannon.zhaosl@gmail.com>
There is a newer version of this series
hw/arm/virt-acpi-build.c   | 31 ++++++---------
hw/i386/acpi-build.c       | 39 +++++--------------
hw/i386/x86-iommu.c        | 18 +++++++++
hw/pci/pci.c               | 77 +++++++++++++++++++++++++++++---------
hw/pci/pcie.c              |  4 +-
hw/ppc/spapr_pci.c         | 12 +++---
hw/ppc/spapr_pci_nvlink2.c |  7 ++--
hw/ppc/spapr_pci_vfio.c    |  4 +-
hw/s390x/s390-pci-bus.c    |  5 +--
hw/xen/xen_pt.c            |  4 +-
include/hw/pci/pci.h       | 28 +++++++++-----
11 files changed, 132 insertions(+), 97 deletions(-)
[PATCH 0/8] pci/iommu: Fail early if vfio-pci detected before vIOMMU
Posted by Peter Xu 2 years, 6 months ago
This series overrides one previous patchset:

https://lore.kernel.org/qemu-devel/20210818194217.110451-1-peterx@redhat.com/

I started from v1 because obviously it's completely different way of doing the
same thing, hence versioning upon it would be weird.

Patches 1-7 are majorly cleanups for current pci code to finally provide a
clean way to loop over all the pci devices on the system.

Patch 8 uses the last helper pci_for_each_device_all() to loop over all the
devices during x86 vIOMMU realize() function to fail early if e.g. vfio-pci
devices are detected.  Although this is not exactly what Igor suggested but it
should be mostly the same approach, so I kept the Suggested-by credit.

Please review, thanks.

Peter Xu (8):
  pci: Define pci_bus_dev_fn type
  pci: Export pci_for_each_device_under_bus*()
  pci: Use pci_for_each_device_under_bus*()
  pci: Define pci_bus_fn/pci_bus_ret_fn type
  pci: Add pci_for_each_root_bus()
  pci: Use pci_for_each_root_bus() in current code
  pci: Add pci_for_each_device_all()
  x86-iommu: Fail early if vIOMMU specified after vfio-pci

 hw/arm/virt-acpi-build.c   | 31 ++++++---------
 hw/i386/acpi-build.c       | 39 +++++--------------
 hw/i386/x86-iommu.c        | 18 +++++++++
 hw/pci/pci.c               | 77 +++++++++++++++++++++++++++++---------
 hw/pci/pcie.c              |  4 +-
 hw/ppc/spapr_pci.c         | 12 +++---
 hw/ppc/spapr_pci_nvlink2.c |  7 ++--
 hw/ppc/spapr_pci_vfio.c    |  4 +-
 hw/s390x/s390-pci-bus.c    |  5 +--
 hw/xen/xen_pt.c            |  4 +-
 include/hw/pci/pci.h       | 28 +++++++++-----
 11 files changed, 132 insertions(+), 97 deletions(-)

-- 
2.32.0