From patchwork Sat Mar 8 00:46:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3795891 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C115C9F4BD for ; Sat, 8 Mar 2014 00:45:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1FE2201BB for ; Sat, 8 Mar 2014 00:44:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 228F92034B for ; Sat, 8 Mar 2014 00:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753771AbaCHAow (ORCPT ); Fri, 7 Mar 2014 19:44:52 -0500 Received: from perceval.ideasonboard.com ([95.142.166.194]:56196 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752144AbaCHAot (ORCPT ); Fri, 7 Mar 2014 19:44:49 -0500 Received: from avalon.ideasonboard.com (unknown [91.178.187.5]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 46DE2363CD; Sat, 8 Mar 2014 01:43:43 +0100 (CET) From: Laurent Pinchart To: linux-omap@vger.kernel.org Cc: iommu@lists.linux-foundation.org, Suman Anna , Florian Vaussard , sakari.ailus@iki.fi Subject: [PATCH 3/5] iommu/omap: Flush the TLB only after updating translation table entries Date: Sat, 8 Mar 2014 01:46:12 +0100 Message-Id: <1394239574-2389-4-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394239574-2389-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1394239574-2389-1-git-send-email-laurent.pinchart@ideasonboard.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Flushing the TLB before updating translation entries creates a race condition and can lead to stale TLB entries if a translation request arrives between flushing the TLB and updating the translation entries. As there's no requirement to flush the TLB before updating the entries, flush it after only. Signed-off-by: Laurent Pinchart --- drivers/iommu/omap-iommu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index cb1e1de..fedd303 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -662,10 +662,11 @@ int omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e) { int err; - flush_iotlb_page(obj, e->da); err = iopgtable_store_entry_core(obj, e); - if (!err) + if (!err) { + flush_iotlb_page(obj, e->da); prefetch_iotlb_entry(obj, e); + } return err; } EXPORT_SYMBOL_GPL(omap_iopgtable_store_entry);