From patchwork Wed Jul 15 07:06:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 11664335 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 602F76C1 for ; Wed, 15 Jul 2020 07:08:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3851E20663 for ; Wed, 15 Jul 2020 07:08:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qOMSYnkT"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=semihalf-com.20150623.gappssmtp.com header.i=@semihalf-com.20150623.gappssmtp.com header.b="ROeZDbiY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3851E20663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=semihalf.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=PVFF77YODqSqdTCiV50eDF3Y7JXsNWaL7nBfHNWYeKQ=; b=qOMSYnkT+d5mNnDCceC88t1fuW 0zcT4PMUwS3z4J2pNPk6DuvAVIYzUC12Yh15biUlCAVFqpmXPcYoLtBlHJ25NWInND7aE9VyJ0N3f ZgK3zyPpgZEplhHEf9ojgJjcbnkWl56cNo1YRHM+OjVpndTrzvmK250qbF9U0+ehU/0zIjmh2zsIL 1mVx3lv//f5FNnlUwmIuhCeq99VK1H7s8gjn5AnoF1jhT+33shtWXpVesnmypE4H5a1u3s7JGTrhj nRYcKvoflpMbaNN709ragnYmm6ttuZUgdFQmKZNYOKZNPJkilYKGd7x3wg/FDV9Fb3XgWmlWeBzVP AxAfXxLQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvbVU-0007Kn-8h; Wed, 15 Jul 2020 07:07:08 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvbVO-0007Ic-EF for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2020 07:07:03 +0000 Received: by mail-lj1-x244.google.com with SMTP id j11so1367627ljo.7 for ; Wed, 15 Jul 2020 00:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rDtvw0IlmYfY+jCdx2Lo57EMXtb9r+H9pF0oFjzHHyo=; b=ROeZDbiYc0S1qiJ+zPLW4iZ2xz7bxM4vKz+szew4oa0S3/i4Tsj9Db1Djs8wqhrDPA wJVmm30Nnb2KdsbXPrZWchGqSXHO720gjZZkro0giw2+zCmubxZOI5ILdKnQ3th9Xdgz l/awUtt1Ygeq4YioavlodnaPxhV7HYI8iIqmhbGdcs1ZMKNyL751oDG7y1lUrJTmJkwj 0tq+FC77087fb7ayIUN30UuhGJcEX2m20NDwm58NrsDBJIIpNiD8XN94SUyUxYRa3PD1 4ayfacD0RrkjIymW0xkigMB25F+DaQAQ5F3f4ISektuOrjdIKKU4GzSmG++qj2D1fL7X wfEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rDtvw0IlmYfY+jCdx2Lo57EMXtb9r+H9pF0oFjzHHyo=; b=Mx/vqlGtp5tQs+YX6FiUGNmJgeUHbY/GeHuJZN7cP0aZqJrqTc1ZyHvrQdCA4AU2AB 4XAeVrPZODKXpPGgM+lDLvBUsFFBCJnJzWUgntJx+EpWEjntidkgK1jTd9KR+6ZU7mW5 Hd4ofKcMx6wIEKymBAuIWUx08ZFyW28ljdWUi5RYHhQ+M8Iqz1LzI70qAdjJ1EBOCYBj CXbiohkoogE+sasO3G0MFaYV8gbkXEFxlRfz8hOhAWofaQZmvqQFAAEH+2SVY5qMhrD7 CrREkSqolcH/hN5PdWytMcDeiFwlQHouAiZnt/jcDK7Er6Olf5jpXVynGZsgxHlMZC/1 0hyw== X-Gm-Message-State: AOAM531VLvtSa6eWyJIQqX+uQnZz+GQE6W1lZvYdobJX6XKlFTn47F/O a5eWSmWKMRevNn1w8sUXyFnHog== X-Google-Smtp-Source: ABdhPJydCAuceNb5bOv6bKj797GCX8yDPnodbrk36mq0CVMxEl0bcpvWYkELgCrKsdNuJMCF/cXNlg== X-Received: by 2002:a2e:3619:: with SMTP id d25mr4044931lja.204.1594796821024; Wed, 15 Jul 2020 00:07:01 -0700 (PDT) Received: from localhost.localdomain ([83.68.95.66]) by smtp.gmail.com with ESMTPSA id 83sm276040ljj.51.2020.07.15.00.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 00:07:00 -0700 (PDT) From: Tomasz Nowicki To: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, gregory.clement@bootlin.com, robh+dt@kernel.org, hannah@marvell.com Subject: [PATCH v4 1/4] iommu/arm-smmu: Call configuration impl hook before consuming features Date: Wed, 15 Jul 2020 09:06:46 +0200 Message-Id: <20200715070649.18733-2-tn@semihalf.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715070649.18733-1-tn@semihalf.com> References: <20200715070649.18733-1-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200715_030702_492177_A9A19693 X-CRM114-Status: GOOD ( 15.04 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:244 listed in] [list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, nadavh@marvell.com, iommu@lists.linux-foundation.org, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 'cfg_probe' hook is called at the very end of configuration probing procedure and therefore features override and workaround may become complex like for ID register fixups. In preparation for adding Marvell errata move 'cfg_probe' a bit earlier to have chance to adjust the detected features before we start consuming them. Since the Cavium quirk (the only user) does not alter features it is safe to do so. Suggested-by: Robin Murphy Signed-off-by: Tomasz Nowicki Reviewed-by: Robin Murphy --- drivers/iommu/arm-smmu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 243bc4cb2705..19f906de6420 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1728,7 +1728,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) unsigned int size; u32 id; bool cttw_reg, cttw_fw = smmu->features & ARM_SMMU_FEAT_COHERENT_WALK; - int i; + int i, ret; dev_notice(smmu->dev, "probing hardware configuration...\n"); dev_notice(smmu->dev, "SMMUv%d with:\n", @@ -1891,6 +1891,12 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) smmu->features |= ARM_SMMU_FEAT_FMT_AARCH64_64K; } + if (smmu->impl && smmu->impl->cfg_probe) { + ret = smmu->impl->cfg_probe(smmu); + if (ret) + return ret; + } + /* Now we've corralled the various formats, what'll it do? */ if (smmu->features & ARM_SMMU_FEAT_FMT_AARCH32_S) smmu->pgsize_bitmap |= SZ_4K | SZ_64K | SZ_1M | SZ_16M; @@ -1918,9 +1924,6 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) dev_notice(smmu->dev, "\tStage-2: %lu-bit IPA -> %lu-bit PA\n", smmu->ipa_size, smmu->pa_size); - if (smmu->impl && smmu->impl->cfg_probe) - return smmu->impl->cfg_probe(smmu); - return 0; } From patchwork Wed Jul 15 07:06:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 11664333 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECF906C1 for ; Wed, 15 Jul 2020 07:08:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C643C2065E for ; Wed, 15 Jul 2020 07:08:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KHuwxIR6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=semihalf-com.20150623.gappssmtp.com header.i=@semihalf-com.20150623.gappssmtp.com header.b="gF+PCH8l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C643C2065E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=semihalf.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=Dvo9vp9w4I2AYTYr3ror9XbxjdoqZ8lw2nu4rpGXsuE=; b=KHuwxIR62BiEfq4xmEWvSk6Biy fPE5atsX3d0Lq3gu7qgYEv/R5AFP9HFsA8g02PCx/uHj2OVoo82rEa2LN5aq+E3mNw08D+6jrWQ/K HqnDuqwiUrORoSnl9bq60aOcZOqynKqtEgwrRThrusVQ04Dnb3CKrHQXLXEtjbRPjx1WSuLEsnvgQ jAvkg9kYqWtncYp8bLYU/dHEA016OnouNnQDVPlDy4ktSG48pIjpuEQox/m0j4AHrQ9JrdtWgCVDI bvnD3NXFW8bv83Stbryh/vhe6qQ9r3fM9QsEh7xsAStrIvYWWWAJmr49Zqo02zKUzg21KXin7t0Jf HYO/7jDw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvbVX-0007Lu-Rx; Wed, 15 Jul 2020 07:07:11 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvbVP-0007J3-MV for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2020 07:07:04 +0000 Received: by mail-lj1-x243.google.com with SMTP id e4so1397848ljn.4 for ; Wed, 15 Jul 2020 00:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XKlU4lKdj3Ftg6VNKCWCajRZmLcVTJL9ntL6mukO1Xo=; b=gF+PCH8lg8YMRFFsAE56yzhfmMGgdqCwmFwD+TI9qs4NjXA1tiHS6Ng9cBRIlXAV0+ WCkjEPG3UJIHt6DeJHB/FjIubAtTL7CyxsoPExKei5HJM7ySufym6lJ+h8iRL9+vTUsw ISdsHJA9pYutZad938G9Urv189itUM0pmpe5WHRkQeLIjIhFcCykEhxNOtkdVMccCWtz EaTHFk3ScQ1oGdXiGcH/YtvSNom4QWkw2pEzygUwSi6xF6IHglEVq5V0amRAeFsVCEkZ +HTLxpKlANISyR6cgjlLextWUoGANjHqlz0Lv5HJ6im9wyutODiiMlXFlGzJTSIoqyIs zuAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XKlU4lKdj3Ftg6VNKCWCajRZmLcVTJL9ntL6mukO1Xo=; b=JJEtCIuuGgklguR2WU9PqB7CaMhLHxuI6mARTXOstrWpnzHlMcDfXwZJGkHpWqoPDc 5fDZNyUDD2ZLEeJkgjE5I9yY5aBIGksanfxSPw1Aa63Qa6MfDz3gOxhUGSQqV7IwJvZD jyc+5cZDvfUBZ/nt1z1ecAwONdK7wkL0Btuh3N5+iWXn7VCxadof7FR4yoaL4fD8dEGh hWSxRPzs8tCCTkSDYqOpALqfu94X7Du4cx3nDmoiusen93XIPS/TX4Fkv978MmCTdd/+ eUPJY07HnrPDbL0S0KGPEMLQykz3mgc7SeD8ASbp7ZhZTU20voHqgj3B9cK7Ybk2ekX/ PASQ== X-Gm-Message-State: AOAM5309Vkp6Mz+4FUW2D6TevCINyIh7Gf63A2M1a0Ur3Hwdl3Ca5Gbk c5Jr1TVCITxTiJOE3uNO3xIXug== X-Google-Smtp-Source: ABdhPJyht9u1Fi6qxzop87V103kj55HzGKn38flKrFtKPYX7IW+C8BjpSSZJXdo5uDLpBlP6rEyH7Q== X-Received: by 2002:a2e:9585:: with SMTP id w5mr3671931ljh.58.1594796822599; Wed, 15 Jul 2020 00:07:02 -0700 (PDT) Received: from localhost.localdomain ([83.68.95.66]) by smtp.gmail.com with ESMTPSA id 83sm276040ljj.51.2020.07.15.00.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 00:07:01 -0700 (PDT) From: Tomasz Nowicki To: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, gregory.clement@bootlin.com, robh+dt@kernel.org, hannah@marvell.com Subject: [PATCH v4 2/4] iommu/arm-smmu: Workaround for Marvell Armada-AP806 SoC erratum #582743 Date: Wed, 15 Jul 2020 09:06:47 +0200 Message-Id: <20200715070649.18733-3-tn@semihalf.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715070649.18733-1-tn@semihalf.com> References: <20200715070649.18733-1-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200715_030703_803829_FBA93265 X-CRM114-Status: GOOD ( 15.20 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:243 listed in] [list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, nadavh@marvell.com, iommu@lists.linux-foundation.org, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Hanna Hawa Due to erratum #582743, the Marvell Armada-AP806 can't access 64bit to ARM SMMUv2 registers. Provide implementation relevant hooks: - split the writeq/readq to two accesses of writel/readl. - mask the MMU_IDR2.PTFSv8 fields to not use AArch64 format (but only AARCH32_L) since with AArch64 format 32 bits access is not supported. Note that most 64-bit registers like TTBRn can be accessed as two 32-bit halves without issue, and AArch32 format ensures that the register writes which must be atomic (for TLBI etc.) need only be 32-bit. Signed-off-by: Hanna Hawa Signed-off-by: Gregory CLEMENT Signed-off-by: Tomasz Nowicki Reviewed-by: Robin Murphy --- Documentation/arm64/silicon-errata.rst | 3 ++ drivers/iommu/arm-smmu-impl.c | 45 ++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst index 936cf2a59ca4..157214d3abe1 100644 --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -125,6 +125,9 @@ stable kernels. | Cavium | ThunderX2 Core | #219 | CAVIUM_TX2_ERRATUM_219 | +----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ +| Marvell | ARM-MMU-500 | #582743 | N/A | ++----------------+-----------------+-----------------+-----------------------------+ ++----------------+-----------------+-----------------+-----------------------------+ | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | +----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c index c75b9d957b70..59422cb92488 100644 --- a/drivers/iommu/arm-smmu-impl.c +++ b/drivers/iommu/arm-smmu-impl.c @@ -147,6 +147,48 @@ static const struct arm_smmu_impl arm_mmu500_impl = { .reset = arm_mmu500_reset, }; +static u64 mrvl_mmu500_readq(struct arm_smmu_device *smmu, int page, int off) +{ + /* + * Marvell Armada-AP806 erratum #582743. + * Split all the readq to double readl + */ + return hi_lo_readq_relaxed(arm_smmu_page(smmu, page) + off); +} + +static void mrvl_mmu500_writeq(struct arm_smmu_device *smmu, int page, int off, + u64 val) +{ + /* + * Marvell Armada-AP806 erratum #582743. + * Split all the writeq to double writel + */ + hi_lo_writeq_relaxed(val, arm_smmu_page(smmu, page) + off); +} + +static int mrvl_mmu500_cfg_probe(struct arm_smmu_device *smmu) +{ + + /* + * Armada-AP806 erratum #582743. + * Hide the SMMU_IDR2.PTFSv8 fields to sidestep the AArch64 + * formats altogether and allow using 32 bits access on the + * interconnect. + */ + smmu->features &= ~(ARM_SMMU_FEAT_FMT_AARCH64_4K | + ARM_SMMU_FEAT_FMT_AARCH64_16K | + ARM_SMMU_FEAT_FMT_AARCH64_64K); + + return 0; +} + +static const struct arm_smmu_impl mrvl_mmu500_impl = { + .read_reg64 = mrvl_mmu500_readq, + .write_reg64 = mrvl_mmu500_writeq, + .cfg_probe = mrvl_mmu500_cfg_probe, + .reset = arm_mmu500_reset, +}; + struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) { @@ -175,5 +217,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) of_device_is_compatible(np, "qcom,sc7180-smmu-500")) return qcom_smmu_impl_init(smmu); + if (of_device_is_compatible(np, "marvell,ap806-smmu-500")) + smmu->impl = &mrvl_mmu500_impl; + return smmu; } From patchwork Wed Jul 15 07:06:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 11664337 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC4F013B1 for ; Wed, 15 Jul 2020 07:08:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B47E52065E for ; Wed, 15 Jul 2020 07:08:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fJnGovbN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=semihalf-com.20150623.gappssmtp.com header.i=@semihalf-com.20150623.gappssmtp.com header.b="aZI38iW+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B47E52065E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=semihalf.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=Y0eclO0+lC2wMMIfiYRQDBEy7kmBb6j6HMYAq2Gs1qU=; b=fJnGovbNXe25qwjpo9K//W7pZT lC1A9YHyvdnOVIv4J4P6EqD6G87dhF0QXdsMCUQnd8ckcQEqQxEEBjM7OZtU+7HlB15RfX9paYLBE w0sgQuD85sUHqdHcCx/lA8OsyRoW/H1WpvQlOfZDAtK1UkE9A4MMIHLAK6yz/s+uUDjX7UtBUm/8b FtrRaaCKs/Mittc8VAV9Y3T0rDqrJe9IMK+CNzhSMZOWKLNTUzOwGZ5XVMPpspd5yvXOwltLFhbcI B3SM0qhH1G4TrmrI5sCLzx6cktS/ZeKwudhRvOJymyDYfoWVfpaSMVZC0dZ/UgmzPefXvUUsKb2Eq +N81MX4g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvbVe-0007OO-64; Wed, 15 Jul 2020 07:07:18 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvbVR-0007Je-9E for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2020 07:07:06 +0000 Received: by mail-lj1-x244.google.com with SMTP id d17so1416629ljl.3 for ; Wed, 15 Jul 2020 00:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AN6q6cpkTRxXQWeyGXCEz+5PNSY4fUKCWqUMoq2I19U=; b=aZI38iW+N0p3zR3+9g94ZzT2QSUYjfLbOoKQH33KYYGZ49ABOvH3cOqHSUnLzI/Evi zUcxdYazJI8D/ZT1inTTCw0evilhYmHEN4B9syQCe4F3E+RVsDJFnUq9PanfLe33vDC7 6mQiKU+ReumQ7VdYGC6R4yUmVdA4cpOnOWqwUn6cH32i4HEWXyVOBfjwWUN2k+YPvrvc ps2gcDe3uq84j7bnC0r2fJ8t3D2H9aJ7zRaqNTTevpifETcg19ApyEL7Gw/trUsRXT2f mZGiBd1RLGJHA3vk8jsOH6EnGAw2Cp90AHomKWgZ4QaDG5zTqUF31ifFxk4bNkzbG762 hb1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AN6q6cpkTRxXQWeyGXCEz+5PNSY4fUKCWqUMoq2I19U=; b=DfFHIYzTPBRbdYPe1yH2eQlj+lLKoLP3oPn39RUfxLIWBcDwoEXE1MyHHuyKh8tHev /FVXqJKln+K4i93HiSb+/MEzfka/NudEZXhjUPIyX3nHZCqH/J1GLLM7zoaNUM82XJdL g9nfcX0qK917EliZRAoyCX0irg2KmGOaalJxN3FgC8k4MLRYGCc0g0lH4/+H55hF3DkY AXH2uX4J8UTMln88CUz7SwkmaxfHYc83o2PVbcoNScTxVCv8YrTwy6bS2kEzNfK3Ny5S DSiIGAN6XBsraWodF40HUy9lBw/SNyzkVpeN0T23heZqbIrc3BqcQVVygidlR/CnbKFQ bidA== X-Gm-Message-State: AOAM5317BkzbhFYQhoXbZhLmQcxbdIJpdDLqH2CE3vVOaIH3d7jaFthv PGLfbG0CBgcnzS7SjrLFlQn/MA== X-Google-Smtp-Source: ABdhPJw8wXKSMLWdz7iN/fEgokVzEzLgEAN75R0DOvwEGBnD1GhqcFfMd0XYyzHDbz0qTTPoOhMbJg== X-Received: by 2002:a05:651c:3d1:: with SMTP id f17mr3951936ljp.203.1594796824219; Wed, 15 Jul 2020 00:07:04 -0700 (PDT) Received: from localhost.localdomain ([83.68.95.66]) by smtp.gmail.com with ESMTPSA id 83sm276040ljj.51.2020.07.15.00.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 00:07:03 -0700 (PDT) From: Tomasz Nowicki To: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, gregory.clement@bootlin.com, robh+dt@kernel.org, hannah@marvell.com Subject: [PATCH v4 3/4] dt-bindings: arm-smmu: add compatible string for Marvell Armada-AP806 SMMU-500 Date: Wed, 15 Jul 2020 09:06:48 +0200 Message-Id: <20200715070649.18733-4-tn@semihalf.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715070649.18733-1-tn@semihalf.com> References: <20200715070649.18733-1-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200715_030705_423631_2B21B2C6 X-CRM114-Status: GOOD ( 10.22 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:244 listed in] [list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, nadavh@marvell.com, iommu@lists.linux-foundation.org, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add specific compatible string for Marvell usage due to errata of accessing 64bits registers of ARM SMMU, in AP806. AP806 SoC uses the generic ARM-MMU500, and there's no specific implementation of Marvell, this compatible is used for errata only. Reviewed-by: Rob Herring Signed-off-by: Hanna Hawa Signed-off-by: Gregory CLEMENT Signed-off-by: Tomasz Nowicki Reviewed-by: Robin Murphy --- Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml index d7ceb4c34423..156b38924a00 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml @@ -38,6 +38,10 @@ properties: - qcom,sc7180-smmu-500 - qcom,sdm845-smmu-500 - const: arm,mmu-500 + - description: Marvell SoCs implementing "arm,mmu-500" + items: + - const: marvell,ap806-smmu-500 + - const: arm,mmu-500 - items: - const: arm,mmu-500 - const: arm,smmu-v2 From patchwork Wed Jul 15 07:06:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 11664341 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAD856C1 for ; Wed, 15 Jul 2020 07:08:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9400620663 for ; Wed, 15 Jul 2020 07:08:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SL30Dgbu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=semihalf-com.20150623.gappssmtp.com header.i=@semihalf-com.20150623.gappssmtp.com header.b="M5yRZ7ZN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9400620663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=semihalf.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=Nz4qDASGnkG2WmKiiFXXKeQp7Y5VUA494Ptr8vadyFE=; b=SL30DgbusFObH4ZgZ+ciBIVtLH 9EUxZuTZQ0xadZ/kONnDTzFzCs9aga5WQu4oANBXzF7bVjvX43UgbNSqJsTi6Wz8ELLOZd23QERj3 qcSV4TuCiWfFAUBOqOdESJzlRTi24xae7tan2AODMi2mVhFDGG+p98molbvl492Zm5p1UotudvP+q EsDWiWOiQvGmZMmclTemJGpvsKaCg8TWDw/Y63uLfMOGf+oekedOs716AHliDhbw8Iq6e/cMF101w DceEwFO6/gzektv/Js7cLU+xNAFmazcjhAQX3V2bgerE4b9UdNEC7lvhPTjNI5veQrWQiHwmURCfj hZM2yQEQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvbVj-0007QE-JY; Wed, 15 Jul 2020 07:07:23 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvbVT-0007K9-5g for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2020 07:07:08 +0000 Received: by mail-lj1-x242.google.com with SMTP id r19so1316487ljn.12 for ; Wed, 15 Jul 2020 00:07:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VY6/nDkB+l4D8VdfNdnYyBq9q17cRBW9+cu/3oGCNgQ=; b=M5yRZ7ZNspTd64Y3T6EJeSR8BEe9OMlQ4XzMqNsOL1aKRBkPYizWm15squLSNLr9f4 rBa60eFJit6+maotnQ0qwVNmkkLEr4LVlSlzvj50dEO69YdHS5LGWqgTJl3WaayqMB8R Ss6sFZTMqqjWmVvbOlQURv3BkEDVa/Hs+YtYv7dc6MrmaUbbM4HVBY0SmwiSfe+i3cFi 4+58toaeQyrLor5BcsThGO+Y+N1NOvzG0UskCEa6PKcaO3ky/HnQ0o061JCSBoKZf7Da 9TPt7j8CUVnAL6og2kyuNqRC+YEboLTL+BgBpgFEUYvj2Or8EzdjCQuqd1NoOSsGkyTI wmCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VY6/nDkB+l4D8VdfNdnYyBq9q17cRBW9+cu/3oGCNgQ=; b=iK5mL0CEs8Ucjc+RUnBV5Gu5MfwBB6prybXRfGFWIcY9N7Dnf13+viMSTp1vp+Heeg PdzOm1FWPZZl6KTIpMtE863wRfbdlBGI/GAOhun+PtxNz71ekFxmUnFegBKrKb4ijpOh iT8Owv3s40nm+4P1gsEZbd5yBxV1JIoxekCdzXobwqMQbuOkx5IVS5YjP6WVRXzs0+MT jShZXjBpBF33Ax5LYoY+StR4OuBMd601MVHuaLlCe5bPkU+A1EBCVExsU+87X+0dVOJ2 A0dIYxVk3rby3SWyeqTq0phFwz31t04r7phSCWoroYAoWKuYYOMaE7QGuwMjwOmRb9c3 j7Hg== X-Gm-Message-State: AOAM533crlbK7y0OQ1V5GoP2kfud6h1m35mo2nbsInyJJFrSErw7GFzs djRIdt8zwyNKktzhjWq5zShQwA== X-Google-Smtp-Source: ABdhPJwrpgLAN7Afl7yoGdK1hqq6n9x3hw3elslWkLxcDk1FTatcRnB2CeQPdKz7PyWfn5zgrTCMAQ== X-Received: by 2002:a2e:859a:: with SMTP id b26mr4332777lji.241.1594796825939; Wed, 15 Jul 2020 00:07:05 -0700 (PDT) Received: from localhost.localdomain ([83.68.95.66]) by smtp.gmail.com with ESMTPSA id 83sm276040ljj.51.2020.07.15.00.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 00:07:05 -0700 (PDT) From: Tomasz Nowicki To: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, gregory.clement@bootlin.com, robh+dt@kernel.org, hannah@marvell.com Subject: [PATCH v4 4/4] arm64: dts: marvell: add SMMU support Date: Wed, 15 Jul 2020 09:06:49 +0200 Message-Id: <20200715070649.18733-5-tn@semihalf.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715070649.18733-1-tn@semihalf.com> References: <20200715070649.18733-1-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200715_030707_242306_995F9783 X-CRM114-Status: GOOD ( 11.97 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:242 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, nadavh@marvell.com, iommu@lists.linux-foundation.org, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Marcin Wojtas Add IOMMU node for Marvell AP806 based SoCs together with platform and PCI device Stream ID mapping. Signed-off-by: Marcin Wojtas Signed-off-by: Tomasz Nowicki --- arch/arm64/boot/dts/marvell/armada-7040.dtsi | 28 +++++++++++++ arch/arm64/boot/dts/marvell/armada-8040.dtsi | 40 +++++++++++++++++++ arch/arm64/boot/dts/marvell/armada-ap80x.dtsi | 18 +++++++++ 3 files changed, 86 insertions(+) diff --git a/arch/arm64/boot/dts/marvell/armada-7040.dtsi b/arch/arm64/boot/dts/marvell/armada-7040.dtsi index 47247215770d..7a3198cd7a07 100644 --- a/arch/arm64/boot/dts/marvell/armada-7040.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-7040.dtsi @@ -14,3 +14,31 @@ compatible = "marvell,armada7040", "marvell,armada-ap806-quad", "marvell,armada-ap806"; }; + +&smmu { + status = "okay"; +}; + +&cp0_pcie0 { + iommu-map = + <0x0 &smmu 0x480 0x20>, + <0x100 &smmu 0x4a0 0x20>, + <0x200 &smmu 0x4c0 0x20>; + iommu-map-mask = <0x031f>; +}; + +&cp0_sata0 { + iommus = <&smmu 0x444>; +}; + +&cp0_sdhci0 { + iommus = <&smmu 0x445>; +}; + +&cp0_usb3_0 { + iommus = <&smmu 0x440>; +}; + +&cp0_usb3_1 { + iommus = <&smmu 0x441>; +}; diff --git a/arch/arm64/boot/dts/marvell/armada-8040.dtsi b/arch/arm64/boot/dts/marvell/armada-8040.dtsi index 7699b19224c2..79e8ce59baa8 100644 --- a/arch/arm64/boot/dts/marvell/armada-8040.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-8040.dtsi @@ -15,6 +15,18 @@ "marvell,armada-ap806"; }; +&smmu { + status = "okay"; +}; + +&cp0_pcie0 { + iommu-map = + <0x0 &smmu 0x480 0x20>, + <0x100 &smmu 0x4a0 0x20>, + <0x200 &smmu 0x4c0 0x20>; + iommu-map-mask = <0x031f>; +}; + /* The RTC requires external oscillator. But on Aramda 80x0, the RTC clock * in CP master is not connected (by package) to the oscillator. So * disable it. However, the RTC clock in CP slave is connected to the @@ -23,3 +35,31 @@ &cp0_rtc { status = "disabled"; }; + +&cp0_sata0 { + iommus = <&smmu 0x444>; +}; + +&cp0_sdhci0 { + iommus = <&smmu 0x445>; +}; + +&cp0_usb3_0 { + iommus = <&smmu 0x440>; +}; + +&cp0_usb3_1 { + iommus = <&smmu 0x441>; +}; + +&cp1_sata0 { + iommus = <&smmu 0x454>; +}; + +&cp1_usb3_0 { + iommus = <&smmu 0x450>; +}; + +&cp1_usb3_1 { + iommus = <&smmu 0x451>; +}; diff --git a/arch/arm64/boot/dts/marvell/armada-ap80x.dtsi b/arch/arm64/boot/dts/marvell/armada-ap80x.dtsi index 7f9b9a647717..12e477f1aeb9 100644 --- a/arch/arm64/boot/dts/marvell/armada-ap80x.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-ap80x.dtsi @@ -56,6 +56,24 @@ compatible = "simple-bus"; ranges = <0x0 0x0 0xf0000000 0x1000000>; + smmu: iommu@5000000 { + compatible = "marvell,ap806-smmu-500", "arm,mmu-500"; + reg = <0x100000 0x100000>; + dma-coherent; + #iommu-cells = <1>; + #global-interrupts = <1>; + interrupts = , + , + , + , + , + , + , + , + ; + status = "disabled"; + }; + gic: interrupt-controller@210000 { compatible = "arm,gic-400"; #interrupt-cells = <3>;