From patchwork Wed Oct 10 12:07:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10634433 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 B049D112B for ; Wed, 10 Oct 2018 12:10:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E80029E16 for ; Wed, 10 Oct 2018 12:10:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C65629E8D; Wed, 10 Oct 2018 12:10:46 +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 00CE929E73 for ; Wed, 10 Oct 2018 12:10:45 +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=CX8GfFopDxU4ScIZnw5y/EFojXuPjJclkQm9Z3+cXeo=; b=Am+F/Fqtf3BBLF/i25xYCH3UXb TW9/wDYI8N3v0E5iauYgKYaeGbLZbRo94STORC1ss5kWBNH9qjLXEfeulzkc/IgwlyCim84QYIPJm F6dnVFTXWrfYsxGEB/P2J0uId/5KF9Ux8wnqUpFQmM2WR9CMhxp04Ftewsmcomj3vC8/jJgNp/+jj AKnlFG8lx9tiR6scR/IQooi6MDhMSJkqAEkWSGe+ye+xU69I/KPsYoyW52TjEjNmJuSWRDiFHw1F5 UyGete0VSam9NLEII8qnha0XN3ta/Pel4oPPoV0IcXuTY66mDUIwvGBUiI40kCHXpuWzrkwSuf93r 8/aC8Y6w==; 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 1gADJq-0000E3-Lu; Wed, 10 Oct 2018 12:10:26 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gADHW-0006uO-5I for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 12:08:06 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 20AC81A0159; Wed, 10 Oct 2018 14:07:50 +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 143D11A0195; Wed, 10 Oct 2018 14:07:50 +0200 (CEST) Received: from fsr-ub1864-101.ea.freescale.net (fsr-ub1864-101.ea.freescale.net [10.171.82.46]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 5CA1E20619; Wed, 10 Oct 2018 14:07:49 +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, arm@kernel.org Subject: [PATCH v3 02/22] soc/fsl/bman: map FBPR area in the iommu Date: Wed, 10 Oct 2018 15:07:20 +0300 Message-Id: <20181010120737.30300-3-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181010120737.30300-1-laurentiu.tudor@nxp.com> References: <20181010120737.30300-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-20181010_050802_354227_D4697244 X-CRM114-Status: UNSURE ( 8.51 ) 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: arnd@arndb.de, 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 bman private data memory (FBPR). This is required for BMAN to work without faults behind an iommu. Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/qbman/bman_ccsr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/soc/fsl/qbman/bman_ccsr.c b/drivers/soc/fsl/qbman/bman_ccsr.c index 05c42235dd41..d180da003e4a 100644 --- a/drivers/soc/fsl/qbman/bman_ccsr.c +++ b/drivers/soc/fsl/qbman/bman_ccsr.c @@ -29,6 +29,7 @@ */ #include "bman_priv.h" +#include u16 bman_ip_rev; EXPORT_SYMBOL(bman_ip_rev); @@ -171,6 +172,7 @@ static int fsl_bman_probe(struct platform_device *pdev) int ret, err_irq; struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; + struct iommu_domain *domain; struct resource *res; u16 id, bm_pool_cnt; u8 major, minor; @@ -216,6 +218,15 @@ static int fsl_bman_probe(struct platform_device *pdev) dev_dbg(dev, "Allocated FBPR 0x%llx 0x%zx\n", fbpr_a, fbpr_sz); + /* Create an 1-to-1 iommu mapping for FBPR area */ + domain = iommu_get_domain_for_dev(dev); + if (domain) { + ret = iommu_map(domain, fbpr_a, fbpr_a, fbpr_sz, + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE); + if (ret) + dev_warn(dev, "failed to iommu_map() %d\n", ret); + } + bm_set_memory(fbpr_a, fbpr_sz); err_irq = platform_get_irq(pdev, 0);