From patchwork Mon May 6 07:22:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 241583 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id CA2DA2C0980 for ; Mon, 6 May 2013 17:26:06 +1000 (EST) Received: from mail-pb0-x230.google.com (mail-pb0-x230.google.com [IPv6:2607:f8b0:400e:c01::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 2452B2C013F for ; Mon, 6 May 2013 17:22:52 +1000 (EST) Received: by mail-pb0-f48.google.com with SMTP id ma3so1840184pbc.35 for ; Mon, 06 May 2013 00:22:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=Lsm+T1Z0ehI3QoYVteoCAkBv16nujvJmzxBuWx+MlW8=; b=FLdo2Xuj6FGZEXdsXIIQNacxqwKABSvWT53x/+mNEwSSmEbkSZDHjWDS4f/CG5s3xm Pysi8292FgZkjLU/2wmp8JeXkHHt1dEfXS2s9MAq1UkuvEq6G3lrp5V0VfCoOiYCWmGi 6CA1i0UFc8wLfnHjJFfX+nSsDHsxHlO4KFqWFI+rc5VQo3lXqVLRgPThUlfBJ7o1GbUU GtQguZ02aTPa6tu9HAVVI1j5SAJEX/UwDVV+MuOkPjBemE5jHnKCwqeuwZ8sr3rZ2d6H 1DUXGNFj0Z8rb+GLJD2iqjuNJBiegBnMiiqwd468EQp/0DTBFtwJ01FuEw2rHwwHx5iJ Vh6w== X-Received: by 10.67.10.4 with SMTP id dw4mr25053093pad.177.1367824970623; Mon, 06 May 2013 00:22:50 -0700 (PDT) Received: from ka1.ozlabs.ibm.com (ibmaus65.lnk.telstra.net. [165.228.126.9]) by mx.google.com with ESMTPSA id az5sm20593976pbc.18.2013.05.06.00.22.45 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 May 2013 00:22:49 -0700 (PDT) From: aik@ozlabs.ru To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 5/5] powerpc/vfio: Enable on pSeries platform Date: Mon, 6 May 2013 17:22:01 +1000 Message-Id: <51875a49.25ac440a.50d9.ffffe93e@mx.google.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367824921-27151-1-git-send-email-y> References: <1367824921-27151-1-git-send-email-y> X-Gm-Message-State: ALoCoQk8Nn8tnXA+0KOUcYWpRPmmfKfQnLKfaiktbC8Acj6VSIyBqj97Bs+kNrZSsg+9fLGUgu0q Cc: kvm@vger.kernel.org, Alexey Kardashevskiy , Alexander Graf , kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Williamson , Paul Mackerras , linux-pci@vger.kernel.org, David Gibson X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Alexey Kardashevskiy The enables VFIO on the pSeries platform, enabling user space programs to access PCI devices directly. Signed-off-by: Alexey Kardashevskiy Cc: David Gibson Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/iommu.c | 4 ++++ drivers/iommu/Kconfig | 2 +- drivers/vfio/Kconfig | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index e2685ba..e178acc 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -613,6 +613,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus) iommu_table_setparms(pci->phb, dn, tbl); pci->iommu_table = iommu_init_table(tbl, pci->phb->node); + iommu_register_group(tbl, pci_domain_nr(bus), 0); /* Divide the rest (1.75GB) among the children */ pci->phb->dma_window_size = 0x80000000ul; @@ -657,6 +658,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus) ppci->phb->node); iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window); ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node); + iommu_register_group(tbl, pci_domain_nr(bus), 0); pr_debug(" created table: %p\n", ppci->iommu_table); } } @@ -683,6 +685,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev) phb->node); iommu_table_setparms(phb, dn, tbl); PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node); + iommu_register_group(tbl, pci_domain_nr(phb->bus), 0); set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table); return; } @@ -1145,6 +1148,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) pci->phb->node); iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window); pci->iommu_table = iommu_init_table(tbl, pci->phb->node); + iommu_register_group(tbl, pci_domain_nr(pci->phb->bus), 0); pr_debug(" created table: %p\n", pci->iommu_table); } else { pr_debug(" found DMA window, table: %p\n", pci->iommu_table); diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 175e0f4..2d75ea0 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -189,7 +189,7 @@ config EXYNOS_IOMMU_DEBUG config SPAPR_TCE_IOMMU bool "sPAPR TCE IOMMU Support" - depends on PPC_POWERNV + depends on PPC_POWERNV || PPC_PSERIES select IOMMU_API help Enables bits of IOMMU API required by VFIO. The iommu_ops diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig index b464687..26b3d9d 100644 --- a/drivers/vfio/Kconfig +++ b/drivers/vfio/Kconfig @@ -12,7 +12,7 @@ menuconfig VFIO tristate "VFIO Non-Privileged userspace driver framework" depends on IOMMU_API select VFIO_IOMMU_TYPE1 if X86 - select VFIO_IOMMU_SPAPR_TCE if PPC_POWERNV + select VFIO_IOMMU_SPAPR_TCE if (PPC_POWERNV || PPC_PSERIES) help VFIO provides a framework for secure userspace device drivers. See Documentation/vfio.txt for more details.