From patchwork Wed Sep 26 13:22:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25A89913 for ; Wed, 26 Sep 2018 14:33:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 121EB286BC for ; Wed, 26 Sep 2018 14:33:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 101D528CD3; Wed, 26 Sep 2018 14:33:17 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 4808D286BC for ; Wed, 26 Sep 2018 14:33:13 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=wJldFaNCexFkJZjW5xdsTfoSrsZh9rLWxR6xgw8CzQY=; b=pimLmFObOvjkWDicB4JJt3RNwl EaICnlKEfPZm4nyYwyz8Xr8DUK4ZhmUv/h+5Hx3VYZwifcyciXBYLKffyX+GcflgkB8Kb5NkvSZxm gYf7a6XveJPt4VFc0OrOYz/giFQVLHL/rIDDWjVSvhS6Uat7x3Wk0XEppVMsyu2FjQuJt615B5byD 80+fNrbFG1K2+VH0lVdo23MSiQRoLg4NIFdmZ3mlvhT1So3Y/sRQ86TkU1DXeNJ4MtM2za7YnReCD +Q3OLeG1TKGWiITkJvgqZuFVR6hVpFh+f+xX6sRlaNwm89M/5lTyY2PTZViKIY2ml3c0CDxMm+vB1 9sXf4A5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5As9-00014C-FY; Wed, 26 Sep 2018 14:33:01 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5Am0-0005yM-K3 for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 14:26:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5mc4Nb6bhnUA2vrvFjEHwP1aT1PIMeT7EGnegzirXSI=; b=c4eqZ5g8LZHgWKgCkwKYvntdf mKaS64tviiUT6fIE+mTNvGV/Zlasd3w1S34Pv8ERUMcLbLlcLvuMCmmNTffLSgxANInLssZG60agi aqvp0aFdaatkPCxqZ7oco/KxssQ3ZiPe5TriijyWIVFDQcQ8kSHRh6fEALU6aSUQLhg/WFnEkiMBr IWltg8EcjK8hQcEAhKefDmc1LAdRUZTsgvNt6BGhkRoBplNxltUzrzILoQeOV6H/O1JVDQjmf0+4c EyCeiAtgf0bQfFQ6Ire7aJh7omZeDEUMiwa58F+QeDBpgI7vFeHY+Kh17lv7DCuRsIPVAero+JBVJ BbLI/ZKUA==; Received: from inva020.nxp.com ([92.121.34.13]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59n1-000895-RR for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:41 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7B36B1A0259; Wed, 26 Sep 2018 15:22:51 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6BEBF1A0251; Wed, 26 Sep 2018 15:22:51 +0200 (CEST) Received: from fsr-ub1864-101.ea.freescale.net (fsr-ub1864-101.ea.freescale.net [10.171.82.97]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id C593F203C2; Wed, 26 Sep 2018 15:22:50 +0200 (CEST) From: laurentiu.tudor@nxp.com To: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 03/22] soc/fsl/qman: map FQD and PFDR areas in the iommu Date: Wed, 26 Sep 2018 16:22:28 +0300 Message-Id: <20180926132247.10971-4-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926132247.10971-1-laurentiu.tudor@nxp.com> References: <20180926132247.10971-1-laurentiu.tudor@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_092340_005406_664DAF6E X-CRM114-Status: UNSURE ( 9.20 ) X-CRM114-Notice: Please train this message. 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: bharat.bhushan@nxp.com, madalin.bucur@nxp.com, shawnguo@kernel.org, roy.pledge@nxp.com, leoyang.li@nxp.com, robin.murphy@arm.com, davem@davemloft.net, Laurentiu Tudor MIME-Version: 1.0 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 From: Laurentiu Tudor Add a one-to-one iommu mapping for qman private data memory areas (FQD and PFDR). This is required for QMAN to work without faults behind an iommu. Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/qbman/qman_ccsr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c b/drivers/soc/fsl/qbman/qman_ccsr.c index 619e22030460..0cfe79f85a66 100644 --- a/drivers/soc/fsl/qbman/qman_ccsr.c +++ b/drivers/soc/fsl/qbman/qman_ccsr.c @@ -29,6 +29,7 @@ */ #include "qman_priv.h" +#include u16 qman_ip_rev; EXPORT_SYMBOL(qman_ip_rev); @@ -692,6 +693,7 @@ static int fsl_qman_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; + struct iommu_domain *domain; struct resource *res; int ret, err_irq; u16 id; @@ -769,6 +771,19 @@ static int fsl_qman_probe(struct platform_device *pdev) } dev_dbg(dev, "Allocated PFDR 0x%llx 0x%zx\n", pfdr_a, pfdr_sz); + /* Create an 1-to-1 iommu mapping for fqd and pfdr areas */ + domain = iommu_get_domain_for_dev(dev); + if (domain) { + ret = iommu_map(domain, fqd_a, fqd_a, fqd_sz, + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE); + if (ret) + dev_warn(dev, "iommu_map(fqd) failed %d\n", ret); + ret = iommu_map(domain, pfdr_a, pfdr_a, pfdr_sz, + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE); + if (ret) + dev_warn(dev, "iommu_map(pfdr) failed %d\n", ret); + } + ret = qman_init_ccsr(dev); if (ret) { dev_err(dev, "CCSR setup failed\n");