From patchwork Fri Sep 18 15:18:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 53918 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 1A75E218E3 for ; Fri, 18 Sep 2015 15:22:21 +0000 (UTC) Received: by lamp12 with SMTP id p12sf19009799lam.2 for ; Fri, 18 Sep 2015 08:22:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:cc:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=K1tjTu2WiyySJxXJdHdpFl8fZ4lnj56lYbj8R+Zw/2k=; b=lqI8nq75u/wbOzAECU0coOpatmNv4chPRvmmWhHPIQk2xsDmoIXzmlbfZcKPgHN8cY ohsNmVjKpU4BYPFrNa5x4+PCxTohweuUMpuT6R6lGT4DxAsDMQo7xRLiZI4wsMP6fno0 6iKxJIgrj7+kDLzBHcAkXs9sxOJ7DVgN1K7sQK+oLerrqlmil0+pvWKbETeTXhNjIn3n NqzdNhwBrpCv4oQUTSe0eT+fb5PjCDJhU7ikVuxM1Vcc1/3YnYegn1Y1gdAWvFfMFQzK a4nPphu7I/zImjgdHIrYMNyXH5bWd1yTUcZ649FzKYwgFKCd1PgqtBYXR+vvZ/xFhU0M SVkQ== X-Gm-Message-State: ALoCoQlc8bC+XyMrtFw6PGnPruIAi20HRwiF/B9Ferx/mIB8ci4bOzH1OQtGWWWLCZKqAtBWRLJR X-Received: by 10.112.144.99 with SMTP id sl3mr998171lbb.12.1442589740044; Fri, 18 Sep 2015 08:22:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.136 with SMTP id b8ls189108laa.85.gmail; Fri, 18 Sep 2015 08:22:19 -0700 (PDT) X-Received: by 10.152.161.236 with SMTP id xv12mr3424626lab.116.1442589739857; Fri, 18 Sep 2015 08:22:19 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id z2si6480027lag.36.2015.09.18.08.22.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 08:22:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbbmp1 with SMTP id mp1so26899698lbb.1 for ; Fri, 18 Sep 2015 08:22:19 -0700 (PDT) X-Received: by 10.152.18.130 with SMTP id w2mr3422254lad.88.1442589739521; Fri, 18 Sep 2015 08:22:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp362425lbq; Fri, 18 Sep 2015 08:22:18 -0700 (PDT) X-Received: by 10.50.20.8 with SMTP id j8mr14236123ige.36.1442589738556; Fri, 18 Sep 2015 08:22:18 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id z6si7228085igz.2.2015.09.18.08.22.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 08:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcxQv-0001p9-Hr; Fri, 18 Sep 2015 15:18:41 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcxQr-0001gh-Qd for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2015 15:18:38 +0000 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.139]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id t8IFICWr006191; Fri, 18 Sep 2015 16:18:12 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id A0C671AE3298; Fri, 18 Sep 2015 16:18:19 +0100 (BST) From: Will Deacon To: iommu@lists.linux-foundation.org Subject: [PATCH] iommu/arm-smmu: Use correct address mask for CMD_TLBI_S2_IPA Date: Fri, 18 Sep 2015 16:18:18 +0100 Message-Id: <1442589498-31355-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150918_081838_279568_96AD68B1 X-CRM114-Status: GOOD ( 10.02 ) X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Will Deacon , robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.deacon@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Stage-2 TLBI by IPA takes a 48-bit address field, as opposed to the 64-bit field used by the VA-based invalidation commands. This patch re-jigs the SMMUv3 command construction code so that the address field is correctly masked. Signed-off-by: Will Deacon --- drivers/iommu/arm-smmu-v3.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index a24f359fa0d0..286e890e7d64 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -343,7 +343,8 @@ #define CMDQ_TLBI_0_VMID_SHIFT 32 #define CMDQ_TLBI_0_ASID_SHIFT 48 #define CMDQ_TLBI_1_LEAF (1UL << 0) -#define CMDQ_TLBI_1_ADDR_MASK ~0xfffUL +#define CMDQ_TLBI_1_VA_MASK ~0xfffUL +#define CMDQ_TLBI_1_IPA_MASK 0xfffffffff000UL #define CMDQ_PRI_0_SSID_SHIFT 12 #define CMDQ_PRI_0_SSID_MASK 0xfffffUL @@ -771,11 +772,13 @@ static int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent) break; case CMDQ_OP_TLBI_NH_VA: cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT; - /* Fallthrough */ + cmd[1] |= ent->tlbi.leaf ? CMDQ_TLBI_1_LEAF : 0; + cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_VA_MASK; + break; case CMDQ_OP_TLBI_S2_IPA: cmd[0] |= (u64)ent->tlbi.vmid << CMDQ_TLBI_0_VMID_SHIFT; cmd[1] |= ent->tlbi.leaf ? CMDQ_TLBI_1_LEAF : 0; - cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_ADDR_MASK; + cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_IPA_MASK; break; case CMDQ_OP_TLBI_NH_ASID: cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT;