From patchwork Fri Mar 29 14:00:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10877103 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 004021390 for ; Fri, 29 Mar 2019 14:00:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC46A288B8 for ; Fri, 29 Mar 2019 14:00:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA69E28905; Fri, 29 Mar 2019 14:00:29 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 DD91628952 for ; Fri, 29 Mar 2019 14:00:28 +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=JTIzK2dztLa85Cpd7FeSj/IEKqP0shkG33KWzw0fOtE=; b=fD+yqg27HzWCXQBY+uiqCuI7/+ CzX7NKsTq1xrJgweTtBtARQyyR7AfMAx8s2KR09LcoVBM7BWUPNU2lHsC9OfiTD8Q0KTm5Xcli++Y EQBdmCnjz9bew4j7saXh1K8UZqgP87Dp2m1XVkhAZvNMt0ym49Z3p5FwISFi1j/9lM/lKhFbC7vNi xSjw416yYXEXvk4TeOVSLoqYiBv5B0E5JNENUP1ls0ZtAGAh8RPb4R7AV20TDSwJJAuBBJbDZdR09 Bcsx7JdAwnbL+GVybslhRc+KoRJnJQalAeVYyU4SxYMJAr3Mc1SSOUSrOeruuKAqxDs3m96U/Dctw o86uBf9Q==; 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 1h9s3W-0005kG-U8; Fri, 29 Mar 2019 14:00:26 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9s3S-0005hC-PK for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2019 14:00:24 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C28A9200294; Fri, 29 Mar 2019 15:00:19 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B65A0200270; Fri, 29 Mar 2019 15:00:19 +0100 (CET) Received: from fsr-ub1864-101.ea.freescale.net (fsr-ub1864-101.ea.freescale.net [10.171.74.120]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 14CAB20606; Fri, 29 Mar 2019 15:00:19 +0100 (CET) From: laurentiu.tudor@nxp.com To: netdev@vger.kernel.org, madalin.bucur@nxp.com, roy.pledge@nxp.com, camelia.groza@nxp.com, leoyang.li@nxp.com Subject: [PATCH 04/13] soc/fsl/qman-portal: map CENA area in the iommu Date: Fri, 29 Mar 2019 16:00:05 +0200 Message-Id: <20190329140014.8126-5-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190329140014.8126-1-laurentiu.tudor@nxp.com> References: <20190329140014.8126-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-20190329_070022_973646_E8F7F772 X-CRM114-Status: UNSURE ( 8.60 ) 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: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org, 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 portal CENA register area. This is required for QMAN stashing to work without faults behind an iommu. Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/qbman/qman_portal.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c index 661c9b234d32..dfb62f9815e9 100644 --- a/drivers/soc/fsl/qbman/qman_portal.c +++ b/drivers/soc/fsl/qbman/qman_portal.c @@ -29,6 +29,7 @@ */ #include "qman_priv.h" +#include struct qman_portal *qman_dma_portal; EXPORT_SYMBOL(qman_dma_portal); @@ -224,6 +225,7 @@ static int qman_portal_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; + struct iommu_domain *domain; struct qm_portal_config *pcfg; struct resource *addr_phys[2]; int irq, cpu, err; @@ -286,6 +288,21 @@ static int qman_portal_probe(struct platform_device *pdev) goto err_ioremap2; } + /* Create an 1-to-1 iommu mapping for cena portal area */ + domain = iommu_get_domain_for_dev(dev); + if (domain) { + /* + * Note: not mapping this as cacheable triggers the infamous + * QMan CIDE error. + */ + err = iommu_map(domain, + addr_phys[0]->start, addr_phys[0]->start, + resource_size(addr_phys[0]), + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE); + if (err) + dev_warn(dev, "failed to iommu_map() %d\n", err); + } + pcfg->pools = qm_get_pools_sdqcr(); spin_lock(&qman_lock);