From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGL80-0000LK-Pw for qemu-devel@nongnu.org; Fri, 24 Jun 2016 03:02:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGL7u-0005is-NB for qemu-devel@nongnu.org; Fri, 24 Jun 2016 03:02:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGL7u-0005ij-En for qemu-devel@nongnu.org; Fri, 24 Jun 2016 03:02:06 -0400 References: <1465888776-25985-1-git-send-email-marcel@redhat.com> <20160624084633-mutt-send-email-mst@redhat.com> From: Marcel Apfelbaum Message-ID: <576CDAE9.3070502@redhat.com> Date: Fri, 24 Jun 2016 10:02:01 +0300 MIME-Version: 1.0 In-Reply-To: <20160624084633-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 0/4] enable iommu with -device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, ehabkost@redhat.com, peterx@redhat.com, davidkiarie4@gmail.com, jan.kiszka@web.de, bd.aviv@gmail.com, alex.williamson@redhat.com, armbru@redhat.com On 06/24/2016 08:47 AM, Michael S. Tsirkin wrote: > On Tue, Jun 14, 2016 at 10:19:32AM +0300, Marcel Apfelbaum wrote: >> 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 1) >> >> Then we need to enable sysbus devices(*) for PC machines (patch 2), >> since intel-iommu is a sysbus device. >> >> Patch 3 moves the IOMMU init proces into iommu's realize function >> and allows the device creation in both ways. > > > > This breaks make check on x86: > > GTESTER check-qtest-ppc64 > Broken pipe > GTester: last random seed: R02Sf26cb511ed533726cf1afef21a00bde4 > /scm/qemu/tests/Makefile.include:668: recipe for target > 'check-qtest-ppc64' failed > make: *** [check-qtest-ppc64] Error 1 > I am sorry for that. I'll take care of it and re-post. Thanks, Marcel > >> Finally patch 4 removes the iommu machine property. >> >> 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 (4): >> 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 +++++++++++++++++++++++++++++-------- >> 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 +++++ >> 12 files changed, 64 insertions(+), 62 deletions(-) >> >> -- >> 2.4.3