From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhEKC-0004hs-Ed for qemu-devel@nongnu.org; Wed, 30 Sep 2015 06:09:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhEK9-0004NE-8r for qemu-devel@nongnu.org; Wed, 30 Sep 2015 06:09:24 -0400 References: <1443584920-23015-1-git-send-email-david@gibson.dropbear.id.au> <1443584920-23015-5-git-send-email-david@gibson.dropbear.id.au> From: Thomas Huth Message-ID: <560BB4CC.2050807@redhat.com> Date: Wed, 30 Sep 2015 12:09:16 +0200 MIME-Version: 1.0 In-Reply-To: <1443584920-23015-5-git-send-email-david@gibson.dropbear.id.au> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/4] spapr_pci: Allow VFIO devices to work on the normal PCI host bridge List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , aik@ozlabs.ru, mdroth@linux.vnet.ibm.com Cc: lvivier@redhat.com, alex.williamson@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org On 30/09/15 05:48, David Gibson wrote: > The core VFIO infrastructure more or less allows VFIO devices to work > on any normal guest PCI host bridge (PHB) without extra logic. > However, the "spapr-pci-host-bridge" device (as opposed to the special > "spapr-pci-vfio-host-bridge" device) breaks this by using a partially > KVM accelerated implementation of the guest kernel IOMMU which won't > work with VFIO devices, without additional kernel support. > > This patch allows VFIO devices to work on the spapr-pci-host-bridge, > by having it switch off KVM TCE acceleration when a VFIO device is > added to the PHB (either on startup, or by hotplug). > > Signed-off-by: David Gibson > --- > hw/ppc/spapr_pci.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index cb7c351..55fa8db 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -1083,6 +1083,12 @@ static void spapr_phb_add_pci_device(sPAPRDRConnector *drc, > void *fdt = NULL; > int fdt_start_offset = 0, fdt_size; > > + if (object_dynamic_cast(OBJECT(pdev), "vfio-pci")) { > + sPAPRTCETable *tcet = spapr_tce_find_by_liobn(phb->dma_liobn); > + > + spapr_tce_set_need_vfio(tcet, true); > + } > + > if (dev->hotplugged) { > fdt = create_device_tree(&fdt_size); > fdt_start_offset = spapr_create_pci_child_dt(phb, pdev, fdt, 0); Reviewed-by: Thomas Huth