Skip to content

enable iommu with -device

Marcel Apfelbaum qemu-devel 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest5 patches 6 repliesIn review
  2. v44 patches 4 repliesSuperseded
  3. v34 patches 5 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches13 repliesSuperseded
v1 RFC2 patches7 repliesSuperseded

Changes in v5 from the cover letter

- patch 1/5 - new patch solving make check mac99 issue. (Michael)
- patch 4/5 - fix commit message (Paolo)

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5hw/ppc: realize the PCI root bus as part of mac99 inithw/ppc/mac_newworld.c+1 -03 replies
2/5hw/pci: delay bus_master_enable_region initializationhw/pci/pci.c include/hw/pci/pci_bus.h include/sysemu/sysemu.h +1 more+40 -90 replies
3/5q35: allow dynamic sysbushw/i386/pc_q35.c hw/pci-bridge/pci_expander_bridge.c hw/pci-host/piix.c +1 more+7 -00 replies
4/5hw/iommu: enable iommu with -devicehw/i386/intel_iommu.c hw/i386/pc_q35.c hw/pci-host/q35.c+17 -170 replies
5/5machine: remove iommu propertyhw/core/machine.c hw/pci-host/q35.c include/hw/pci-host/q35.h +1 more+0 -363 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchDavid Gibson
1/5A-b
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [Qemu-devel] [PATCH V5 0/5] enable iommu with -device

Create the iommu device with '-device intel-iommu' instead of '-machine,iommu=on'.

The device is part of the machine properties because we wanted to ensure is created before any other PCI device.

The alternative is to skip the bus_master_enable_region at the time the device is created. We can create this region at machine_done phase. (patch 2)

Then we need to enable sysbus devices(*) for PC machines (patch 3), since intel-iommu is a sysbus device.

Patch 4 moves the IOMMU init proces into iommu's realize function and allows the device creation in both ways.

Finally patch 5 removes the iommu machine property.

v4->v5:
- patch 1/5 - new patch solving make check mac99 issue. (Michael)
- patch 4/5 - fix commit message (Paolo)

v3 -> v4:
- Rebased on mst/pci tree (Michael).

v2 -> v3:
- Add machine_done notifier in pci_bus realize and remove it unrealize (Paolo).
- Add comments for 'cannot_instantiate_with_device_add_yet' (Markus).
- Split adding the -device iommu support and removing the iommu machine property (Michael).
- Use pci_setup_iommu as before (Peter)
- Mark intel-iommu as not hot-pluggable (Peter)
- Rebased on master

v1 -> v2:
- Enable bus_master also on init if the guest OS already booted to enable hotplug (Paolo).
- Add a machine_done notifier to PCIBus instead of adding functionality
for q35 machine_done callback. The main reason is we don't want to replicate the code for all platforms that support PCI and is also cleaner this way.
- Added 'cannot_instantiate_with_device_add_yet' to sysbus devices that lead to crashes if added with -device.
- Rebased on master

(*) Creates a new problem since we have now a bunch of
new devices that can be created with -device on Q35:
name "q35-pcihost", bus System
name "sysbus-ohci", bus System, desc "OHCI USB Controller" name "allwinner-ahci", bus System
name "cfi.pflash01", bus System
name "esp", bus System
name "SUNW,fdtwo", bus System
name "sysbus-ahci", bus System
name "sysbus-fdc", bus System
name "vfio-amd-xgbe", bus System, desc "VFIO AMD XGBE" name "vfio-calxeda-xgmac", bus System, desc "VFIO Calxeda XGMAC" name "virtio-mmio", bus System
name "fw_cfg", bus System
name "fw_cfg_io", bus System
name "fw_cfg_mem", bus System
name "generic-sdhci", bus System
name "hpet", bus System
name "i440FX-pcihost", bus System
name "intel-iommu", bus System
name "ioapic", bus System
name "isabus-bridge", bus System
name "kvm-ioapic", bus System
name "kvmclock", bus System
name "kvmvapic", bus System
name "pxb-host", bus System

Took care of the ones creating immediate issues (like crashes) by marking them as 'cannot_instantiate_with_device_add_yet'. I didn't mark them all because:
- libvirt will mask them anyway
- some of them have already a "protection" in place
- it is possible that some of them can be actually used with -device on other platform.
- those are not 'interesting' scenarios.
If somebody spots devices in the list that cannot be added with -device on any platform please let me know and I'll mark them.

Thanks,
Marcel

Marcel Apfelbaum (5):
hw/ppc: realize the PCI root bus as part of mac99 init hw/pci: delay bus_master_enable_region initialization
q35: allow dynamic sysbus
hw/iommu: enable iommu with -device
machine: remove iommu property

 hw/core/machine.c                   | 20 ------------------
 hw/i386/intel_iommu.c               | 16 +++++++++++++++
 hw/i386/pc_q35.c                    |  2 +-
 hw/pci-bridge/pci_expander_bridge.c |  2 ++
 hw/pci-host/piix.c                  |  2 ++
 hw/pci-host/q35.c                   | 31 +++-------------------------
 hw/pci/pci.c                        | 41 +++++++++++++++++++++++++++++--------
 hw/ppc/mac_newworld.c               |  1 +
 include/hw/pci-host/q35.h           |  1 -
 include/hw/pci/pci_bus.h            |  2 ++
 include/sysemu/sysemu.h             |  1 +
 qemu-options.hx                     |  3 ---
 vl.c                                |  5 +++++
 13 files changed, 65 insertions(+), 62 deletions(-)
Signature · 1 line
2.4.3