Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2399145ybb; Fri, 27 Mar 2020 04:56:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtrJ2dXTC+mt8YNl15juNC2/oKG9tiWaO3RH8aeXJ0N4Tvv2qLgTPhbRnXukZFOxWpAUE08 X-Received: by 2002:a05:6830:12c4:: with SMTP id a4mr501755otq.305.1585310186470; Fri, 27 Mar 2020 04:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585310186; cv=none; d=google.com; s=arc-20160816; b=RNIl0c9rr5x9KnEyvoR7EJ+NhMGaQeFMlAlTPC0xAmGkx8rA/+/xEnXg9SbKITEnRd 8Mo9ySStT4x65YexYRMXbNFN71nLgE9xhSiqQn3tEuhN5xQp7aPKkaztMV+8Kn5OMjvT u1iMF3f1R/LkwXijZ0KRPPL4XzqLC0b/vaavn2IIuTmBG2HXTXlJbVenabDmsC0Uk5Or TJovZnkpTX0QoPhMK+5WQX+YG2SDg3dmpLNfRQ1zAkb0a4/LXyR2F7UG+ru7zjoVSNaR lyeP8rcjLJElCeYbzzksff+7ibgtQWGK0fOnWT5dlfxOfqxey3FteNLVgE6QQy1p6w31 Vqkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=rL4NcplZBShXoqfdge4mMe6V/hUbhQriIJMG1CVDzB8=; b=XqMXyEQExB3s4aZ5BQi095aG1+GNHJgdNXx6GIzh6L/Xqtg1ZWSlC2Mw+m6AhhcVpk fR0WfH+RdUuWjuhRMoZpiMe7pYuPY3VZfskdgi/cHR2xPhIjs8cbrsxkbhgn7cdjhR7z eC7boxbQIm++yvo4qsKxCXFdlKA71aA5XJKsbUa1LsS+juxrwk3bhwM4n2ZJ45Wr0EwX j6LsH+nGoTUg2IaKOvfc6SuSqO7AowcWBCQBRHKfUrIaf7kAHwI7uWzcubAEsgned38O VXaJ3a16GEM2lG68AiHz5REfRgTRu/aYNCiuWIxp+bQGjKvrlS22XM0TAqq9cOkSqnJh b29Q== 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 j18si1109813otk.166.2020.03.27.04.56.13; Fri, 27 Mar 2020 04:56:26 -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 S1727143AbgC0LzO convert rfc822-to-8bit (ORCPT + 99 others); Fri, 27 Mar 2020 07:55:14 -0400 Received: from mga03.intel.com ([134.134.136.65]:46128 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbgC0LzN (ORCPT ); Fri, 27 Mar 2020 07:55:13 -0400 IronPort-SDR: B1VBVRAIByMa7IYEghXjJZ1oT+2wDvlUnJKAURN7/5oT4+xxK5jeuD5jrH/MmnXSjVbcF3Vpe7 bevyU++o8w8A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2020 04:55:13 -0700 IronPort-SDR: cyFcDds1ROgm2J/9E0iDXPHdiZCj/JKszXXd6QBGBf3tRPxLR/DOCuIawDN3DWCwOzyUUh1myf rHIg33LIodog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,312,1580803200"; d="scan'208";a="247863447" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 27 Mar 2020 04:55:12 -0700 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Mar 2020 04:55:12 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Mar 2020 04:55:12 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.206]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.43]) with mapi id 14.03.0439.000; Fri, 27 Mar 2020 19:55:10 +0800 From: "Tian, Kevin" To: Jacob Pan , Lu Baolu , "iommu@lists.linux-foundation.org" , LKML , Joerg Roedel , David Woodhouse , "Alex Williamson" , Jean-Philippe Brucker CC: "Liu, Yi L" , "Raj, Ashok" , Christoph Hellwig , Jonathan Cameron , Eric Auger Subject: RE: [PATCH V10 04/11] iommu/vt-d: Use helper function to skip agaw for SL Thread-Topic: [PATCH V10 04/11] iommu/vt-d: Use helper function to skip agaw for SL Thread-Index: AQHV/w5fSzCgga8qmUGqovU+x6tW2KhcXtQQ Date: Fri, 27 Mar 2020 11:55:09 +0000 Message-ID: References: <1584746861-76386-1-git-send-email-jacob.jun.pan@linux.intel.com> <1584746861-76386-5-git-send-email-jacob.jun.pan@linux.intel.com> In-Reply-To: <1584746861-76386-5-git-send-email-jacob.jun.pan@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Jacob Pan > Sent: Saturday, March 21, 2020 7:28 AM > > Signed-off-by: Jacob Pan > --- > drivers/iommu/intel-pasid.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/drivers/iommu/intel-pasid.c b/drivers/iommu/intel-pasid.c > index 191508c7c03e..9bdb7ee228b6 100644 > --- a/drivers/iommu/intel-pasid.c > +++ b/drivers/iommu/intel-pasid.c > @@ -544,17 +544,11 @@ int intel_pasid_setup_second_level(struct > intel_iommu *iommu, > return -EINVAL; > } > > - /* > - * Skip top levels of page tables for iommu which has less agaw > - * than default. Unnecessary for PT mode. > - */ > pgd = domain->pgd; > - for (agaw = domain->agaw; agaw > iommu->agaw; agaw--) { > - pgd = phys_to_virt(dma_pte_addr(pgd)); > - if (!dma_pte_present(pgd)) { > - dev_err(dev, "Invalid domain page table\n"); > - return -EINVAL; > - } > + agaw = iommu_skip_agaw(domain, iommu, &pgd); > + if (agaw < 0) { > + dev_err(dev, "Invalid domain page table\n"); > + return -EINVAL; > } ok, I see how it is used. possibly combine last and this one together since it's mostly moving code... > > pgd_val = virt_to_phys(pgd); > -- > 2.7.4