Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1078367yba; Fri, 3 May 2019 15:44:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVuocnDPCk6GVnoA+wiPonXI5YGSM2F6dOrx4s5aHjRlwG7ZydUoEZBUMUf9S5EA5dEDsE X-Received: by 2002:a17:902:6bc5:: with SMTP id m5mr14426825plt.180.1556923493097; Fri, 03 May 2019 15:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556923493; cv=none; d=google.com; s=arc-20160816; b=TUQ0AvprLeXRmdIIYYRVIp7YoStBzvUTxeT9rNf5XGdUFzslzW1Nhf/FMvv0p55PCN qr+cAP7WlWWVU1dthcfo0z1g1hm/B3zgzn1UjQCnMh7eAMXMC5ix1LsOGnsVNFk5IQPe Vv9ipRjjA1jbFB1aIGUeK8y3+u8bRixoUt75+3ThWd1FFPVuuVtevqjaO/LMmdce7BBi PHYXsug/EQJrw7YoTEl8HyzkqgZfa+znLBEY7c1k96kma5TWyfIVd5dQUj3wHEdfHgWz Gggh7sevvVe9Ti9Sj26vvQbJDL8Uqegq7v6+qveIahMFfskjxcdIgV+RqGzkS30ujd17 7jWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=lhcW5yfRhRlmgP1HupCbTMhpUqbokwaT1/4bAvRMB38=; b=bw2spWxlHvPA3cq43+QWPV4pr41MGf7uxRZ1x1fIzqkUcEYt36OJDClMRr5sTN23Cg jpXgwL1lg6D1vRDu1uS38NqryD5xGLZgOfdOBB+0yRKaN0XC3KVdM8VLHAMzp0soZUfs b+jcTSCtzl9V1fSwBzYkB0M+/NObJmZTIpK7Jp1BwfekGzYp4uEXy2t7fpYK2+L4yg+t bK5CC4RlBjClA/SQVm4XV10r0KeHMhfuBGS1I9V/llxePX/MnlWipJ0oCM3f5Vn/OGG7 0UBrG4DVfu+jz5Q9ZGDWmySxPKuCC93W7HqtEw7MqC75LMHwUulvZT0XIc0Cm3d+7Qwt oNeg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si4270357pge.550.2019.05.03.15.44.37; Fri, 03 May 2019 15:44:53 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726888AbfECW3g (ORCPT + 99 others); Fri, 3 May 2019 18:29:36 -0400 Received: from mga02.intel.com ([134.134.136.20]:7005 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726779AbfECW3f (ORCPT ); Fri, 3 May 2019 18:29:35 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2019 15:29:33 -0700 X-ExtLoop1: 1 Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga002.jf.intel.com with ESMTP; 03 May 2019 15:29:33 -0700 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , David Woodhouse , Eric Auger , Alex Williamson , Jean-Philippe Brucker Cc: "Yi Liu" , "Tian, Kevin" , Raj Ashok , "Christoph Hellwig" , "Lu Baolu" , Andriy Shevchenko , Jacob Pan Subject: [PATCH v3 07/16] iommu/vtd: Optimize tlb invalidation for vIOMMU Date: Fri, 3 May 2019 15:32:08 -0700 Message-Id: <1556922737-76313-8-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556922737-76313-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1556922737-76313-1-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Jacob Pan --- drivers/iommu/intel-svm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index 8f87304..f5d1e1e 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/iommu/intel-svm.c @@ -211,7 +211,9 @@ static void intel_mm_release(struct mmu_notifier *mn, struct mm_struct *mm) rcu_read_lock(); list_for_each_entry_rcu(sdev, &svm->devs, list) { intel_pasid_tear_down_entry(svm->iommu, sdev->dev, svm->pasid); - intel_flush_svm_range_dev(svm, sdev, 0, -1, 0, !svm->mm); + /* for emulated iommu, PASID cache invalidation implies IOTLB/DTLB */ + if (!cap_caching_mode(svm->iommu->cap)) + intel_flush_svm_range_dev(svm, sdev, 0, -1, 0, !svm->mm); } rcu_read_unlock(); -- 2.7.4