Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3426816imu; Sun, 11 Nov 2018 14:50:59 -0800 (PST) X-Google-Smtp-Source: AJdET5fRHCJOui2g+RoK4jNqdy6nlwyepJXC1PYW+BmkWUTpFK9iclZhUKaynGfHIBNeH5mYwjQK X-Received: by 2002:a17:902:a9:: with SMTP id a38-v6mr17791071pla.7.1541976658947; Sun, 11 Nov 2018 14:50:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541976658; cv=none; d=google.com; s=arc-20160816; b=Tg2zFqC9i0p5W76JtWBoSVGi4w34WD9gQwIJ9ArKqrDysfeGfVdPmsg0U8mUeuuVa8 N0afJEWRqmfC20tX21h5kaz+YqFSV+lffB03lZ1s6TUk+eSB2l6HQU85d+OqMN84GjOi kVLombt5IH7iTnR39eyhVAUQxN9GOPKSCmghA8Vx4udcadiXVz9OZP7o5rAfDcQYtAzd +/dDBFb/PGiA3ETLKlwK5ZodCmB1KZm2aV45JVDTT6iPK3olHTFXOa3pFTTqp+ecCL+R poaZSaoJpLeZm43euXwpdfkTeVn/1X/yegp6V594lA+qbKa7+9ZkD/qzNf5TiLpIholz BYkQ== 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=FibzwbPgnAlWT6xi6TnsX33HxmzOR8CEWlIemDkr054=; b=uT91eSHHu5MD4DjL08wvz/rKYe59qAg3eNVnu1vBrZGRvTaGK03HuCu6uJ6Wm5XF5A 7b+M/E4mLeJ6ypLpujYQ1BF+qER4VfUE++6gsYi8+5+11RGtbHbj9WIXdts8lNUica4F il/tk0bqXPj2r2NjZNM789+xVze9xI3/mbAXZ9rHJoqWmrX7r7ts0DW2GE28sGWwFVVg 9hjagZ0D84Hh2YOF42J2Z1pza3uptEZu0rACnZdGSTLTHSXEo/Zup/zoGIz73dD9qYwc VMmkKD65YV9WpB5azSQsoRWxiC76SAm268JAQHXjSPdLbjvyzEYD1EXBF5bDRFEQRj5a pT1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X0olR7MZ; 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 w190si14044116pgd.338.2018.11.11.14.50.44; Sun, 11 Nov 2018 14:50:58 -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=X0olR7MZ; 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 S2404240AbeKLIXK (ORCPT + 99 others); Mon, 12 Nov 2018 03:23:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:54620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404200AbeKLIXI (ORCPT ); Mon, 12 Nov 2018 03:23:08 -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 8C80A223CA; Sun, 11 Nov 2018 22:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975591; bh=4hykq8r88v8ZqbbL7il5tihcuixL6PCxm2CrW/hO+uI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X0olR7MZgq30LbxHyxksmeboCO1qhznLICcmNvqBiJOKsTsZMQk3SJlvxgVgRbGTZ PFzL3d9grxEC1oNnL+pzXqNk/r8u9DQmrFFTjns7ndOeLzUMdhdyPDHnf0y0/w/cJO VPQs/h3ZiYqvVtsYAjW2l0m5G9ZlR7Ae2vRCyq2k= 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.14 178/222] iommu/arm-smmu: Ensure that page-table updates are visible before TLBI Date: Sun, 11 Nov 2018 14:24:35 -0800 Message-Id: <20181111221702.988681074@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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 @@ -475,6 +475,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; @@ -516,6 +519,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); }