Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3350105ybc; Mon, 18 Nov 2019 13:50:33 -0800 (PST) X-Google-Smtp-Source: APXvYqzXLU/uD0bR+TkaNnrrF9L9Qed67FL1GleM654K08NDx09FGy3acTS2Fk5212acxMyRXZV9 X-Received: by 2002:a17:906:d052:: with SMTP id bo18mr29968357ejb.128.1574113833069; Mon, 18 Nov 2019 13:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574113833; cv=none; d=google.com; s=arc-20160816; b=ZdLTJK8TcVYRNt1ieivi9LyXr9bveSEMcVGJ3QGaVH2cZ9luiL2R5DSuIkwggiSXnc KQzFzrMaLgN2HGv4SwiIG+N97IV/+nncQHf+uTU1OjjjVW/qlteKtym8qd83Miotoc8R SMQ0HLbpodb8OeGK5KucaOuS4tyYF4krg1Mwbdk1/IsHPPzsuWnIxomrfJonJHXvai5F UJEy8tE35bOUgO0xIwfkB091aOFBH17YEn4sBQkb2N7dd5ARsnN+YAue4YcWsCb4FjLJ zhxrk6J7qLhTGgtGz+Cp4bEcCixPInnsno/hZVYL24Qq2YkhWPSPcxmJ4F02/9Rd6sMb BBkg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=KcWmOhhicbJMCafAvYzU9XTRf9tpRprHigEuiex+ieg=; b=g+S/tkQlE25yUpA+B54HHW6IPLA4MRhWVx8H+G6eyrLhUa4mftFFYXBTjiHUfsAVBC RSHtRqhFqaRjqSIjNG4GNX43HFXqVya+Q2g4ySPfppUc5s1i5PmOiiws8GnnxZWMJmx2 fN8jotUEuONc1UXAiPAI3bkFDv+pvdAV/YiuExehHwqQ6v/rLRFfNsX2fL6Hu+sHFgQL zl6fmFv/IbEBy8oq8BRL9xrMjM/IRi/trr2rWbCwODJNFKAPbEFmaDQSlukcsDtGtmQW BuyhcgSBrl6AHpBYS9SUO9ISCVrbvALxA5N+FxbVnWjpCBnnCSLVeQiMRS/OOfytLjxk GCpw== 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 l5si14108324edb.341.2019.11.18.13.50.08; Mon, 18 Nov 2019 13:50:33 -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; 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 S1726788AbfKRVsE (ORCPT + 99 others); Mon, 18 Nov 2019 16:48:04 -0500 Received: from mga02.intel.com ([134.134.136.20]:3811 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726647AbfKRVsE (ORCPT ); Mon, 18 Nov 2019 16:48:04 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Nov 2019 13:48:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,321,1569308400"; d="scan'208";a="209213554" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga006.jf.intel.com with ESMTP; 18 Nov 2019 13:48:03 -0800 Date: Mon, 18 Nov 2019 13:52:38 -0800 From: Jacob Pan To: Auger Eric Cc: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "Tian, Kevin" , Raj Ashok , Yi Liu , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v2 04/10] iommu/vt-d: Match CPU and IOMMU paging mode Message-ID: <20191118135238.49f5d957@jacob-builder> In-Reply-To: <601ca9c3-9f83-3d95-8d26-d4f46eee82ba@redhat.com> References: <1574106153-45867-1-git-send-email-jacob.jun.pan@linux.intel.com> <1574106153-45867-5-git-send-email-jacob.jun.pan@linux.intel.com> <601ca9c3-9f83-3d95-8d26-d4f46eee82ba@redhat.com> Organization: OTC X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 18 Nov 2019 21:55:03 +0100 Auger Eric wrote: > Hi Jacob, > > On 11/18/19 8:42 PM, Jacob Pan wrote: > > When setting up first level page tables for sharing with CPU, we > > need to ensure IOMMU can support no less than the levels supported > > by the CPU. > > It is not adequate, as in the current code, to set up 5-level paging > > in PASID entry First Level Paging Mode(FLPM) solely based on CPU. > > > > Fixes: 437f35e1cd4c8 ("iommu/vt-d: Add first level page table > > interface") > > Signed-off-by: Jacob Pan > > Acked-by: Lu Baolu > > --- > > drivers/iommu/intel-pasid.c | 12 ++++++++++-- > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iommu/intel-pasid.c > > b/drivers/iommu/intel-pasid.c index 040a445be300..e7cb0b8a7332 > > 100644 --- a/drivers/iommu/intel-pasid.c > > +++ b/drivers/iommu/intel-pasid.c > > @@ -499,8 +499,16 @@ int intel_pasid_setup_first_level(struct > > intel_iommu *iommu, } > > > > #ifdef CONFIG_X86 > > - if (cpu_feature_enabled(X86_FEATURE_LA57)) > > - pasid_set_flpm(pte, 1); > > + /* Both CPU and IOMMU paging mode need to match */ > > + if (cpu_feature_enabled(X86_FEATURE_LA57)) { > > + if (cap_5lp_support(iommu->cap)) { > > + pasid_set_flpm(pte, 1); > > + } else { > > + pr_err("VT-d has no 5-level paging support > > for CPU\n"); > > + pasid_clear_entry(pte); > > + return -EINVAL; > Can it happen? If I am not wrong intel_pasid_setup_first_level() only > seems to be called from intel_svm_bind_mm which now checks the > SVM_CAPABLE flag. > You are right, this check is not needed any more. I will drop the patch. > Thanks > > Eric > > + } > > + } > > #endif /* CONFIG_X86 */ > > > > pasid_set_domain_id(pte, did); > > > [Jacob Pan]