From patchwork Wed Sep 26 13:22:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616015 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 317E715E8 for ; Wed, 26 Sep 2018 13:49:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28C902AF74 for ; Wed, 26 Sep 2018 13:49:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 267962AF6E; Wed, 26 Sep 2018 13:49:26 +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 5E3722AF6A for ; Wed, 26 Sep 2018 13:49:22 +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=VhHrh0j34p8DYvG4mFpB2LDAhy/YrZ/NDRNIz/RiE5U=; b=gtcVJVBLr4ahvau6LFOesGUWPt 7eO+/RRLWvq9nAwg623/OcQXWs2fu/EcB4TqFPHUpZVQHzluuSd+92i+ND6G1Q7fi9h2zJS5MNn7f JUtKvxcs3sUmqLv+crYc+5UcOt8tpbARyRdcNpr1bfMoZAgqX238NlXYFSXtGUU/iYsYvP1sPNZRz 2p625u5vA9hlnmrkTto0bVKN7IPZylDqEkHH0s2eyt8CSEqaGMgP3mK7pr9VcdoOmakwvZ6FynFrq FF/InHKj20uayHh4NhNoZxNvQAzn0dbDMC//idNdeUpJ8t695NWYjW9H81XmFjMyR2z5zGbDHd4h1 V61snNZQ==; 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 1g5ABq-0001lb-Fi; Wed, 26 Sep 2018 13:49:18 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5A7T-00074o-ES for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 13:44:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=8L2iTpf6A12y9XiK/bCT3bTxBVnfFPbU3rlZo7de+Ok=; b=RweVMSxp8/ApWcbay2BADzwmg 8l3VmwkNPn24SWUHs/hwfeGvdEhAGtt7DW25NsGk7oWWdKOcFs9fQOuFg+46TYPv4q4ZbYtKg3QI9 C/lI4mBurL5pG+J6sw5BRAXnV0mN/B8I9qNluSnRMi+k9bi5nBPi46nhxykYQbEEFjpuARUL/zLm5 Y+8M57jLOGRArWNg1XYmaEFY8QixCjdForSqApdr3hTQp5DjyAWVSCfdGUIHmIt8L2RNvOnvkymwx EuplF87Y5nXpyJk1s7AvMCmMIaezg/TeMvVmvFHIYR7DK3SbB88t+iyB/VRFRKtdRYi3xBbvRc+8P V58kUD7QQ==; Received: from inva021.nxp.com ([92.121.34.21]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59nB-0008NT-OF for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:51 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 17412200259; Wed, 26 Sep 2018 15:22:50 +0200 (CEST) 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 096FD200257; Wed, 26 Sep 2018 15:22:50 +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 5A78A203C2; Wed, 26 Sep 2018 15:22: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 Subject: [PATCH v2 01/22] soc/fsl/qman: fixup liodns only on ppc targets Date: Wed, 26 Sep 2018 16:22:26 +0300 Message-Id: <20180926132247.10971-2-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_142349_795185_7176761B X-CRM114-Status: UNSURE ( 9.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: 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 ARM SoCs use SMMU so the liodn fixup done in the qman driver is no longer making sense and it also breaks the ICID settings inherited from u-boot. Do the fixups only for PPC targets. Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/qbman/qman_ccsr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c b/drivers/soc/fsl/qbman/qman_ccsr.c index 79cba58387a5..619e22030460 100644 --- a/drivers/soc/fsl/qbman/qman_ccsr.c +++ b/drivers/soc/fsl/qbman/qman_ccsr.c @@ -597,6 +597,7 @@ static int qman_init_ccsr(struct device *dev) #define LIO_CFG_LIODN_MASK 0x0fff0000 void qman_liodn_fixup(u16 channel) { +#ifdef CONFIG_PPC static int done; static u32 liodn_offset; u32 before, after; @@ -616,6 +617,7 @@ void qman_liodn_fixup(u16 channel) qm_ccsr_out(REG_REV3_QCSP_LIO_CFG(idx), after); else qm_ccsr_out(REG_QCSP_LIO_CFG(idx), after); +#endif } #define IO_CFG_SDEST_MASK 0x00ff0000 From patchwork Wed Sep 26 13:22:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616057 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 7974314BD for ; Wed, 26 Sep 2018 14:34:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66644288EC for ; Wed, 26 Sep 2018 14:34:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A602291F5; Wed, 26 Sep 2018 14:34:05 +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 9252B288EC for ; Wed, 26 Sep 2018 14:34:01 +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=KmhmKg+SrTZRvezHXuIkLE83jB yeryAhSE5hdNVSUre7iEueEsD4WY0OsLeJjxeyKWW34YCK1HNuErQJddfghiMZ85Z8TbAyv5N3SgM fJoH3EEtzVHPipGF3P4A9SWXn2wFR6JVPH4SGDH8yWIosImFJP0iFZy8i9RzgXqVNedjOUTdcp54o 9ETbKBo6HGVJi2VtZ+Qsb4W9bll90J1Tgb/pn+KwWySr64ugIQ1lyfTiF8jDi2kSDWf2Ni7e6DIce Y+MoHDzKvUpIh0w54hvFgv6Xmja7KgwAebyYslyZHWrPmNvarD/v1jAGUR6QRj7Xab7nhUkffgonw nW5NZs4Q==; 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 1g5Asu-0001UC-Ts; Wed, 26 Sep 2018 14:33:48 +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 1g5Am2-0005yM-4R for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 14:26:42 +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=1myQKILlBbEaXmgpcWJ9fK7nbjNj1Xwtmdo3iTY6uIc=; b=NTcb06nMP9eN2x03HO0MVJ9A3 nI+Da+5aw1beHaIXOAHpNw4ta2jPpxaNTEcG1PXdhcPZS9C6bYTEwo43KSErilTj6xAMy6jhTUM2w rrLF42/Ko48nSOb32K+7xLS9T2uCjka18grTZUnAG+ABwGFJ8mSxKVpzgD7/dVqNwcjnZeAwDX5xx 8k/SVdbxWmneRFgM0nOGjSTxaLAJmrDkvTbvPyXnQC78z6iUaxAXzLTnaiLPNysp5OxOU0Ns3SdZ0 SQPL2/Bb/V6IHcfxX4W0MrEAUAhH/4/k163KPs/0Arkg1iDO1AhPR1+5Rkx23bqfB7bphjzAlplZm N6HZL8apQ==; Received: from inva021.nxp.com ([92.121.34.21]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59n1-000894-Dg for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:40 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C160E200254; Wed, 26 Sep 2018 15:22:50 +0200 (CEST) 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 B4307200253; Wed, 26 Sep 2018 15:22:50 +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 19DB3203C2; 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 02/22] soc/fsl/bman: map FBPR area in the iommu Date: Wed, 26 Sep 2018 16:22:27 +0300 Message-Id: <20180926132247.10971-3-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_092339_559814_43B370DD X-CRM114-Status: UNSURE ( 9.57 ) 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 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); 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"); From patchwork Wed Sep 26 13:22:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616025 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 5799015E8 for ; Wed, 26 Sep 2018 13:54:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D2FD29786 for ; Wed, 26 Sep 2018 13:54:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4108C2A37D; Wed, 26 Sep 2018 13:54:07 +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 75C1129786 for ; Wed, 26 Sep 2018 13:54:03 +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=4b1Fal/LpXXkzZgIqydrZB2DvSJ1rb1mwPvvGBYZjs0=; b=AgNF/co6Z4noZBR604uDk2Y3+y U8+qaH7XH/DeQ4O8u42GTxXw0SWZ4RT24CLOEJnA1fUHmDIkO78M9wmXp0nAyTdQm6O0hhgkox4lf HahIwoaB5EKdoHh+q+ljviw2EYJSB0PQR22afhEAjSUGKOSe1ks0uukANrgZtUHTYu8ii2gR3fd88 dX99G+kGXv6KqL6uCilsgm+iV0Bx5HQOFVPo7S6ib0QgzDNvuyRVqCky3ZTXtRGRcupch3+DDp4OW pZr0sA2QuBPR9wdyHwCWRgE+9L6HtYD9BSSzt5PQJH7as87XtDYRDkbJgQe27PlwwBrP+fgT8Kas4 /Ni9e1rg==; 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 1g5AGG-0004dm-0h; Wed, 26 Sep 2018 13:53:52 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5A7T-00071T-TF for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 13:44:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=U0WcgR0UIuwbO/ohIBvnFg6BoZU3iAZ40zI/sIqcN7U=; b=pxF85gCyYj/Xcq3kwHQaZs2YQ 3+PI5mMZUNnwDwX/dqE2TAcXwoF4o4PBpf6gr40S3U2GC450S7welCNIrh78MoFsMNSAZTXJdV6Eg PXmx0Nw0x8I0l9HjGTO6EVAgPhfm8Nq/Vnvd8a1uNuUTzo5HFUYemu22OXsDfJTUW3YrRJ/MGpDR8 nghAB19XsUmC5MZeMSFX+4Sbr32KoPQ4ZcDj4NxkdllXCoV1HVdr6gS6gzlmMtEDBESbyJFRLLEno aY20MTbDeo5rcnoYxA6pB25trC0PH0kN4zizCQqQPiAmBl85DrS4QI4jeU4utKEpgHlhIm5R1yZnj Tbs9HA4vQ==; Received: from inva021.nxp.com ([92.121.34.21]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59mr-0008Kx-AG for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:32 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 31426200255; Wed, 26 Sep 2018 15:22:52 +0200 (CEST) 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 24859200253; Wed, 26 Sep 2018 15:22:52 +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 7D6C2203C2; Wed, 26 Sep 2018 15:22:51 +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 04/22] soc/fsl/qman-portal: map CENA area in the iommu Date: Wed, 26 Sep 2018 16:22:29 +0300 Message-Id: <20180926132247.10971-5-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_142329_376735_EEC955EB X-CRM114-Status: GOOD ( 11.69 ) 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 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 a120002b630e..6d9da3b1b5ad 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); @@ -222,6 +223,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; @@ -276,6 +278,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); From patchwork Wed Sep 26 13:22:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616021 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 087F314BD for ; Wed, 26 Sep 2018 13:52:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3F0728A07 for ; Wed, 26 Sep 2018 13:52:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E80FA2AF3F; Wed, 26 Sep 2018 13:52: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 1373928A07 for ; Wed, 26 Sep 2018 13:52: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=SIIhPj2ur8oYM6chXkeBAe98t/8jiLz8+4BhIJ8U7jo=; b=hJQqNzF4C39TLnXh1PVYBH5imB WrmJJ6YZZ72FwN8ZZw/uCGK3YKpf3Gr27jCGVDbRE8tJFG/pC1dyBOaO05cDASE2nQVf1O6Dkksze zHL8SvBkpAKzaOVRNMIoU03IsGzK5A71ZmyiWj7mycrS2yzRrxqJR3GrgSw9cgQF042ZI33tL8Voz wSmRTv1uLRA3Pl4SoBPOy9SfXlnEOyYzyIjgaS5MtQyiqOA3qY+qxlNmmCH09cwFU27uNkhKggyAP ZjNG9kPeuIBw1faQavhywVlEA97qZ7SXSdf0AwX1LNa80JgBNk7IuQx4l3RT7GbgyX3Xya+bF5t/P OUOgdz6A==; 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 1g5AEV-00046W-6c; Wed, 26 Sep 2018 13:52:03 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5A7T-0007EY-S2 for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 13:44:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=i6f+exProMotahpPFeTpj6uZKZlWmKu3fpvC17CDvB8=; b=F5bykojOmwh2xO6he8kQuxbxP WhfoOFeCj0gp8hDGbWnKgzPc3Xef8hL4zi/N4x/g8NtHxfbnJyMLI1lxHEgv02598V0fCRoZrdBAG PUzJMwUhfVnVcEIkGreeDtMEwg2dc4fKY+U5eksDE/BBuiWOWHDTKttjSyD6M8XZdQgEvou9KM3+V NOZ0aiBURnPW6FLv7ery1v4e+t5HP8e0E3s+fqJg9nZg1OJtFoelKEu6tjciXkyfpf3c7tYng7wJZ CdloEGpo+b3626JMn/cQiUGtdlFAPM05WIfWsUNrA2VySsY3gm5I1dPVfolwk8vhn7Gu16xT7Gqgl gIViIkMYw==; Received: from inva020.nxp.com ([92.121.34.13]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59mr-0008LG-JZ for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:32 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id DF1631A0188; Wed, 26 Sep 2018 15:22:52 +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 D0D1C1A004C; Wed, 26 Sep 2018 15:22:52 +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 361E0203C2; Wed, 26 Sep 2018 15:22:52 +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 05/22] soc/fsl/qbman: add APIs to retrieve the probing status Date: Wed, 26 Sep 2018 16:22:30 +0300 Message-Id: <20180926132247.10971-6-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_142329_672591_58DAFCF7 X-CRM114-Status: GOOD ( 17.66 ) 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 couple of new APIs to check the probing status of qman and bman: 'int bman_is_probed()' and 'int qman_is_probed()'. They return the following values. * 1 if qman/bman were probed correctly * 0 if qman/bman were not yet probed * -1 if probing of qman/bman failed Drivers that use qman/bman driver services are required to use these APIs before calling any functions exported by qman or bman drivers or otherwise they will crash the kernel. The APIs will be used in the following couple of qbman portal patches and later in the series in the dpaa1 ethernet driver. Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/qbman/bman_ccsr.c | 11 +++++++++++ drivers/soc/fsl/qbman/qman_ccsr.c | 11 +++++++++++ include/soc/fsl/bman.h | 8 ++++++++ include/soc/fsl/qman.h | 8 ++++++++ 4 files changed, 38 insertions(+) diff --git a/drivers/soc/fsl/qbman/bman_ccsr.c b/drivers/soc/fsl/qbman/bman_ccsr.c index d180da003e4a..b209c79511bb 100644 --- a/drivers/soc/fsl/qbman/bman_ccsr.c +++ b/drivers/soc/fsl/qbman/bman_ccsr.c @@ -121,6 +121,7 @@ static void bm_set_memory(u64 ba, u32 size) */ static dma_addr_t fbpr_a; static size_t fbpr_sz; +static int __bman_probed; static int bman_fbpr(struct reserved_mem *rmem) { @@ -167,6 +168,12 @@ static irqreturn_t bman_isr(int irq, void *ptr) return IRQ_HANDLED; } +int bman_is_probed(void) +{ + return __bman_probed; +} +EXPORT_SYMBOL_GPL(bman_is_probed); + static int fsl_bman_probe(struct platform_device *pdev) { int ret, err_irq; @@ -177,6 +184,8 @@ static int fsl_bman_probe(struct platform_device *pdev) u16 id, bm_pool_cnt; u8 major, minor; + __bman_probed = -1; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(dev, "Can't get %pOF property 'IORESOURCE_MEM'\n", @@ -266,6 +275,8 @@ static int fsl_bman_probe(struct platform_device *pdev) return ret; } + __bman_probed = 1; + return 0; }; diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c b/drivers/soc/fsl/qbman/qman_ccsr.c index 0cfe79f85a66..383a49dcce68 100644 --- a/drivers/soc/fsl/qbman/qman_ccsr.c +++ b/drivers/soc/fsl/qbman/qman_ccsr.c @@ -274,6 +274,7 @@ static const struct qman_error_info_mdata error_mdata[] = { static u32 __iomem *qm_ccsr_start; /* A SDQCR mask comprising all the available/visible pool channels */ static u32 qm_pools_sdqcr; +static int __qman_probed; static inline u32 qm_ccsr_in(u32 offset) { @@ -689,6 +690,12 @@ static int qman_resource_init(struct device *dev) return 0; } +int qman_is_probed(void) +{ + return __qman_probed; +} +EXPORT_SYMBOL_GPL(qman_is_probed); + static int fsl_qman_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -699,6 +706,8 @@ static int fsl_qman_probe(struct platform_device *pdev) u16 id; u8 major, minor; + __qman_probed = -1; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(dev, "Can't get %pOF property 'IORESOURCE_MEM'\n", @@ -845,6 +854,8 @@ static int fsl_qman_probe(struct platform_device *pdev) if (ret) return ret; + __qman_probed = 1; + return 0; } diff --git a/include/soc/fsl/bman.h b/include/soc/fsl/bman.h index eaaf56df4086..5b99cb2ea5ef 100644 --- a/include/soc/fsl/bman.h +++ b/include/soc/fsl/bman.h @@ -126,4 +126,12 @@ int bman_release(struct bman_pool *pool, const struct bm_buffer *bufs, u8 num); */ int bman_acquire(struct bman_pool *pool, struct bm_buffer *bufs, u8 num); +/** + * bman_is_probed - Check if bman is probed + * + * Returns 1 if the bman driver successfully probed, -1 if the bman driver + * failed to probe or 0 if the bman driver did not probed yet. + */ +int bman_is_probed(void); + #endif /* __FSL_BMAN_H */ diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h index d4dfefdee6c1..597783b8a3a0 100644 --- a/include/soc/fsl/qman.h +++ b/include/soc/fsl/qman.h @@ -1186,4 +1186,12 @@ int qman_alloc_cgrid_range(u32 *result, u32 count); */ int qman_release_cgrid(u32 id); +/** + * qman_is_probed - Check if qman is probed + * + * Returns 1 if the qman driver successfully probed, -1 if the qman driver + * failed to probe or 0 if the qman driver did not probed yet. + */ +int qman_is_probed(void); + #endif /* __FSL_QMAN_H */ From patchwork Wed Sep 26 13:22:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616019 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 AD80D14BD for ; Wed, 26 Sep 2018 13:51:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A31DC2AFB9 for ; Wed, 26 Sep 2018 13:51:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A144F2AFC1; Wed, 26 Sep 2018 13:51:19 +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 C3D8B2AFD3 for ; Wed, 26 Sep 2018 13:51:15 +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=tXB0U7BTUT5nVPtXUC4nO2ehIKjpdeJJDcfa+qWz/WM=; b=FBTUPgOA59NxUIpfjEB51jXGIO bVTFyH9a759Aw5s6W2UsE1kslo/hfsndp4qu1Lsdhd9P3yHs33uPjxaIRIq/83S6Wz9cwkD0FXx38 QuKvlBrJzwdgbSuk0LwkogFnAG+R4lmkIwtS9lcsBGCvyu4Bg7KxN31kd6HFD39ohuJWhxgXq21gt 30VgJo1arbG+zlr0GWvC6QBSSBtUlPFRzO2KSrz9tuHV5UbKhsb+0A0TyEkcqq8Jq6ciMEuDukc+l YeFVESEO8u2cBe42jxAQF/64zIRwkLAVgbucCvLk84qcHqMtxPSgwg0U/gHQ+rBAhIS53VyWPGCz3 9W8mCpFw==; 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 1g5ADf-0003g7-JP; Wed, 26 Sep 2018 13:51:11 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5A7U-00073Q-3N for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 13:44:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=ThlByZrsaUfXdjNJ9T6x0elSL7KbGZr0wAldB3aQViE=; b=dgJWxOF6iGvI8r0KZ2zIqafyM ZqkdFfGQcg2Ym0BYes5zgqPzIu7l18HJn31zG0p8X+W9sl1nEXtbYX8vrMf/VIOhMsFasoDm37k3d qZ/PnctE3gGAuqSl+cjw6FyaF1Q/0R47SF/Vg7uA7r+J62go8byP7X5hdgG/q/ItOxvlYsGqkkjDl oqSrUUr0OTYHTMQb/8gzSRL61M62Mh6RRt/wU1ZcPbgeoIMZYZhpglNan2v3dwiRgDV3YNKGJTrcz MTZWn8pEBmKkAZ+sGCX0MwkTr2pCK9zV2C4OQzQ9mvAL8+LzeTdp8R/pUdggx+MnbF5SAOFgwFzhI yODemfkMw==; Received: from inva021.nxp.com ([92.121.34.21]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59mr-0008LI-In for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:32 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 95E8C20025B; Wed, 26 Sep 2018 15:22:53 +0200 (CEST) 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 8816C200253; Wed, 26 Sep 2018 15:22:53 +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 E1D22203C2; Wed, 26 Sep 2018 15:22:52 +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 06/22] soc/fsl/qman_portals: defer probe after qman's probe Date: Wed, 26 Sep 2018 16:22:31 +0300 Message-Id: <20180926132247.10971-7-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_142329_632651_62F8DE65 X-CRM114-Status: GOOD ( 12.16 ) 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 Defer probe of qman portals after qman probing. This fixes the crash below, seen on NXP LS1043A SoCs: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004 Mem abort info: ESR = 0x96000004 Exception class = DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 Data abort info: ISV = 0, ISS = 0x00000004 CM = 0, WnR = 0 [0000000000000004] user address but active_mm is swapper Internal error: Oops: 96000004 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.18.0-rc1-next-20180622-00200-g986f5c179185 #9 Hardware name: LS1043A RDB Board (DT) pstate: 80000005 (Nzcv daif -PAN -UAO) pc : qman_set_sdest+0x74/0xa0 lr : qman_portal_probe+0x22c/0x470 sp : ffff00000803bbc0 x29: ffff00000803bbc0 x28: 0000000000000000 x27: ffff0000090c1b88 x26: ffff00000927cb68 x25: ffff00000927c000 x24: ffff00000927cb60 x23: 0000000000000000 x22: 0000000000000000 x21: ffff0000090e9000 x20: ffff800073b5c810 x19: ffff800027401298 x18: ffffffffffffffff x17: 0000000000000001 x16: 0000000000000000 x15: ffff0000090e96c8 x14: ffff80002740138a x13: ffff0000090f2000 x12: 0000000000000030 x11: ffff000008f25000 x10: 0000000000000000 x9 : ffff80007bdfd2c0 x8 : 0000000000004000 x7 : ffff80007393cc18 x6 : 0040000000000001 x5 : 0000000000000000 x4 : ffffffffffffffff x3 : 0000000000000004 x2 : ffff00000927c900 x1 : 0000000000000000 x0 : 0000000000000004 Process swapper/0 (pid: 1, stack limit = 0x(____ptrval____)) Call trace: qman_set_sdest+0x74/0xa0 platform_drv_probe+0x50/0xa8 driver_probe_device+0x214/0x2f8 __driver_attach+0xd8/0xe0 bus_for_each_dev+0x68/0xc8 driver_attach+0x20/0x28 bus_add_driver+0x108/0x228 driver_register+0x60/0x110 __platform_driver_register+0x40/0x48 qman_portal_driver_init+0x20/0x84 do_one_initcall+0x58/0x168 kernel_init_freeable+0x184/0x22c kernel_init+0x10/0x108 ret_from_fork+0x10/0x18 Code: f9400443 11001000 927e4800 8b000063 (b9400063) ---[ end trace 4f6d50489ecfb930 ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/qbman/qman_portal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c index 6d9da3b1b5ad..eef93cab84f1 100644 --- a/drivers/soc/fsl/qbman/qman_portal.c +++ b/drivers/soc/fsl/qbman/qman_portal.c @@ -229,6 +229,14 @@ static int qman_portal_probe(struct platform_device *pdev) int irq, cpu, err; u32 val; + err = qman_is_probed(); + if (!err) + return -EPROBE_DEFER; + if (err < 0) { + dev_err(&pdev->dev, "failing probe due to qman probe error\n"); + return -ENODEV; + } + pcfg = devm_kmalloc(dev, sizeof(*pcfg), GFP_KERNEL); if (!pcfg) return -ENOMEM; From patchwork Wed Sep 26 13:22:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615971 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 2FCD9174A for ; Wed, 26 Sep 2018 13:28:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 115DC2ABE9 for ; Wed, 26 Sep 2018 13:28:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 030CE2ABEF; Wed, 26 Sep 2018 13:28:05 +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 0591B2AF0D for ; Wed, 26 Sep 2018 13:28:02 +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=vQyM1JsH0ab51rkwIeFt+UMrGThnZ6K5O7RrkeKlYL0=; b=CgHnbQdCGxS8CzEGCIWKCoxA6w OGNCCbbrHztVwhXeK4KaGAWfs3jusyDfi/J21i+guuWQfNsqMwmOYmDgm4JD52vhoXmk9XTzf4zvJ ARVUn71NBw/v9ryHm++1jKsDMDQROi1Ngxt3h0/zMOJvk/oGOqf0t6jpMvuKr54un9yq9bMR52uGH DOtzSrrWjXEE2czdi8XkSivcCz6UQVAV4yWGDNFlDldGI3RUKbo5xwB67ll892uw94SU0bMiISRC2 iTJybPho7DJrXvaO/lgCe48ZYpRVVhI8akqYKkw6WNq3hVx+4urx+MEPiRfJHFF+gdq5VDB8lnGcs G2ELyh9w==; 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 1g59r4-0006gk-BV; Wed, 26 Sep 2018 13:27:50 +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 1g59nQ-0004UO-N9 for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:09 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 5698D200257; Wed, 26 Sep 2018 15:22:54 +0200 (CEST) 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 48C21200253; Wed, 26 Sep 2018 15:22:54 +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 9985E203C2; Wed, 26 Sep 2018 15:22:53 +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 07/22] soc/fsl/bman_portals: defer probe after bman's probe Date: Wed, 26 Sep 2018 16:22:32 +0300 Message-Id: <20180926132247.10971-8-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_062404_973215_DD34E14C X-CRM114-Status: UNSURE ( 9.98 ) 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 A crash in bman portal probing could not be triggered (as is the case with qman portals) but it does make calls [1] into the bman driver so lets make sure the bman portal probing happens after bman's. [1] bman_p_irqsource_add() (in bman) called by: init_pcfg() called by: bman_portal_probe() Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/qbman/bman_portal.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qbman/bman_portal.c b/drivers/soc/fsl/qbman/bman_portal.c index 2f71f7df3465..f9edd28894fd 100644 --- a/drivers/soc/fsl/qbman/bman_portal.c +++ b/drivers/soc/fsl/qbman/bman_portal.c @@ -91,7 +91,15 @@ static int bman_portal_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; struct bm_portal_config *pcfg; struct resource *addr_phys[2]; - int irq, cpu; + int irq, cpu, err; + + err = bman_is_probed(); + if (!err) + return -EPROBE_DEFER; + if (err < 0) { + dev_err(&pdev->dev, "failing probe due to bman probe error\n"); + return -ENODEV; + } pcfg = devm_kmalloc(dev, sizeof(*pcfg), GFP_KERNEL); if (!pcfg) From patchwork Wed Sep 26 13:22:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616059 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 73CF2913 for ; Wed, 26 Sep 2018 14:34:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FECF2B1C1 for ; Wed, 26 Sep 2018 14:34:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 538FE2B159; Wed, 26 Sep 2018 14:34:51 +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 8520D2B170 for ; Wed, 26 Sep 2018 14:34:47 +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=v65izWutRGd2k+z1tRGz4191Zu5pDCbkA0ltqz7R714=; b=IqLquvo5sx0Tux6DXTiS2UMoDC KfKo2NV2mdArZH869EbD+HXv2FfKt0URbdjC2dlnhLrIG2WMue+4ah34//bQ1TszJU+U25zuttRLH 7jueyriMueUHF/pCfxLZAcPAxZgYaqgB33ejbBqXOctcL3bpjSr4IvSoBHyptg2Vz141FQXCSjtsB scEaPVIpvYyiV7PWoGBxV98pVSxU8jsCC8PVMdc4Ud6YXs0FhnZHRmS5i8HhJ19+VY2FnUbu6Nu6e ntlmNmWzeQYLaRvL/NNewlS9FMLTUSnHZI/fbVrgoLCUnlyye58xPrCxjkp6CgxJbAmLc3XSV0fns amqRZVZQ==; 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 1g5Ato-0001od-Vl; Wed, 26 Sep 2018 14:34:45 +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 1g5Am3-0005yM-Iu for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 14:26:43 +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=kMwVPTFwesKPxiN0622p2tWv/epfHpUvDcvIhP/hXo4=; b=AX3yJPGgKgH8Z7opaI4jyA57O +F+uTVM8F5T0mSA4T5LoauM5Ik/RdGrBtewCamrQdg0+BcU3IxL5PUpjsYkAaCF9KWy7vjGeje48d 2dWu35q1Q7j9tZygBKx3QkhNLNJMOneuME278vDJ6PHCdteFxCHlZbXTOJC6ZyALqvgTz6juRkPV8 etGI1EvsWb2VyXebvyL3so5sRAxRcCJZwSWCCFRvnn73ff/+62icstR0GZifp4dY1MjBgf4VH4VR5 jJrHlp6d0p7pYaINUUFxOzmOsu7Xf0YJVeqq8sWHQ6X8EPJVh40uNi48mxuDp01t/cbfTE/XZitIo djfDka6AQ==; 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-00089G-DJ for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:40 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0CC6F1A0251; Wed, 26 Sep 2018 15:22:55 +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 0000F1A004C; Wed, 26 Sep 2018 15:22:54 +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 5A292203C2; Wed, 26 Sep 2018 15:22:54 +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 08/22] soc/fsl/qbman_portals: add APIs to retrieve the probing status Date: Wed, 26 Sep 2018 16:22:33 +0300 Message-Id: <20180926132247.10971-9-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_092339_637270_CB1377D9 X-CRM114-Status: GOOD ( 13.09 ) 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 couple of new APIs to check the probing status of the required cpu bound qman and bman portals: 'int bman_portals_probed()' and 'int qman_portals_probed()'. They return the following values. * 1 if qman/bman portals were all probed correctly * 0 if qman/bman portals were not yet probed * -1 if probing of qman/bman portals failed Drivers that use qman/bman portal driver services are required to use these APIs before calling any functions exported by these drivers or otherwise they will crash the kernel. First user will be the dpaa1 ethernet driver, coming in a subsequent patch. Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/qbman/bman_portal.c | 10 ++++++++++ drivers/soc/fsl/qbman/qman_portal.c | 10 ++++++++++ include/soc/fsl/bman.h | 8 ++++++++ include/soc/fsl/qman.h | 9 +++++++++ 4 files changed, 37 insertions(+) diff --git a/drivers/soc/fsl/qbman/bman_portal.c b/drivers/soc/fsl/qbman/bman_portal.c index f9edd28894fd..8048d35de8a2 100644 --- a/drivers/soc/fsl/qbman/bman_portal.c +++ b/drivers/soc/fsl/qbman/bman_portal.c @@ -32,6 +32,7 @@ static struct bman_portal *affine_bportals[NR_CPUS]; static struct cpumask portal_cpus; +static int __bman_portals_probed; /* protect bman global registers and global data shared among portals */ static DEFINE_SPINLOCK(bman_lock); @@ -85,6 +86,12 @@ static int bman_online_cpu(unsigned int cpu) return 0; } +int bman_portals_probed(void) +{ + return __bman_portals_probed; +} +EXPORT_SYMBOL_GPL(bman_portals_probed); + static int bman_portal_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -148,6 +155,7 @@ static int bman_portal_probe(struct platform_device *pdev) spin_lock(&bman_lock); cpu = cpumask_next_zero(-1, &portal_cpus); if (cpu >= nr_cpu_ids) { + __bman_portals_probed = 1; /* unassigned portal, skip init */ spin_unlock(&bman_lock); return 0; @@ -173,6 +181,8 @@ static int bman_portal_probe(struct platform_device *pdev) err_ioremap2: memunmap(pcfg->addr_virt_ce); err_ioremap1: + __bman_portals_probed = 1; + return -ENXIO; } diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c index eef93cab84f1..1b2fc981c269 100644 --- a/drivers/soc/fsl/qbman/qman_portal.c +++ b/drivers/soc/fsl/qbman/qman_portal.c @@ -39,6 +39,7 @@ EXPORT_SYMBOL(qman_dma_portal); #define CONFIG_FSL_DPA_PIRQ_FAST 1 static struct cpumask portal_cpus; +static int __qman_portals_probed; /* protect qman global registers and global data shared among portals */ static DEFINE_SPINLOCK(qman_lock); @@ -219,6 +220,12 @@ static int qman_online_cpu(unsigned int cpu) return 0; } +int qman_portals_probed(void) +{ + return __qman_portals_probed; +} +EXPORT_SYMBOL_GPL(qman_portals_probed); + static int qman_portal_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -306,6 +313,7 @@ static int qman_portal_probe(struct platform_device *pdev) spin_lock(&qman_lock); cpu = cpumask_next_zero(-1, &portal_cpus); if (cpu >= nr_cpu_ids) { + __qman_portals_probed = 1; /* unassigned portal, skip init */ spin_unlock(&qman_lock); return 0; @@ -336,6 +344,8 @@ static int qman_portal_probe(struct platform_device *pdev) err_ioremap2: memunmap(pcfg->addr_virt_ce); err_ioremap1: + __qman_portals_probed = -1; + return -ENXIO; } diff --git a/include/soc/fsl/bman.h b/include/soc/fsl/bman.h index 5b99cb2ea5ef..173e4049d963 100644 --- a/include/soc/fsl/bman.h +++ b/include/soc/fsl/bman.h @@ -133,5 +133,13 @@ int bman_acquire(struct bman_pool *pool, struct bm_buffer *bufs, u8 num); * failed to probe or 0 if the bman driver did not probed yet. */ int bman_is_probed(void); +/** + * bman_portals_probed - Check if all cpu bound bman portals are probed + * + * Returns 1 if all the required cpu bound bman portals successfully probed, + * -1 if probe errors appeared or 0 if the bman portals did not yet finished + * probing. + */ +int bman_portals_probed(void); #endif /* __FSL_BMAN_H */ diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h index 597783b8a3a0..7732e48081eb 100644 --- a/include/soc/fsl/qman.h +++ b/include/soc/fsl/qman.h @@ -1194,4 +1194,13 @@ int qman_release_cgrid(u32 id); */ int qman_is_probed(void); +/** + * qman_portals_probed - Check if all cpu bound qman portals are probed + * + * Returns 1 if all the required cpu bound qman portals successfully probed, + * -1 if probe errors appeared or 0 if the qman portals did not yet finished + * probing. + */ +int qman_portals_probed(void); + #endif /* __FSL_QMAN_H */ From patchwork Wed Sep 26 13:22:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615975 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 72D68913 for ; Wed, 26 Sep 2018 13:30:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 593592AF24 for ; Wed, 26 Sep 2018 13:30:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D8492AF1E; Wed, 26 Sep 2018 13:30:18 +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 75BF12AF24 for ; Wed, 26 Sep 2018 13:30:14 +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=hSWC+15g/A3Hcj6iEjWvZX6CDjTSofjZfiatyralEKg=; b=IdPq/AQxxi80KpHBqagtKRFJem tg+4uyznSz9bs/ooIsMtaTIMQWqS5SExEwJfCo2z3t+8sEnIDX+jOZoqbsPuR64+SwFgnHqhXWfis pl05Sn8p0D18pDZY0lMgVrWkwtGNPGkrH5jNOpFBjnRZgbjD3NqFT1Ykh5Dsfvd49dPs27/wmBrFU SZwixGkCxcJrQSlWGo7Tn3bnkE4mSu2j7+oA6H5bQv1Ce6soSVAekfCAAwvBL+IE1olFRfayUVHp2 +LOPUhwQgIdBx3vcNIR+iVTlw7A/pa/QERGUTVjyWONkpzN3tzUIw8FLihV2OteXIanbwwhKLXVEi Wpl28v2Q==; 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 1g59tK-0007Ra-H7; Wed, 26 Sep 2018 13:30:10 +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 1g59nQ-0004UN-JZ for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:09 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B98CF20025D; Wed, 26 Sep 2018 15:22:55 +0200 (CEST) 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 AC0B7200253; Wed, 26 Sep 2018 15:22:55 +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 119CE203C2; Wed, 26 Sep 2018 15:22:55 +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 09/22] fsl/fman: backup and restore ICID registers Date: Wed, 26 Sep 2018 16:22:34 +0300 Message-Id: <20180926132247.10971-10-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_062404_954142_988A2CD5 X-CRM114-Status: GOOD ( 10.62 ) 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 During probing, FMAN is reset thus losing all its register settings. Backup port ICID registers before reset and restore them after, similarly to how it's done on powerpc / PAMU based platforms. This also has the side effect of disabling the old code path (liodn backup/restore handling) that obviously make no sense in the context of SMMU on ARMs. Signed-off-by: Laurentiu Tudor --- drivers/net/ethernet/freescale/fman/fman.c | 35 +++++++++++++++++++++- drivers/net/ethernet/freescale/fman/fman.h | 4 +++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c index c415ac67cb7b..8f9136892d98 100644 --- a/drivers/net/ethernet/freescale/fman/fman.c +++ b/drivers/net/ethernet/freescale/fman/fman.c @@ -629,6 +629,7 @@ static void set_port_order_restoration(struct fman_fpm_regs __iomem *fpm_rg, iowrite32be(tmp, &fpm_rg->fmfp_prc); } +#ifdef CONFIG_PPC static void set_port_liodn(struct fman *fman, u8 port_id, u32 liodn_base, u32 liodn_ofst) { @@ -646,6 +647,27 @@ static void set_port_liodn(struct fman *fman, u8 port_id, iowrite32be(tmp, &fman->dma_regs->fmdmplr[port_id / 2]); iowrite32be(liodn_ofst, &fman->bmi_regs->fmbm_spliodn[port_id - 1]); } +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) +static void save_restore_port_icids(struct fman *fman, bool save) +{ + int port_idxes[] = { + 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, + 0xd, 0xe, 0xf, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x10, 0x11, 0x30, 0x31 + }; + int idx, i; + + for (i = 0; i < ARRAY_SIZE(port_idxes); i++) { + idx = port_idxes[i]; + if (save) + fman->sp_icids[idx] = + ioread32be(&fman->bmi_regs->fmbm_spliodn[idx]); + else + iowrite32be(fman->sp_icids[idx], + &fman->bmi_regs->fmbm_spliodn[idx]); + } +} +#endif static void enable_rams_ecc(struct fman_fpm_regs __iomem *fpm_rg) { @@ -1914,7 +1936,10 @@ static int fman_reset(struct fman *fman) static int fman_init(struct fman *fman) { struct fman_cfg *cfg = NULL; - int err = 0, i, count; + int err = 0, count; +#ifdef CONFIG_PPC + int i; +#endif if (is_init_done(fman->cfg)) return -EINVAL; @@ -1934,6 +1959,7 @@ static int fman_init(struct fman *fman) memset_io((void __iomem *)(fman->base_addr + CGP_OFFSET), 0, fman->state->fm_port_num_of_cg); +#ifdef CONFIG_PPC /* Save LIODN info before FMan reset * Skipping non-existent port 0 (i = 1) */ @@ -1953,6 +1979,9 @@ static int fman_init(struct fman *fman) } fman->liodn_base[i] = liodn_base; } +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) + save_restore_port_icids(fman, true); +#endif err = fman_reset(fman); if (err) @@ -2181,8 +2210,12 @@ int fman_set_port_params(struct fman *fman, if (err) goto return_err; +#ifdef CONFIG_PPC set_port_liodn(fman, port_id, fman->liodn_base[port_id], fman->liodn_offset[port_id]); +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) + save_restore_port_icids(fman, false); +#endif if (fman->state->rev_info.major < 6) set_port_order_restoration(fman->fpm_regs, port_id); diff --git a/drivers/net/ethernet/freescale/fman/fman.h b/drivers/net/ethernet/freescale/fman/fman.h index 935c317fa696..19f20fa58053 100644 --- a/drivers/net/ethernet/freescale/fman/fman.h +++ b/drivers/net/ethernet/freescale/fman/fman.h @@ -346,8 +346,12 @@ struct fman { unsigned long fifo_offset; size_t fifo_size; +#ifdef CONFIG_PPC u32 liodn_base[64]; u32 liodn_offset[64]; +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) + u32 sp_icids[64]; +#endif struct fman_dts_params dts_params; }; From patchwork Wed Sep 26 13:22:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615963 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 1FADA174A for ; Wed, 26 Sep 2018 13:26:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 052372AEE7 for ; Wed, 26 Sep 2018 13:26:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC3202AF08; Wed, 26 Sep 2018 13:26:26 +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 0C47F2AF0D for ; Wed, 26 Sep 2018 13:26:22 +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=nU5NHbmi6ptx/kVjpxKADpmd7ktWHOKM+R3AkALCTiE=; b=IpGT3fTXqtON8d423w0qtXhNWB TBlRMRAu1p8CBev3ukpHep1EYqPysWBIwSmgZebQ3kni/7IaFs7/w/Rg76NIQdHqKa/rszXjPrdqd lQCJ8PiLGip+OfesZLgZxs9/df05HDDIQQIJCuRepHVJBr7SBt9AFdcp7A+q8xr6OANWM2dOicEud mkB/+ThOZFPo16s4FNczL8vgaIH7ITqQuKu2YWLogFSqjN27Y1iI2DvJ5MfR51mElWTWr5tes3y4b mW5ESbcK3iniEJdZHWKwRE+FJj+5LZyKMeDMHqBTdhapfOQRJaOYoRa7l0acKvIDfVVsayeaBm2EY XGeWr0tA==; 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 1g59pX-00069Q-59; Wed, 26 Sep 2018 13:26:15 +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 1g59nQ-0004UP-Ig for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:06 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 741A620024C; Wed, 26 Sep 2018 15:22:56 +0200 (CEST) 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 6388520004C; Wed, 26 Sep 2018 15:22:56 +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 BD706203C2; Wed, 26 Sep 2018 15:22:55 +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 10/22] fsl/fman: add API to get the device behind a fman port Date: Wed, 26 Sep 2018 16:22:35 +0300 Message-Id: <20180926132247.10971-11-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_062404_787233_E1BA4231 X-CRM114-Status: UNSURE ( 8.50 ) 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 an API that retrieves the 'struct device' that the specified fman port probed against. The new API will be used in a subsequent iommu enablement related patch. Signed-off-by: Laurentiu Tudor --- drivers/net/ethernet/freescale/fman/fman_port.c | 14 ++++++++++++++ drivers/net/ethernet/freescale/fman/fman_port.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c index ee82ee1384eb..bd76c9730692 100644 --- a/drivers/net/ethernet/freescale/fman/fman_port.c +++ b/drivers/net/ethernet/freescale/fman/fman_port.c @@ -1728,6 +1728,20 @@ u32 fman_port_get_qman_channel_id(struct fman_port *port) } EXPORT_SYMBOL(fman_port_get_qman_channel_id); +/** + * fman_port_get_device + * port: Pointer to the FMan port device + * + * Get the 'struct device' associated to the specified FMan port device + * + * Return: pointer to associated 'struct device' + */ +struct device *fman_port_get_device(struct fman_port *port) +{ + return port->dev; +} +EXPORT_SYMBOL(fman_port_get_device); + int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset) { if (port->buffer_offsets.hash_result_offset == ILLEGAL_BASE) diff --git a/drivers/net/ethernet/freescale/fman/fman_port.h b/drivers/net/ethernet/freescale/fman/fman_port.h index 9dbb69f40121..82f12661a46d 100644 --- a/drivers/net/ethernet/freescale/fman/fman_port.h +++ b/drivers/net/ethernet/freescale/fman/fman_port.h @@ -157,4 +157,6 @@ int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp); struct fman_port *fman_port_bind(struct device *dev); +struct device *fman_port_get_device(struct fman_port *port); + #endif /* __FMAN_PORT_H */ From patchwork Wed Sep 26 13:22:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616027 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 1057215E8 for ; Wed, 26 Sep 2018 13:54:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 099102A37D for ; Wed, 26 Sep 2018 13:54:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1CA92AF3F; Wed, 26 Sep 2018 13:54:56 +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 1AC4F2A37D for ; Wed, 26 Sep 2018 13:54:53 +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=wVRGyBeTWP6PVSd9lH2lmrfepMxXoE0/mquN0poYyrM=; b=CC4gXw7VMIEO8tDKCjlSr7ULLR AgR20EOzCLUDaX1sewkD1cwOU5yqsBRU5PUin6ziDCYg59yz2xyP66lDQZ1cvNwmvz8Y2SPxVu7JB TIHr6GdbFwztvVMl3W4DcFOKErOTxIHjorCF2poo619GfqhbU1ZpLGJuUEAp+hUtZLTd7t4E7SA4N gSFWFHXohkR2ejfIlPUmr6HMsiKTVPLwf0JnSUZOw5apbso8bSNP5etGXCcLfUy02HvR6Z+22tJ+r yEjOHImWNATZp0SYEw/gBHP0MFjVvJf6gszApng9lyuleLizxFKkjZEbO1FDMBkWg8Stu2Em2+cAg bV6UI1Aw==; 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 1g5AHA-000514-Mn; Wed, 26 Sep 2018 13:54:48 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5A7U-0007Be-5G for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 13:44:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=S5mKEu05eKJdVHA7zT0doozixCjsReeflwM3O5X4wTw=; b=LXhXOsV7AmnyzoQ8IpIgt52rd /24HRkMY8bDnAzWqMSEucniuR04mdYZaw3xv9l0/JI+9g8aIXeDwt3pSkJP4F3plQzdQG0tNuEjdm cbaV47ecs39NE4KJBDMrNtLsblxuRuT77xpvWaXHuBmOZ2eEgHmyoDjjRRtCi6iT36BUw4tAU5bf1 5p4m1Jmx/dKmay/sgcSdGjP1f85r0IFmwk7DPxkef1xFEGAbLAQk3VVCsjhqS2GalEYSzmwa4BIOR iJPpTverBf3oQybK5E2zFHP28ACjBhhYE6UkQMPQ4Tw558B8f2fMU9rdpFZ6VZGj9EulViDPlvrMc GrGOiUnpw==; Received: from inva020.nxp.com ([92.121.34.13]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59mr-0008Kv-Ih for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:32 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 25C8F1A025B; Wed, 26 Sep 2018 15:22:57 +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 19CD01A004C; Wed, 26 Sep 2018 15:22:57 +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 7437D203C2; Wed, 26 Sep 2018 15:22:56 +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 11/22] dpaa_eth: defer probing after qbman Date: Wed, 26 Sep 2018 16:22:36 +0300 Message-Id: <20180926132247.10971-12-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_142329_626437_A5AC4C5E X-CRM114-Status: GOOD ( 11.67 ) 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 Enabling SMMU altered the order of device probing causing the dpaa1 ethernet driver to get probed before qbman and causing a boot crash. Add predictability in the probing order by deferring the ethernet driver probe after qbman and portals by using the recently introduced qbman APIs. Signed-off-by: Laurentiu Tudor --- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index a5131a510e8b..6ca3fdbef580 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -2765,6 +2765,37 @@ static int dpaa_eth_probe(struct platform_device *pdev) int err = 0, i, channel; struct device *dev; + err = bman_is_probed(); + if (!err) + return -EPROBE_DEFER; + if (err < 0) { + dev_err(&pdev->dev, "failing probe due to bman probe error\n"); + return -ENODEV; + } + err = qman_is_probed(); + if (!err) + return -EPROBE_DEFER; + if (err < 0) { + dev_err(&pdev->dev, "failing probe due to qman probe error\n"); + return -ENODEV; + } + err = bman_portals_probed(); + if (!err) + return -EPROBE_DEFER; + if (err < 0) { + dev_err(&pdev->dev, + "failing probe due to bman portals probe error\n"); + return -ENODEV; + } + err = qman_portals_probed(); + if (!err) + return -EPROBE_DEFER; + if (err < 0) { + dev_err(&pdev->dev, + "failing probe due to qman portals probe error\n"); + return -ENODEV; + } + /* device used for DMA mapping */ dev = pdev->dev.parent; err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40)); From patchwork Wed Sep 26 13:22:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616023 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 D9C5014BD for ; Wed, 26 Sep 2018 13:53:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D342928718 for ; Wed, 26 Sep 2018 13:53:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C695A28773; Wed, 26 Sep 2018 13:53:10 +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 0930328718 for ; Wed, 26 Sep 2018 13:53:06 +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=GJOouc+NPvGiPGhBoG0aDMOuqGwBH+B4sdfKuaUKivM=; b=d4g6gzeO3XJPRu71UyeoCr48Ks d1CAk0xDFmxYeQoujeeTFRBIAAFQ1ry4o3bHMpdS2w0KmZgE5xkbghvNe+JG923ciQGyRUwumiQzZ KjvyxN7O6+u4MjX/SeMgrPvpwVRjUxKniVODD1y7PAkUCZsI8HKURlHI4tzZNVhGZyPzkOQlO/h0e 7TqNROX0tzJX+WjD7m297bJsnXet23g6uj85uIRgSr5QBnJsQwHFQHv1DXRSzKk/StH88zwoh6kxr 6+2uUSK5RXig+SK3yL48I9evcTwqyU4GiE3IsbzeA9c7dG+WNAR7eWCqxwrBoSrWIo5zDMT8rp1jR tfXQSllw==; 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 1g5AFL-0004NE-J3; Wed, 26 Sep 2018 13:52:55 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5A7U-00072A-2n for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 13:44:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=qir3fQs8SMsTk6deRtazlS4QF6RmOqJCwLELxxMLLM8=; b=nRDuBlCKD0wN6uoF4o8AiQlaW GcMXmjaFTOJHd61wDqFyyPr1PjQpa8QhaUstAjXcpYQzSAtdIKNef6Mx7fbVwQXYCM2J4ZaahclAG 4WfeZPm9aIMnQfYcbP0ZO8F/3eD0HF9ELtFgzxU1A5t1cWrWOOMeR/PDecpDf/1NKKOfJb2QGlKN7 qBP2u9ojBF64AW+n/clVYF8AMHDUPhImxyQ+FPoB7O6yRDGS5beuM82o5FD5j569posfw4bgcWrg+ UtI7UtxqZEx+VLe5eno14C7M7mTAVmPDgunUpbjAcDWF1UudB9DsBCAIVuPV5jFEs9QKZAJ5qQNap IzvmmkTaw==; Received: from inva020.nxp.com ([92.121.34.13]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59mr-0008Kw-AI for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:23:32 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id D66EC1A025C; Wed, 26 Sep 2018 15:22:57 +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 C81BA1A004C; Wed, 26 Sep 2018 15:22:57 +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 2BD67203C2; Wed, 26 Sep 2018 15:22:57 +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 12/22] dpaa_eth: base dma mappings on the fman rx port Date: Wed, 26 Sep 2018 16:22:37 +0300 Message-Id: <20180926132247.10971-13-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_142329_377291_4DEEE8A5 X-CRM114-Status: GOOD ( 12.91 ) 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 The dma transactions initiator is the rx fman port so that's the device that the dma mappings should be done. Previously the mappings were done through the MAC device which makes no sense because it's neither dma-able nor connected in any way to smmu. Signed-off-by: Laurentiu Tudor --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 6ca3fdbef580..ac9e50c8a556 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -2796,8 +2796,15 @@ static int dpaa_eth_probe(struct platform_device *pdev) return -ENODEV; } + mac_dev = dpaa_mac_dev_get(pdev); + if (IS_ERR(mac_dev)) { + dev_err(&pdev->dev, "dpaa_mac_dev_get() failed\n"); + err = PTR_ERR(mac_dev); + goto probe_err; + } + /* device used for DMA mapping */ - dev = pdev->dev.parent; + dev = fman_port_get_device(mac_dev->port[RX]); err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40)); if (err) { dev_err(dev, "dma_coerce_mask_and_coherent() failed\n"); @@ -2822,13 +2829,6 @@ static int dpaa_eth_probe(struct platform_device *pdev) priv->msg_enable = netif_msg_init(debug, DPAA_MSG_DEFAULT); - mac_dev = dpaa_mac_dev_get(pdev); - if (IS_ERR(mac_dev)) { - dev_err(dev, "dpaa_mac_dev_get() failed\n"); - err = PTR_ERR(mac_dev); - goto free_netdev; - } - /* If fsl_fm_max_frm is set to a higher value than the all-common 1500, * we choose conservatively and let the user explicitly set a higher * MTU via ifconfig. Otherwise, the user may end up with different MTUs @@ -2964,9 +2964,9 @@ static int dpaa_eth_probe(struct platform_device *pdev) qman_release_cgrid(priv->cgr_data.cgr.cgrid); free_dpaa_bps: dpaa_bps_free(priv); -free_netdev: dev_set_drvdata(dev, NULL); free_netdev(net_dev); +probe_err: return err; } From patchwork Wed Sep 26 13:22:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615977 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 04A03174A for ; Wed, 26 Sep 2018 13:31:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEC4C2AF36 for ; Wed, 26 Sep 2018 13:31:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC8A72AF52; Wed, 26 Sep 2018 13:31: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 EDB8C2AF37 for ; Wed, 26 Sep 2018 13:31: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=YC/m6OmSfGbx//2nIwp44FsVFH7Ch4KEHQC+IV4OrSg=; b=CvGjBiDQRl4o8ENrCCeFRf1W89 IejlUpDGc/nT8xE8dlthipJtrnYxObYIwww0av/8StFVoO9LJafyqb1GnL4LWfJk4kPXnmN9FqYmo yrC+jIah/ZHJ0GTJgd56gXM0ie9fVDI7dCkYjt2r4vqb1c5rj71eb/i19ghwF4t5bafXrLGXw/iLM KwMN2oNryptjgrl2tNSmCdAVfYSDBzJC4Mp7MgEmSOUVbyXmbQRBDYge7lXxPn6FXk/JyxITUTWIm pX5dykhzm5NUm2KIP1whhUIH5/cgHO20r2iLFiKFnmcmpN2VXWXjZi3snvhBr7sioV7Ct1ONm/Fhg rpbe51Wg==; 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 1g59uA-0000Xg-S0; Wed, 26 Sep 2018 13:31:02 +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 1g59nQ-0004UJ-JC for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:09 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8CB031A025F; Wed, 26 Sep 2018 15:22:58 +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 801A21A004C; Wed, 26 Sep 2018 15:22:58 +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 DA739203C2; Wed, 26 Sep 2018 15:22:57 +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 13/22] dpaa_eth: fix iova handling for contiguous frames Date: Wed, 26 Sep 2018 16:22:38 +0300 Message-Id: <20180926132247.10971-14-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_062404_942754_1C941DD8 X-CRM114-Status: GOOD ( 14.21 ) 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 The driver relies on the no longer valid assumption that dma addresses (iovas) are identical to physical addressees and uses phys_to_virt() to make iova -> vaddr conversions. Fix this by adding a function that does proper iova -> phys conversions using the iommu api and update the code to use it. Also, a dma_unmap_single() call had to be moved further down the code because iova -> vaddr conversions were required before the unmap. For now only the contiguous frame case is handled and the SG case is split in a following patch. While at it, clean-up a redundant dpaa_bpid2pool() and pass the bp as parameter. Signed-off-by: Laurentiu Tudor --- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index ac9e50c8a556..e9e081c3f8cc 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -1595,6 +1596,17 @@ static int dpaa_eth_refill_bpools(struct dpaa_priv *priv) return 0; } +static phys_addr_t dpaa_iova_to_phys(struct device *dev, dma_addr_t addr) +{ + struct iommu_domain *domain; + + domain = iommu_get_domain_for_dev(dev); + if (domain) + return iommu_iova_to_phys(domain, addr); + else + return addr; +} + /* Cleanup function for outgoing frame descriptors that were built on Tx path, * either contiguous frames or scatter/gather ones. * Skb freeing is not handled here. @@ -1617,7 +1629,7 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, int nr_frags, i; u64 ns; - skbh = (struct sk_buff **)phys_to_virt(addr); + skbh = (struct sk_buff **)phys_to_virt(dpaa_iova_to_phys(dev, addr)); skb = *skbh; if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { @@ -1687,25 +1699,21 @@ static u8 rx_csum_offload(const struct dpaa_priv *priv, const struct qm_fd *fd) * accommodate the shared info area of the skb. */ static struct sk_buff *contig_fd_to_skb(const struct dpaa_priv *priv, - const struct qm_fd *fd) + const struct qm_fd *fd, + struct dpaa_bp *dpaa_bp, + void *vaddr) { ssize_t fd_off = qm_fd_get_offset(fd); - dma_addr_t addr = qm_fd_addr(fd); - struct dpaa_bp *dpaa_bp; struct sk_buff *skb; - void *vaddr; - vaddr = phys_to_virt(addr); WARN_ON(!IS_ALIGNED((unsigned long)vaddr, SMP_CACHE_BYTES)); - dpaa_bp = dpaa_bpid2pool(fd->bpid); - if (!dpaa_bp) - goto free_buffer; - skb = build_skb(vaddr, dpaa_bp->size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))); - if (WARN_ONCE(!skb, "Build skb failure on Rx\n")) - goto free_buffer; + if (WARN_ONCE(!skb, "Build skb failure on Rx\n")) { + skb_free_frag(vaddr); + return NULL; + } WARN_ON(fd_off != priv->rx_headroom); skb_reserve(skb, fd_off); skb_put(skb, qm_fd_get_length(fd)); @@ -1713,10 +1721,6 @@ static struct sk_buff *contig_fd_to_skb(const struct dpaa_priv *priv, skb->ip_summed = rx_csum_offload(priv, fd); return skb; - -free_buffer: - skb_free_frag(vaddr); - return NULL; } /* Build an skb with the data of the first S/G entry in the linear portion and @@ -2302,12 +2306,12 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal, if (!dpaa_bp) return qman_cb_dqrr_consume; - dma_unmap_single(dpaa_bp->dev, addr, dpaa_bp->size, DMA_FROM_DEVICE); - /* prefetch the first 64 bytes of the frame or the SGT start */ - vaddr = phys_to_virt(addr); + vaddr = phys_to_virt(dpaa_iova_to_phys(dpaa_bp->dev, addr)); prefetch(vaddr + qm_fd_get_offset(fd)); + dma_unmap_single(dpaa_bp->dev, addr, dpaa_bp->size, DMA_FROM_DEVICE); + /* The only FD types that we may receive are contig and S/G */ WARN_ON((fd_format != qm_fd_contig) && (fd_format != qm_fd_sg)); @@ -2318,7 +2322,7 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal, (*count_ptr)--; if (likely(fd_format == qm_fd_contig)) - skb = contig_fd_to_skb(priv, fd); + skb = contig_fd_to_skb(priv, fd, dpaa_bp, vaddr); else skb = sg_fd_to_skb(priv, fd); if (!skb) From patchwork Wed Sep 26 13:22:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615983 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 9A7BF174A for ; Wed, 26 Sep 2018 13:32:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DA102AF24 for ; Wed, 26 Sep 2018 13:32:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 719092AF3C; Wed, 26 Sep 2018 13:32:53 +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 797912AF24 for ; Wed, 26 Sep 2018 13:32:49 +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=vxtWOyJcdneI925I+aWjSORGD3Sc7brc50ugELIpa4Q=; b=tItNeDlkZd6XznYcuhR7jQjh7E mou/QlZIR55JGpEBRNgtS2ACxAzto0RmFDaRCFE4HOeaMb5URV7dYgtufwO91koBLY3/jq75wU9e1 W0Gnu7z5zHjJ0NJPknfre5pSUiBgesOu18UG0Owi4+2y/2F+BXwEq1AowGXxC5rLzSser/gQddEL3 qxGNHHTJWzI+Q5ATmqVJkH9mV1tNJ4UAg8dAhbYKMfDGWZkEuw2W5MdRLl9kOh/HIOKeKbe68tpEL FKUJbVRTHOjpYI9wm7waRohMpw4SZanFqSYVQa4MRHYvZD8jNxYPxS0Z8N5fTNg+j2LJ3CYqCnpFL k9B56SCA==; 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 1g59vi-0001Ew-MW; Wed, 26 Sep 2018 13:32:38 +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 1g59nQ-0004UI-LV for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:13 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 44F731A0267; Wed, 26 Sep 2018 15:22:59 +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 382691A004C; Wed, 26 Sep 2018 15:22:59 +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 91F14203C2; Wed, 26 Sep 2018 15:22:58 +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 14/22] dpaa_eth: fix iova handling for sg frames Date: Wed, 26 Sep 2018 16:22:39 +0300 Message-Id: <20180926132247.10971-15-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_062405_068867_3B7A1DC2 X-CRM114-Status: GOOD ( 12.20 ) 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 The driver relies on the no longer valid assumption that dma addresses (iovas) are identical to physical addressees and uses phys_to_virt() to make iova -> vaddr conversions. Fix this also for scatter-gather frames using the iova -> phys conversion function added in the previous patch. While at it, clean-up a redundant dpaa_bpid2pool() and pass the bp as parameter. Signed-off-by: Laurentiu Tudor --- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index e9e081c3f8cc..8db861f281a0 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -1646,14 +1646,17 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, if (unlikely(qm_fd_get_format(fd) == qm_fd_sg)) { nr_frags = skb_shinfo(skb)->nr_frags; - dma_unmap_single(dev, addr, - qm_fd_get_offset(fd) + DPAA_SGT_SIZE, - dma_dir); /* The sgt buffer has been allocated with netdev_alloc_frag(), * it's from lowmem. */ - sgt = phys_to_virt(addr + qm_fd_get_offset(fd)); + sgt = phys_to_virt(dpaa_iova_to_phys(dev, + addr + + qm_fd_get_offset(fd))); + + dma_unmap_single(dev, addr, + qm_fd_get_offset(fd) + DPAA_SGT_SIZE, + dma_dir); /* sgt[0] is from lowmem, was dma_map_single()-ed */ dma_unmap_single(dev, qm_sg_addr(&sgt[0]), @@ -1668,7 +1671,7 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, } /* Free the page frag that we allocated on Tx */ - skb_free_frag(phys_to_virt(addr)); + skb_free_frag(skbh); } else { dma_unmap_single(dev, addr, skb_tail_pointer(skb) - (u8 *)skbh, dma_dir); @@ -1729,14 +1732,14 @@ static struct sk_buff *contig_fd_to_skb(const struct dpaa_priv *priv, * The page fragment holding the S/G Table is recycled here. */ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, - const struct qm_fd *fd) + const struct qm_fd *fd, + struct dpaa_bp *dpaa_bp, + void *vaddr) { ssize_t fd_off = qm_fd_get_offset(fd); - dma_addr_t addr = qm_fd_addr(fd); const struct qm_sg_entry *sgt; struct page *page, *head_page; - struct dpaa_bp *dpaa_bp; - void *vaddr, *sg_vaddr; + void *sg_vaddr; int frag_off, frag_len; struct sk_buff *skb; dma_addr_t sg_addr; @@ -1745,7 +1748,6 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, int *count_ptr; int i; - vaddr = phys_to_virt(addr); WARN_ON(!IS_ALIGNED((unsigned long)vaddr, SMP_CACHE_BYTES)); /* Iterate through the SGT entries and add data buffers to the skb */ @@ -1756,14 +1758,18 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, WARN_ON(qm_sg_entry_is_ext(&sgt[i])); sg_addr = qm_sg_addr(&sgt[i]); - sg_vaddr = phys_to_virt(sg_addr); - WARN_ON(!IS_ALIGNED((unsigned long)sg_vaddr, - SMP_CACHE_BYTES)); /* We may use multiple Rx pools */ dpaa_bp = dpaa_bpid2pool(sgt[i].bpid); - if (!dpaa_bp) + if (!dpaa_bp) { + pr_info("%s: fail to get dpaa_bp for sg bpid %d\n", + __func__, sgt[i].bpid); goto free_buffers; + } + sg_vaddr = phys_to_virt(dpaa_iova_to_phys(dpaa_bp->dev, + sg_addr)); + WARN_ON(!IS_ALIGNED((unsigned long)sg_vaddr, + SMP_CACHE_BYTES)); count_ptr = this_cpu_ptr(dpaa_bp->percpu_count); dma_unmap_single(dpaa_bp->dev, sg_addr, dpaa_bp->size, @@ -1835,10 +1841,11 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, /* free all the SG entries */ for (i = 0; i < DPAA_SGT_MAX_ENTRIES ; i++) { sg_addr = qm_sg_addr(&sgt[i]); - sg_vaddr = phys_to_virt(sg_addr); - skb_free_frag(sg_vaddr); dpaa_bp = dpaa_bpid2pool(sgt[i].bpid); if (dpaa_bp) { + sg_addr = dpaa_iova_to_phys(dpaa_bp->dev, sg_addr); + sg_vaddr = phys_to_virt(sg_addr); + skb_free_frag(sg_vaddr); count_ptr = this_cpu_ptr(dpaa_bp->percpu_count); (*count_ptr)--; } @@ -2324,7 +2331,7 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal, if (likely(fd_format == qm_fd_contig)) skb = contig_fd_to_skb(priv, fd, dpaa_bp, vaddr); else - skb = sg_fd_to_skb(priv, fd); + skb = sg_fd_to_skb(priv, fd, dpaa_bp, vaddr); if (!skb) return qman_cb_dqrr_consume; From patchwork Wed Sep 26 13:22:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615965 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 850163CF1 for ; Wed, 26 Sep 2018 13:27:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B3C62AF02 for ; Wed, 26 Sep 2018 13:27:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DFB22AF0C; Wed, 26 Sep 2018 13:27:06 +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 8283B2AF0F for ; Wed, 26 Sep 2018 13:27:02 +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=RhZUcQ0F8tbbjAPxeGhNvfaX2wGdMRGFcEaVjOwB4mY=; b=AmVng5445lj3ex7Oe4csu3agJt uPJhzG/NLea8xR3WVVDeRBYb4iErv4uD2G1J0n1udhAz9dxHfdmGsOpbmEHQrN1uV9dN9tRnzH6e0 cDq0EyTVz3YWUHw5HWqKWTY6PYvowe0q6gOB+2ZXdpr52GTHD4y7lNrebip7NWgulHNFWJ1Q5+Gg+ muXi3BEhDvE0wnEj6MKvaO9ELmD0XGi3WsZC85YWJk1pdAiNt25th+zKGYEAR37HXfeo9c/pCwrVg N9xcyxFJq2xl8/phgvqiM/csR4kt/Nxn/ZY2a7OvgXS7XW7u73+UOxP7XYEEOdENFFp2UGoY5ELhO no0Fn8Zg==; 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 1g59qF-0006OR-UW; Wed, 26 Sep 2018 13:26:59 +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 1g59nQ-0004UQ-Iz for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:06 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 05E3C200253; Wed, 26 Sep 2018 15:23:00 +0200 (CEST) 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 ECD8220004C; Wed, 26 Sep 2018 15:22:59 +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 49506203C2; Wed, 26 Sep 2018 15:22:59 +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 15/22] dpaa_eth: fix SG frame cleanup Date: Wed, 26 Sep 2018 16:22:40 +0300 Message-Id: <20180926132247.10971-16-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_062404_810907_3A5CA4E7 X-CRM114-Status: UNSURE ( 9.64 ) 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 Fix issue with the entry indexing in the sg frame cleanup code being off-by-1. This problem showed up when doing some basic iperf tests and manifested in traffic coming to a halt. Signed-off-by: Laurentiu Tudor --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 8db861f281a0..605f06f0def8 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -1663,7 +1663,7 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, qm_sg_entry_get_len(&sgt[0]), dma_dir); /* remaining pages were mapped with skb_frag_dma_map() */ - for (i = 1; i < nr_frags; i++) { + for (i = 1; i <= nr_frags; i++) { WARN_ON(qm_sg_entry_is_ext(&sgt[i])); dma_unmap_page(dev, qm_sg_addr(&sgt[i]), From patchwork Wed Sep 26 13:22:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615973 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 75078174A for ; Wed, 26 Sep 2018 13:29:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 575DA2AD7B for ; Wed, 26 Sep 2018 13:29:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B4852AF07; Wed, 26 Sep 2018 13:29:34 +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 748E92AD7B for ; Wed, 26 Sep 2018 13:29:30 +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=36hlglE7v8++P135qDKJtlMMNff71z+5aYPyVGUpyNs=; b=lzUwX4UAYUIh55D/TI4Zk9+DJ4 wj152l/OUX0SzdP7NzWRdGSrLq2+oscxqGLhPiCN37Lwnl0xkA77PwTGXdD1L+b7B4q27CCiflw80 knFoVaz14hhX8TQjX+4j5PD3BoNrBvtGhw3gse6QsHJdW0Iap+nF8V1ZjZevowiAITCaamvahEJMP Pib9uy+Zf3V/qDfxLHXlXt0pXMyAJj/N+QtKFPH73MocxCE+cIb/Z8EFCIRwdL4tcWcys2ouHrqUJ nVnuIpYfLnit8uXV12F7WmmCmZipB0ayqawD0MQpzQaS6aiiHj6hMQfUqKJRv3Nw1g9UmFhO0g1NI 6I3phENg==; 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 1g59sY-0007BC-Pv; Wed, 26 Sep 2018 13:29:22 +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 1g59nQ-0004W8-JW for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:09 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B215B200261; Wed, 26 Sep 2018 15:23:00 +0200 (CEST) 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 A459320004C; Wed, 26 Sep 2018 15:23:00 +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 0A1D1203C2; Wed, 26 Sep 2018 15:23:00 +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 16/22] arm64: dts: ls1046a: add smmu node Date: Wed, 26 Sep 2018 16:22:41 +0300 Message-Id: <20180926132247.10971-17-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_062404_827160_3416054D X-CRM114-Status: UNSURE ( 7.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: 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 This allows for the SMMU device to be probed by the SMMU kernel driver. Signed-off-by: Laurentiu Tudor --- .../arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index ef83786b8b90..07a853a0aeaa 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -228,6 +228,48 @@ bus-width = <4>; }; + mmu: iommu@9000000 { + compatible = "arm,mmu-500"; + reg = <0 0x9000000 0 0x400000>; + dma-coherent; + #global-interrupts = <2>; + #iommu-cells = <1>; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + }; + scfg: scfg@1570000 { compatible = "fsl,ls1046a-scfg", "syscon"; reg = <0x0 0x1570000 0x0 0x10000>; From patchwork Wed Sep 26 13:22:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615979 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 EA10F174A for ; Wed, 26 Sep 2018 13:32:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD0172AF1B for ; Wed, 26 Sep 2018 13:32:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF29E2AF24; Wed, 26 Sep 2018 13:32:05 +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 037202AF24 for ; Wed, 26 Sep 2018 13:32:01 +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=z/gapqM2AbJ+amj7wtHoa7xJ2m+gw8F8NI7dmot/zXs=; b=I+5seOm9oi6KirVSSaMhliZ1r7 PKl0elBOvkLWYUFvKPfmexQSMPrQsRLYi/hUAKi/2lK23wWRmwbv+Rtb07ZL1Ne+i5gy1tOJp/3j7 6ViGKXTjchtAORGILsi/Wu1IEufyv+gKMFJ20AtNgooIFopABqIf1BAfr1qrFI86J+/R/8AfaJ65h 425hLxsSIQN5+6zL55TUv3adLhKpjg5Vdjzj0XZRuYVS4jNFfbxaUuzu+ceFxysNRBecPTFU6veVJ I4mPRdJ/1ZtLf+Yz3ND6+sAfHR1sFbUqCzL5Qyvko1ocmdiQSddYf9WZ+HN5GC4pT1II9NQTSwtQ5 FgYc3r6g==; 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 1g59uw-0000pr-9v; Wed, 26 Sep 2018 13:31:50 +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 1g59nQ-0004W9-RD for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:13 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 67AA420004C; Wed, 26 Sep 2018 15:23:01 +0200 (CEST) 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 5B70A2002A2; Wed, 26 Sep 2018 15:23:01 +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 B5D97203C2; Wed, 26 Sep 2018 15:23:00 +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 17/22] arm64: dts: ls1043a: add smmu node Date: Wed, 26 Sep 2018 16:22:42 +0300 Message-Id: <20180926132247.10971-18-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_062405_097741_7A9C9D7D X-CRM114-Status: UNSURE ( 7.71 ) 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 This allows for the SMMU device to be probed by the SMMU kernel driver. Signed-off-by: Laurentiu Tudor --- .../arm64/boot/dts/freescale/fsl-ls1043a.dtsi | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi index 7881e3d81a9a..7eea2bace171 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi @@ -222,6 +222,48 @@ clocks = <&sysclk>; }; + mmu: iommu@9000000 { + compatible = "arm,mmu-500"; + reg = <0 0x9000000 0 0x400000>; + dma-coherent; + #global-interrupts = <2>; + #iommu-cells = <1>; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + }; + scfg: scfg@1570000 { compatible = "fsl,ls1043a-scfg", "syscon"; reg = <0x0 0x1570000 0x0 0x10000>; From patchwork Wed Sep 26 13:22:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616011 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 6677414BD for ; Wed, 26 Sep 2018 13:47:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D62E2AF32 for ; Wed, 26 Sep 2018 13:47:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BA382AF3D; Wed, 26 Sep 2018 13:47:58 +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 8FB122AF3C for ; Wed, 26 Sep 2018 13:47:54 +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=dYDOTzCX9KO0ArfVxC8TT0z/kAhL//VfBpRjBPj1/1Q=; b=eDGZfxdeCRn8HfSrckKUdMnAIL aCrc75k+5+xBhfRrF4ie68vdhg5YebjRxccmm2TVEW7zxhvZ0zFJb2A1ju/t5XcFG9KLlE2OQUSuz SnNAJzsTyBl7sYcrhyj9CXII9VC4jXzRvzHtPTER8sqn8t+XebB/unsg96P4Rc2Xy3XSnZqnLWr5R k24mZLq3oz8CDW9efC33wiis6FTb/TxX7jiglO8Ip+h3bJw+JPDmPVJdY+fOa77H6r3/8HaQD0Np8 e6PuuZ8ViTOiC8n6ZdSo9FCxAWGZvpkGUwLPOEBLdrZ7VeLW6bQ1RlDSanhHOg4adlY7YLnqgtaJv fDcIcrSg==; 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 1g5AAL-00016R-3J; Wed, 26 Sep 2018 13:47:45 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5A7Q-0007Ao-7U for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 13:44:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=vhXtoO9qWAowbNn8+UJUON+4quiA/Dxp088TAiXc7Rg=; b=Rc9s729Ae3EfNElaBGN/IKJDu YJFz7v0aFv1wV7vbgB+YLP785flQ4S0XgqcjcWGaCqp0e2Im16XMLZ988o1XM5Tt36YJEC4KnhXuY M1eS3wtbKUjzK0HYpouNnIR6kCtwK+l8wJPtpO/eUSqFQr2j1dJZjmxXiuzW88kaH98bRDbqxnVIN DKd0v0mXMNgPcCLWSogo3F0IIrR9nUq7nbjp99QNec3tJ5bhQki9QK6oNqXvctENtDH+yxY1LP35y Ckd2daWt01tRMe6njJ8reKwQY8zEEJ9hkU30nG4v4nik6erjPZhE7bCwNQG9XOWUaudF8dpAUe+6Y rnsQNB12Q==; Received: from inva021.nxp.com ([92.121.34.21]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59nh-0008Qe-NV for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:23 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 15BAA2002A2; Wed, 26 Sep 2018 15:23:02 +0200 (CEST) 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 132A72002D5; Wed, 26 Sep 2018 15:23:02 +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 6D3F0203C2; Wed, 26 Sep 2018 15:23:01 +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 18/22] arm64: dts: ls104xa: set mask to drop TBU ID from StreamID Date: Wed, 26 Sep 2018 16:22:43 +0300 Message-Id: <20180926132247.10971-19-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_142421_783639_AA250D5F X-CRM114-Status: GOOD ( 10.52 ) 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 The StreamID entering the SMMU is actually a concatenation of the SMMU TBU ID and the ICID configured in software. Since the TBU ID is internal to the SoC and since we want that the actual the ICID configured in software to enter the SMMU witout any additional set bits, mask out the TBU ID bits and leave only the relevant ICID bits to enter SMMU. Signed-off-by: Laurentiu Tudor --- arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi | 1 + arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi index 7eea2bace171..1f9b385007a8 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi @@ -226,6 +226,7 @@ compatible = "arm,mmu-500"; reg = <0 0x9000000 0 0x400000>; dma-coherent; + stream-match-mask = <0x7f00>; #global-interrupts = <2>; #iommu-cells = <1>; interrupts = , diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index 07a853a0aeaa..22bf3975492a 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -232,6 +232,7 @@ compatible = "arm,mmu-500"; reg = <0 0x9000000 0 0x400000>; dma-coherent; + stream-match-mask = <0x7f00>; #global-interrupts = <2>; #iommu-cells = <1>; interrupts = , From patchwork Wed Sep 26 13:22:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615987 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 C1186913 for ; Wed, 26 Sep 2018 13:34:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6C582946B for ; Wed, 26 Sep 2018 13:34:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AFDA299DA; Wed, 26 Sep 2018 13:34:26 +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 D519729494 for ; Wed, 26 Sep 2018 13:34:22 +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=OdZmBcqwjGMhgmjU3KTLAgwsS2uNF/REkFjscGEF5uo=; b=hYNet5XWUPT5SfIIoRmCGE7r66 b7rgZoMUH/Wo+CS2ciA4HzuvvJPrMvoLRn1z233SVoyy/J/xCd57DhYxyU5bEhwAfpHzPvgmQdS/Q hXke9y2vkNcf0A+2I5HJQmjpzNCf7kPH6RyAT+zzGyju5ZBbC82DqZXBOPbVFUohKcsaXA7eHqTXy wJ3NidKd7QZD+SGlcDvezkD8x7ZhR6fcbxddps1Hk3J3zwtmWe9ohWEOu0WXWKkYIAAKkmGXeD1NQ QxMJi0aAXSvvE0D1h6as7goEg0bgxvLOZjy4UM+xGPsJxwSPw/9LkstFKiJKVEb7LuROEFZX+yIKa fblOOWpA==; 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 1g59xH-0001nn-RU; Wed, 26 Sep 2018 13:34:15 +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 1g59nd-0004WZ-2g for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:18 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id D4E152002CA; Wed, 26 Sep 2018 15:23:02 +0200 (CEST) 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 C8362200268; Wed, 26 Sep 2018 15:23:02 +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 24DE2203C2; Wed, 26 Sep 2018 15:23:02 +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 19/22] arm64: dts: ls104x: add missing dma ranges property Date: Wed, 26 Sep 2018 16:22:44 +0300 Message-Id: <20180926132247.10971-20-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_062417_298518_05731D73 X-CRM114-Status: UNSURE ( 8.01 ) 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 These chips have a 48-bit address size so make sure that the dma-ranges reflects this. Otherwise the linux kernel's dma sub-system will set the default dma masks to full 64-bit, badly breaking dmas. Signed-off-by: Laurentiu Tudor --- arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi | 1 + arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi index 1f9b385007a8..0e8fc8f29997 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi @@ -214,6 +214,7 @@ #address-cells = <2>; #size-cells = <2>; ranges; + dma-ranges = <0x0 0x0 0x0 0x0 0x10000 0x00000000>; clockgen: clocking@1ee1000 { compatible = "fsl,ls1043a-clockgen"; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index 22bf3975492a..29b07bdd4207 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -187,6 +187,7 @@ #address-cells = <2>; #size-cells = <2>; ranges; + dma-ranges = <0x0 0x0 0x0 0x0 0x10000 0x00000000>; ddr: memory-controller@1080000 { compatible = "fsl,qoriq-memory-controller"; From patchwork Wed Sep 26 13:22:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616053 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 92D3D913 for ; Wed, 26 Sep 2018 14:31:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C3452B184 for ; Wed, 26 Sep 2018 14:31:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A2532B17C; Wed, 26 Sep 2018 14:31:13 +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 B09912B15F for ; Wed, 26 Sep 2018 14:31:09 +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=B6BfWhtu+9Go2RVzbAgOBlCLwlRIBROW/j4B2xwVVkM=; b=NHSE0PqjjmW/pdAFG+KMJ+px2d qBcI/6pDZiJky9aCjKfcA8VjuecbMO3i8/5tMi2ekLbzuJgrQZKko2K5grbrtxir0Th9trS5igQCU BfOux0pTIgvRijucT1LkrlZ7yhl51zltuqdt+Pqy0qAdRykR7ajKPZbjBxDs+H9xtAXoeAaPL76+5 8b+FTaKY7TCcEnIgtOBIWzrC3sSbkCE7VQcE5f/frMK3fMDUhBergCarZBrMHNx539Q5NyiCI3Y8m K/IWUvYZMlnGzoI4D6CkFvAmFk6ae5v3/BUKofLKBtUlELuwFdaUgTb0e8slqrzeBDmw79L+fobu1 7jyA9C2A==; 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 1g5AqC-0000Xl-Al; Wed, 26 Sep 2018 14:31:00 +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 1g5Alz-0005yM-5b for linux-arm-kernel@bombadil.infradead.org; Wed, 26 Sep 2018 14:26:39 +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=hDQQI9Bt+G6up2w8jqjkH8OQh92JGil8K2fnNInzl7c=; b=gO0ISnWBp/VOxPLHCE5pJ9iuh 638btlpO3jYl8ds1ETKNYICjdilbU1NE2GaZsOqBqT/RuMBpbnrLkH3ZoWMOiSfX8PWQ34JQdjMtV GJRqOAXj0wcFSw4o2VMH78yIQ5+O+MTzk2W/StXPFHOO6oLGlN44vVUrM35yhLBQOkCcPPmy3LIZn QAIYiEQZwEEzlOYoI9bj/jEgccSlPeefHcGXSScmmiP2XkIkA/o0vM6chjRpQq3v4iVefl4dwmbim 8vgUhLFZ267WnjRLT8uK85MlC1ORXp4EcLpYXXYdp4+QWzjxzR2nz3LL2GVnXuodphZMxhaCklmX+ Sor+IdfIQ==; Received: from inva021.nxp.com ([92.121.34.21]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g59nk-0008Ae-1B for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:24 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 82CCC200271; Wed, 26 Sep 2018 15:23:03 +0200 (CEST) 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 805C7200265; Wed, 26 Sep 2018 15:23:03 +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 D9E57203C2; Wed, 26 Sep 2018 15:23:02 +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 20/22] arm64: dts: ls104x: add iommu-map to pci controllers Date: Wed, 26 Sep 2018 16:22:45 +0300 Message-Id: <20180926132247.10971-21-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_092424_206017_ABA0F402 X-CRM114-Status: UNSURE ( 8.30 ) 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 The pci controllers are also behind the smmu so add the iommu-map property to reflect this. The bootloader needs to patch the stream id ranges to some sane values. Signed-off-by: Laurentiu Tudor --- arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi | 3 +++ arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 3 +++ 2 files changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi index 0e8fc8f29997..ccadc40a36f4 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi @@ -716,6 +716,7 @@ #size-cells = <2>; device_type = "pci"; dma-coherent; + iommu-map = <0 &mmu 0 1>; num-lanes = <4>; bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x00000000 0x40 0x00010000 0x0 0x00010000 /* downstream I/O */ @@ -741,6 +742,7 @@ #size-cells = <2>; device_type = "pci"; dma-coherent; + iommu-map = <0 &mmu 0 1>; num-lanes = <2>; bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x00000000 0x48 0x00010000 0x0 0x00010000 /* downstream I/O */ @@ -766,6 +768,7 @@ #size-cells = <2>; device_type = "pci"; dma-coherent; + iommu-map = <0 &mmu 0 1>; num-lanes = <2>; bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x00000000 0x50 0x00010000 0x0 0x00010000 /* downstream I/O */ diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index 29b07bdd4207..a12d33362554 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -685,6 +685,7 @@ #size-cells = <2>; device_type = "pci"; dma-coherent; + iommu-map = <0 &mmu 0 1>; num-lanes = <4>; bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x00000000 0x40 0x00010000 0x0 0x00010000 /* downstream I/O */ @@ -710,6 +711,7 @@ #size-cells = <2>; device_type = "pci"; dma-coherent; + iommu-map = <0 &mmu 0 1>; num-lanes = <2>; bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x00000000 0x48 0x00010000 0x0 0x00010000 /* downstream I/O */ @@ -735,6 +737,7 @@ #size-cells = <2>; device_type = "pci"; dma-coherent; + iommu-map = <0 &mmu 0 1>; num-lanes = <2>; bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x00000000 0x50 0x00010000 0x0 0x00010000 /* downstream I/O */ From patchwork Wed Sep 26 13:22:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10616003 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 AB5C0174A for ; Wed, 26 Sep 2018 13:40:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 981BA2AF10 for ; Wed, 26 Sep 2018 13:40:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C0112AF13; Wed, 26 Sep 2018 13:40:37 +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 AEDED2AF10 for ; Wed, 26 Sep 2018 13:40: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: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=m6U+c8QjYxQqHaQLTuNslUtmlwxXeNw1fZRMd5qdguo=; b=T6A89NzfJeode917i4v47LpSS8 jTV9BPZ4lpMbJEbvKmd2Fh7954x3ZtfA5mnRANOoLMMCJ4h3OSipoG13e5yicUKT+Ls0ewL/+LzvH KUxFtkcwI6UGj38Q7fxZLDw6TjP1iaUh6925QPcSY211S9LUags0OFmObSodFQ1dl13+uC4z/hmZF 3efkUHrXT8peO1gG19XhbiRupj0lzAx6P5AGOKVzhsRwueVz4kXU7DwI8ezPdCwe+HFTiBaF0Ckx0 82DtBmQmEUJqJ8FyoW7lo1feGoDSgHHCSZVjRmCcuVK7HI9NceU3XjboDm+Th040xOxnwkme810hR sC1x1hKg==; 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 1g5A3J-0005Eb-0F; Wed, 26 Sep 2018 13:40:29 +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 1g59nQ-0004UL-JY for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:09 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 44ED01A0262; Wed, 26 Sep 2018 15:23:04 +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 3811E1A025D; Wed, 26 Sep 2018 15:23:04 +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 91ED7203C2; Wed, 26 Sep 2018 15:23:03 +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 21/22] arm64: dts: ls104x: make dma-coherent global to the SoC Date: Wed, 26 Sep 2018 16:22:46 +0300 Message-Id: <20180926132247.10971-22-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_062404_819788_D7AAC416 X-CRM114-Status: UNSURE ( 8.44 ) 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 These SoCs are really completely dma coherent in their entirety so add the dma-coherent property at the soc level in the device tree and drop the instances where it's specifically added to a few select devices. Signed-off-by: Laurentiu Tudor --- arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi | 5 +---- arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi index ccadc40a36f4..9fb3ac0fa87c 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi @@ -215,6 +215,7 @@ #size-cells = <2>; ranges; dma-ranges = <0x0 0x0 0x0 0x0 0x10000 0x00000000>; + dma-coherent; clockgen: clocking@1ee1000 { compatible = "fsl,ls1043a-clockgen"; @@ -680,7 +681,6 @@ reg-names = "ahci", "sata-ecc"; interrupts = <0 69 0x4>; clocks = <&clockgen 4 0>; - dma-coherent; }; msi1: msi-controller1@1571000 { @@ -715,7 +715,6 @@ #address-cells = <3>; #size-cells = <2>; device_type = "pci"; - dma-coherent; iommu-map = <0 &mmu 0 1>; num-lanes = <4>; bus-range = <0x0 0xff>; @@ -741,7 +740,6 @@ #address-cells = <3>; #size-cells = <2>; device_type = "pci"; - dma-coherent; iommu-map = <0 &mmu 0 1>; num-lanes = <2>; bus-range = <0x0 0xff>; @@ -767,7 +765,6 @@ #address-cells = <3>; #size-cells = <2>; device_type = "pci"; - dma-coherent; iommu-map = <0 &mmu 0 1>; num-lanes = <2>; bus-range = <0x0 0xff>; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index a12d33362554..f19cf6087235 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -188,6 +188,7 @@ #size-cells = <2>; ranges; dma-ranges = <0x0 0x0 0x0 0x0 0x10000 0x00000000>; + dma-coherent; ddr: memory-controller@1080000 { compatible = "fsl,qoriq-memory-controller"; From patchwork Wed Sep 26 13:22:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10615985 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 40F75174A for ; Wed, 26 Sep 2018 13:33:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27A5827FA5 for ; Wed, 26 Sep 2018 13:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B3BB28390; Wed, 26 Sep 2018 13:33: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=-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 52DFC27FA5 for ; Wed, 26 Sep 2018 13:33:25 +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=AMaLV6J1py1/owGgdZ0DAqLLpCw7zmXEL7SvoGEAagM=; b=HxESTSXfo8VAuus7tEjjqG6+/O FQPPj+7iBPO1EsbT6cBxY3GbJfSzqbnZM2tF8Hyfyq73NVbySd9rhPHKB/B62sKACEgsP6VDwMyYQ RunlLhoBS716CHXEmG4GmbrqBRzkAUHJbGnxMb2ebHFiFt0hFbijPUTaddeuraYZnTd+ZBv4ck17g CW6i+TLcepdyu0WSF8orYavvE61y6FilOSqN55omh178vu6Asx+vGQ4VVLX/fZOiyWWP6dO1Ua1hi O9FNcd0Ifz2TeigZkNvtsLQRaNL5s21r7EQknuorhfZxdtIlVmRbnIAC08p1ByerzTLk4vjgxkSKo xtCSGacw==; 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 1g59wP-0001Wt-RH; Wed, 26 Sep 2018 13:33:21 +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 1g59nQ-0004UM-OV for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:24:14 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id F1D8B1A004C; Wed, 26 Sep 2018 15:23:04 +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 E42491A0278; Wed, 26 Sep 2018 15:23:04 +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 4A60F203C2; Wed, 26 Sep 2018 15:23:04 +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 22/22] arm64: dts: ls104x: use a pseudo-bus to constrain usb dma size Date: Wed, 26 Sep 2018 16:22:47 +0300 Message-Id: <20180926132247.10971-23-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_062405_134659_4C646B55 X-CRM114-Status: UNSURE ( 8.66 ) 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 Wrap the usb controllers in an intermediate simple-bus and use it to constrain the dma address size of these usb controllers to the 40 bits that they generate toward the interconnect. This is required because the SoC uses 48 bits address sizes and this mismatch would lead to smmu context faults because the usb generates 40-bit addresses while the smmu page tables are populated with 48-bit wide addresses. Suggested-by: Robin Murphy Signed-off-by: Laurentiu Tudor --- .../arm64/boot/dts/freescale/fsl-ls1043a.dtsi | 58 +++++++++++-------- .../arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 58 +++++++++++-------- 2 files changed, 66 insertions(+), 50 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi index 9fb3ac0fa87c..44a1964e560b 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi @@ -647,31 +647,39 @@ <&clockgen 4 0>; }; - usb0: usb3@2f00000 { - compatible = "snps,dwc3"; - reg = <0x0 0x2f00000 0x0 0x10000>; - interrupts = <0 60 0x4>; - dr_mode = "host"; - snps,quirk-frame-length-adjustment = <0x20>; - snps,dis_rxdet_inp3_quirk; - }; - - usb1: usb3@3000000 { - compatible = "snps,dwc3"; - reg = <0x0 0x3000000 0x0 0x10000>; - interrupts = <0 61 0x4>; - dr_mode = "host"; - snps,quirk-frame-length-adjustment = <0x20>; - snps,dis_rxdet_inp3_quirk; - }; - - usb2: usb3@3100000 { - compatible = "snps,dwc3"; - reg = <0x0 0x3100000 0x0 0x10000>; - interrupts = <0 63 0x4>; - dr_mode = "host"; - snps,quirk-frame-length-adjustment = <0x20>; - snps,dis_rxdet_inp3_quirk; + usb_aux_bus: usb_aux_bus { + #address-cells = <2>; + #size-cells = <2>; + compatible = "simple-bus"; + ranges; + dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x00000000>; + + usb0: usb3@2f00000 { + compatible = "snps,dwc3"; + reg = <0x0 0x2f00000 0x0 0x10000>; + interrupts = <0 60 0x4>; + dr_mode = "host"; + snps,quirk-frame-length-adjustment = <0x20>; + snps,dis_rxdet_inp3_quirk; + }; + + usb1: usb3@3000000 { + compatible = "snps,dwc3"; + reg = <0x0 0x3000000 0x0 0x10000>; + interrupts = <0 61 0x4>; + dr_mode = "host"; + snps,quirk-frame-length-adjustment = <0x20>; + snps,dis_rxdet_inp3_quirk; + }; + + usb2: usb3@3100000 { + compatible = "snps,dwc3"; + reg = <0x0 0x3100000 0x0 0x10000>; + interrupts = <0 63 0x4>; + dr_mode = "host"; + snps,quirk-frame-length-adjustment = <0x20>; + snps,dis_rxdet_inp3_quirk; + }; }; sata: sata@3200000 { diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index f19cf6087235..edee071aaefd 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -608,31 +608,39 @@ <&clockgen 4 1>; }; - usb0: usb@2f00000 { - compatible = "snps,dwc3"; - reg = <0x0 0x2f00000 0x0 0x10000>; - interrupts = ; - dr_mode = "host"; - snps,quirk-frame-length-adjustment = <0x20>; - snps,dis_rxdet_inp3_quirk; - }; - - usb1: usb@3000000 { - compatible = "snps,dwc3"; - reg = <0x0 0x3000000 0x0 0x10000>; - interrupts = ; - dr_mode = "host"; - snps,quirk-frame-length-adjustment = <0x20>; - snps,dis_rxdet_inp3_quirk; - }; - - usb2: usb@3100000 { - compatible = "snps,dwc3"; - reg = <0x0 0x3100000 0x0 0x10000>; - interrupts = ; - dr_mode = "host"; - snps,quirk-frame-length-adjustment = <0x20>; - snps,dis_rxdet_inp3_quirk; + usb_aux_bus: usb_aux_bus { + #address-cells = <2>; + #size-cells = <2>; + compatible = "simple-bus"; + ranges; + dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x00000000>; + + usb0: usb@2f00000 { + compatible = "snps,dwc3"; + reg = <0x0 0x2f00000 0x0 0x10000>; + interrupts = ; + dr_mode = "host"; + snps,quirk-frame-length-adjustment = <0x20>; + snps,dis_rxdet_inp3_quirk; + }; + + usb1: usb@3000000 { + compatible = "snps,dwc3"; + reg = <0x0 0x3000000 0x0 0x10000>; + interrupts = ; + dr_mode = "host"; + snps,quirk-frame-length-adjustment = <0x20>; + snps,dis_rxdet_inp3_quirk; + }; + + usb2: usb@3100000 { + compatible = "snps,dwc3"; + reg = <0x0 0x3100000 0x0 0x10000>; + interrupts = ; + dr_mode = "host"; + snps,quirk-frame-length-adjustment = <0x20>; + snps,dis_rxdet_inp3_quirk; + }; }; sata: sata@3200000 {