From patchwork Thu Dec 14 11:47:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 10111907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2037060327 for ; Thu, 14 Dec 2017 11:48:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D8D229C18 for ; Thu, 14 Dec 2017 11:48:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0055C29C27; Thu, 14 Dec 2017 11:48:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C1A229C18 for ; Thu, 14 Dec 2017 11:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rpLbvJnM/bGl04glhGx4x6qZLaPDhWktW78hpchN+pE=; b=ZmuaEEawGudwe0 BrglXq8JRaPBaobsL2MkasVCeOTvqDTegZNMzyuuz6u3FB98skKKxPXODlfl+ZIbY9YpKgAlSQRNU PJ0cllUl8sQJ8ZUhOlx9u2Bsx//p0AgNhQAPicpEKp8XXbb49qnPmfd2E75iEfLTvjzIKlhAAX8Pl RcO6Ir6QjeSwemT/Q65d5djZ/zTf4ZxWTrIs6NPWsVL6W7jOspS/xxluph6cQ1Zc+ubbjt+gXMCz3 5TOVconCVpkAz986idWIk48fq7YqUMx1S14b/B0XEeyHfY8aJujDjUDd+dEIK3cvBp6rxWeFOcFQt hk5CDARhTb4/aageb4RA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePS08-0004cR-HD; Thu, 14 Dec 2017 11:48:32 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePS04-0004b0-Cf for linux-arm-kernel@lists.infradead.org; Thu, 14 Dec 2017 11:48:30 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 97C061529; Thu, 14 Dec 2017 03:48:07 -0800 (PST) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.207.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 609183F4FF; Thu, 14 Dec 2017 03:48:05 -0800 (PST) Date: Thu, 14 Dec 2017 11:47:59 +0000 From: Lorenzo Pieralisi To: Shameer Kolothum Subject: Re: [PATCH v11 1/3] ACPI/IORT: Add msi address regions reservation helper Message-ID: <20171214114759.GA27117@e107981-ln.cambridge.arm.com> References: <20171213115830.61872-1-shameerali.kolothum.thodi@huawei.com> <20171213115830.61872-2-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171213115830.61872-2-shameerali.kolothum.thodi@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171214_034828_548582_2CF35F3D X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, marc.zyngier@arm.com, joro@8bytes.org, john.garry@huawei.com, will.deacon@arm.com, linuxarm@huawei.com, xuwei5@hisilicon.com, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, guohanjun@huawei.com, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Dec 13, 2017 at 11:58:28AM +0000, Shameer Kolothum wrote: > On some platforms msi parent address regions have to be excluded from > normal IOVA allocation in that they are detected and decoded in a HW > specific way by system components and so they cannot be considered normal > IOVA address space. > > Add a helper function that retrieves ITS address regions - the msi > parent - through IORT device <-> ITS mappings and reserves it so that > these regions will not be translated by IOMMU and will be excluded from > IOVA allocations. The function checks for the smmu model number and > only applies the msi reservation if the platform requires it. > > Signed-off-by: Shameer Kolothum > --- > drivers/acpi/arm64/iort.c | 112 +++++++++++++++++++++++++++++++++++++-- > drivers/irqchip/irq-gic-v3-its.c | 3 +- > include/linux/acpi_iort.h | 7 ++- > 3 files changed, 117 insertions(+), 5 deletions(-) You need this additional hunk to make it compile on !CONFIG_IOMMU_API: -- >8 -- diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 3e0ce652c3e8..e2f7bddf5522 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -762,25 +762,6 @@ static int __maybe_unused __get_pci_rid(struct pci_dev *pdev, u16 alias, return 0; } -static __maybe_unused struct acpi_iort_node *iort_get_msi_resv_iommu( - struct device *dev) -{ - struct acpi_iort_node *iommu; - struct iommu_fwspec *fwspec = dev->iommu_fwspec; - - iommu = iort_get_iort_node(fwspec->iommu_fwnode); - - if (iommu && (iommu->type == ACPI_IORT_NODE_SMMU_V3)) { - struct acpi_iort_smmu_v3 *smmu; - - smmu = (struct acpi_iort_smmu_v3 *)iommu->node_data; - if (smmu->model == ACPI_IORT_SMMU_V3_HISILICON_HI161X) - return iommu; - } - - return NULL; -} - static int arm_smmu_iort_xlate(struct device *dev, u32 streamid, struct fwnode_handle *fwnode, const struct iommu_ops *ops) @@ -807,6 +788,24 @@ static inline bool iort_iommu_driver_enabled(u8 type) } #ifdef CONFIG_IOMMU_API +static struct acpi_iort_node *iort_get_msi_resv_iommu(struct device *dev) +{ + struct acpi_iort_node *iommu; + struct iommu_fwspec *fwspec = dev->iommu_fwspec; + + iommu = iort_get_iort_node(fwspec->iommu_fwnode); + + if (iommu && (iommu->type == ACPI_IORT_NODE_SMMU_V3)) { + struct acpi_iort_smmu_v3 *smmu; + + smmu = (struct acpi_iort_smmu_v3 *)iommu->node_data; + if (smmu->model == ACPI_IORT_SMMU_V3_HISILICON_HI161X) + return iommu; + } + + return NULL; +} + static inline const struct iommu_ops *iort_fwspec_iommu_ops( struct iommu_fwspec *fwspec) {