Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3469652imu; Sun, 11 Nov 2018 15:50:01 -0800 (PST) X-Google-Smtp-Source: AJdET5dLFJvk26yEQ/vC/xx5tXkAfvreftqOSCHXfJqg+iLEVElsfWHuH9cYH9M1I6Rxa/vTGvGe X-Received: by 2002:a63:e545:: with SMTP id z5mr4617878pgj.195.1541980201665; Sun, 11 Nov 2018 15:50:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980201; cv=none; d=google.com; s=arc-20160816; b=CNJFfF0M2g+h4VSOh7ngH/EkKakLhuhZVNscOqz0Y4T+WAXLu9YuIqCOdHo4H8m7Zr qT3Im+U0GDdgsuAaJ44EmO+4WhNzCIHMB/yGm3/NW45Z5F0hzlcjDbz9Mu+cIsEsNqbH rtVoD8k8FbXMX2MaZ68dOGgBuBCVMn58bcKhk7vyfkz5doW8pR7//HEOog0VBgVXJWNv t1QpoFasxzRIBLubwZfeuwnOW4kllSxb6gYdH6s2XYX7PmaEsEvxEgvhuE2EmVXqVCta Kx4Biu6idAVl3B21yxwvSqG8zsnlnE0e0P+vY8LkvdiwSj9UE4toFQlqeuzAMKQgm4pO zjQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+0il0A10vyweYQbU5yaS+kzLqMjyabx38/gZ2fRkwR0=; b=SN7vtLHydkprvJytdfeWL4uUVBYwbAF+762f8fs4/UJRDkQYmq53LmkZgvzoz5UXtL BTZJfqNvA4+X3cIddVpg/nop11hYxFUuSNQ63l2EiK5Kyhtu2UyL6r3sJArk1jbFx0PW YuFWzqrU857lRue9k13bsVFxkv82H7A5fEz11ibwAOqIPA7Q5bNNL0mwVmGjIzl64at0 FUbq2/4O44AHzQyDFqzze0C4JRW2/4xA5EEnf0cqJlgbUYhMwxJZ1Z8rPlMiCUPFoxRT SA2OmPL6kXh73RWMaS13KwK2Nb717StKQVfZ7ak61VA7BaisNzv1U/xURwUW0uEHrkR0 WUyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="q/ysinM3"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13-v6si13535062pgq.285.2018.11.11.15.49.46; Sun, 11 Nov 2018 15:50:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="q/ysinM3"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733131AbeKLJjq (ORCPT + 99 others); Mon, 12 Nov 2018 04:39:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:38670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729977AbeKLISj (ORCPT ); Mon, 12 Nov 2018 03:18:39 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A5B522443; Sun, 11 Nov 2018 22:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975323; bh=z8cST7FqxHUeHdn+dQuXgZjknwfGAMRcJNoMtDF2yMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q/ysinM34XBHEWL2Hxg9itsE/vrYeW02HI2ywY153+G5OmPQCC4E3unVkkPpOQ534 9R08SaM2GhuEj9IHYlJVA1mLfx/2qo/WY4ToIW/6xMlTHxcrhvoR39PKhiKCM77qGD Eb0utL3tjh+hNMUkKgH4Y8o+LKGbpuuw0wJi2V8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Will Deacon Subject: [PATCH 4.19 290/361] iommu/arm-smmu: Ensure that page-table updates are visible before TLBI Date: Sun, 11 Nov 2018 14:20:37 -0800 Message-Id: <20181111221656.614720724@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon commit 7d321bd3542500caf125249f44dc37cb4e738013 upstream. The IO-pgtable code relies on the driver TLB invalidation callbacks to ensure that all page-table updates are visible to the IOMMU page-table walker. In the case that the page-table walker is cache-coherent, we cannot rely on an implicit DSB from the DMA-mapping code, so we must ensure that we execute a DSB in our tlb_add_flush() callback prior to triggering the invalidation. Cc: Cc: Robin Murphy Fixes: 2df7a25ce4a7 ("iommu/arm-smmu: Clean up DMA API usage") Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/arm-smmu.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -469,6 +469,9 @@ static void arm_smmu_tlb_inv_range_nosyn bool stage1 = cfg->cbar != CBAR_TYPE_S2_TRANS; void __iomem *reg = ARM_SMMU_CB(smmu_domain->smmu, cfg->cbndx); + if (smmu_domain->smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) + wmb(); + if (stage1) { reg += leaf ? ARM_SMMU_CB_S1_TLBIVAL : ARM_SMMU_CB_S1_TLBIVA; @@ -510,6 +513,9 @@ static void arm_smmu_tlb_inv_vmid_nosync struct arm_smmu_domain *smmu_domain = cookie; void __iomem *base = ARM_SMMU_GR0(smmu_domain->smmu); + if (smmu_domain->smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) + wmb(); + writel_relaxed(smmu_domain->cfg.vmid, base + ARM_SMMU_GR0_TLBIVMID); }