From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932286Ab1LOGZy (ORCPT ); Thu, 15 Dec 2011 01:25:54 -0500 Received: from ozlabs.org ([203.10.76.45]:38566 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755710Ab1LOGZw (ORCPT ); Thu, 15 Dec 2011 01:25:52 -0500 From: David Gibson To: alex.williamson@redhat.com Cc: aik@ozlabs.ru, benh@kernel.crashing.org, joerg.roedel@amd.com, dwmw2@infradead.org, chrisw@redhat.com, agraf@suse.de, scottwood@freescale.com, B08248@freescale.com, iommu@lists.linux-foundation.org, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] device_isolation: Support isolation on POWER p7ioc (IODA) bridges Date: Thu, 15 Dec 2011 17:08:49 +1100 Message-Id: <1323929329-23927-2-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.7.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 0cdc8302..6df632e 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 @@ -861,6 +862,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 } } @@ -941,11 +945,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); + + 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 a2dc071..d663a26 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 { @@ -51,6 +53,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 }; struct pnv_phb { -- 1.7.7.3