qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel]  [PATCH v2 0/3]  enable iommu with -device
@ 2016-06-02 20:15 Marcel Apfelbaum
  2016-06-02 20:15 ` [Qemu-devel] [PATCH v2 1/3] hw/pci: delay bus_master_enable_region initialization Marcel Apfelbaum
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Marcel Apfelbaum @ 2016-06-02 20:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: marcel, mst, pbonzini, ehabkost, peterx, davidkiarie4, jan.kiszka,
	bd.aviv, alex.williamson

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 it 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 1)

Patch 2 moves the init proces into iommu's realize function.

Then we need to enable sysbus devices for PC machines (patch 3).

This 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.


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

Thanks,
Marcel

Marcel Apfelbaum (2):
  hw/pci: delay bus_master_enable_region initialization
  hw/iommu: enable iommu with -device
  q35: allow dynamic sysbus

 hw/core/machine.c                   | 20 ----------------
 hw/i386/intel_iommu.c               | 17 ++++++++++++++
 hw/i386/pc_q35.c                    |  1 +
 hw/pci-bridge/pci_expander_bridge.c |  1 +
 hw/pci-host/piix.c                  |  1 +
 hw/pci-host/q35.c                   | 29 +----------------------
 hw/pci/pci.c                        | 46 +++++++++++++++++++++++++++++--------
 include/hw/pci/pci_bus.h            |  2 ++
 qemu-options.hx                     |  3 ---
 9 files changed, 59 insertions(+), 61 deletions(-)

-- 
2.4.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-06-13 13:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-02 20:15 [Qemu-devel] [PATCH v2 0/3] enable iommu with -device Marcel Apfelbaum
2016-06-02 20:15 ` [Qemu-devel] [PATCH v2 1/3] hw/pci: delay bus_master_enable_region initialization Marcel Apfelbaum
2016-06-08 11:16   ` Paolo Bonzini
2016-06-08 11:36     ` Marcel Apfelbaum
2016-06-02 20:15 ` [Qemu-devel] [PATCH v2 2/3] hw/iommu: enable iommu with -device Marcel Apfelbaum
2016-06-03 16:07   ` Michael S. Tsirkin
2016-06-05  8:46     ` Marcel Apfelbaum
2016-06-05  9:59       ` Michael S. Tsirkin
2016-06-05 10:21         ` Marcel Apfelbaum
2016-06-12  4:27   ` Peter Xu
2016-06-13 10:20     ` Marcel Apfelbaum
2016-06-13 13:04       ` Peter Xu
2016-06-02 20:15 ` [Qemu-devel] [PATCH v2 3/3] q35: allow dynamic sysbus Marcel Apfelbaum
2016-06-03  6:33   ` Markus Armbruster
2016-06-03  6:47     ` Marcel Apfelbaum
2016-06-08  2:56   ` Peter Xu
2016-06-08 11:18     ` Marcel Apfelbaum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).