From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsfgB-0003jb-E0 for qemu-devel@nongnu.org; Wed, 01 Feb 2012 14:17:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsfgA-0007bH-5g for qemu-devel@nongnu.org; Wed, 01 Feb 2012 14:17:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rsfg9-0007b7-VJ for qemu-devel@nongnu.org; Wed, 01 Feb 2012 14:17:14 -0500 Message-ID: <1328123825.6937.227.camel@bling.home> From: Alex Williamson Date: Wed, 01 Feb 2012 12:17:05 -0700 In-Reply-To: <1328071614-8320-4-git-send-email-david@gibson.dropbear.id.au> References: <1328071614-8320-1-git-send-email-david@gibson.dropbear.id.au> <1328071614-8320-4-git-send-email-david@gibson.dropbear.id.au> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: kvm@vger.kernel.org, aik@ozlabs.ru, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, joerg.roedel@amd.com, dwmw2@infradead.org On Wed, 2012-02-01 at 15:46 +1100, David Gibson wrote: > This patch adds code to the code for the powernv platform to create > and populate isolation groups on hardware using the p7ioc (aka IODA) PCI host > bridge used on some IBM POWER systems. > > Signed-off-by: Alexey Kardashevskiy > Signed-off-by: David Gibson > --- > arch/powerpc/platforms/powernv/pci-ioda.c | 18 ++++++++++++++++-- > arch/powerpc/platforms/powernv/pci.h | 6 ++++++ > 2 files changed, 22 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c > index 5e155df..4648475 100644 > --- a/arch/powerpc/platforms/powernv/pci-ioda.c > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -877,6 +878,9 @@ static void __devinit pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, > set_iommu_table_base(&dev->dev, &pe->tce32_table); > if (dev->subordinate) > pnv_ioda_setup_bus_dma(pe, dev->subordinate); > +#ifdef CONFIG_DEVICE_ISOLATION > + device_isolation_dev_add(&pe->di_group, &dev->dev); > +#endif > } > } > > @@ -957,11 +961,21 @@ static void __devinit pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, > } > iommu_init_table(tbl, phb->hose->node); > > - if (pe->pdev) > +#ifdef CONFIG_DEVICE_ISOLATION > + BUG_ON(device_isolation_group_init(&pe->di_group, "ioda:rid%x-pe%x", > + pe->rid, pe->pe_number) < 0); > +#endif > + > + if (pe->pdev) { > set_iommu_table_base(&pe->pdev->dev, tbl); > - else > +#ifdef CONFIG_DEVICE_ISOLATION > + device_isolation_dev_add(&pe->di_group, &pe->pdev->dev); > +#endif > + } else > pnv_ioda_setup_bus_dma(pe, pe->pbus); > Blech, #ifdefs. > + > + > return; > fail: > /* XXX Failure: Try to fallback to 64-bit only ? */ > diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h > index 64ede1e..3e282b7 100644 > --- a/arch/powerpc/platforms/powernv/pci.h > +++ b/arch/powerpc/platforms/powernv/pci.h > @@ -1,6 +1,8 @@ > #ifndef __POWERNV_PCI_H > #define __POWERNV_PCI_H > > +#include > + > struct pci_dn; > > enum pnv_phb_type { > @@ -60,6 +62,10 @@ struct pnv_ioda_pe { > > /* Link in list of PE#s */ > struct list_head link; > + > +#ifdef CONFIG_DEVICE_ISOLATION > + struct device_isolation_group di_group; > +#endif Embedding the struct means we need to know the size, which means we can't get rid of the #ifdef. Probably better to use a pointer if we don't mind adding a few bytes in the #ifndef case. Thanks, Alex > }; > > struct pnv_phb {