Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3637457ybb; Tue, 31 Mar 2020 09:04:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuP65e94qr4R/SRMqinVotXqoknOHmQd09LhYAUaDc1lZL/WcPi8wch83GqXBWs85qpQTiE X-Received: by 2002:aca:b854:: with SMTP id i81mr2494575oif.22.1585670685203; Tue, 31 Mar 2020 09:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585670685; cv=none; d=google.com; s=arc-20160816; b=jn02MdAjs9pgUNaK/2RgjSZJNW0VIpvoWSmfo4sOxQc9YXEEUHqe1oqeuMTzKdI5JO MlMj0/N6zGusXaq/EOfwDTiT82NmAATBpFe2Aawae2xQB8wk/mvm4I6FB8gwf6nhnOQ0 Qo4iPoASu0cuJ4YrJiYeuq3wSYdW66BOkuZDMydWeLrUukQq4+uNlpjCIVoJJoS+NG28 muW2Dj4RSnmg5ZDdiebVyCZSn3I3P/PGy08ui9wW2jeL3TRdwZh4YPjYUH0C/XWo29Qn 1qbgUUBBtFY9mBH5qnsOsgJBUXxLjR03tLixkMt9kdU9AeTNZ/wr9N6McKdC0N0vI9kP QNjA== 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:ironport-sdr:ironport-sdr; bh=/JjmQyt6maSTzdA7E+XlOflpTAErQEtHR0jr3+mhuAw=; b=VkOk5Z6H6jmB2AS1xCdJvi3UZDnnqUrf+L8Y/RX1tAWO6ew1zY8Jl7iOmJg/QDRjAg c8OEBH0u8HlrOn5t2Fq2wR+CP1nCQ2g9aB+ci+VK9sMpKh6HYp66yY3pqqxN8Jt+0aI3 zKt/vEeOpK0EpG9BN2CUA99F/TO6tu+2vzHKav8KH8BV/NkFCLAPcXCre1znXXnBcOp9 5OE4ulDTZbPrVhgI2H1acRiNqp3ZAnIbfxH/NUtfoUW1YdLd97CV6bC3bKAr+ss5hrPg A92TLEMDzplvNfSxIwW8TLAfhBpubUvHLzinNAur1h26QO7CyVq11CtLQ+jfGKrQseqD t64Q== 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 g81si7284395oia.8.2020.03.31.09.04.11; Tue, 31 Mar 2020 09:04:45 -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 S1731222AbgCaQD3 (ORCPT + 99 others); Tue, 31 Mar 2020 12:03:29 -0400 Received: from mga06.intel.com ([134.134.136.31]:7045 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730286AbgCaQD3 (ORCPT ); Tue, 31 Mar 2020 12:03:29 -0400 IronPort-SDR: IiXMBa3bfCIuIJZm2w4b+W2Rhj4d15YERuatZP8CTPKLuF4Ey9v/6cjXJTMhl6vc6J6kWK35oi suxY6cDKezgg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 09:02:57 -0700 IronPort-SDR: i3YcuqOb7259MzCg51qQzr7zRWRdSHCZlHRjXjPHkSPzX8Syzb4FVL8NB/MFk0tDCUOYsULuoO 7MWXEsVJyP5g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,328,1580803200"; d="scan'208";a="272809187" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by fmsmga004.fm.intel.com with ESMTP; 31 Mar 2020 09:02:56 -0700 Date: Tue, 31 Mar 2020 09:08:43 -0700 From: Jacob Pan To: Auger Eric Cc: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , David Woodhouse , Lu Baolu , Raj Ashok , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH] iommu/vt-d: Fix PASID cache flush Message-ID: <20200331090843.59961e03@jacob-builder> In-Reply-To: <53be1d27-6348-56db-7eac-6734f92f123d@redhat.com> References: <1585610725-78316-1-git-send-email-jacob.jun.pan@linux.intel.com> <53be1d27-6348-56db-7eac-6734f92f123d@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 Actually, this is not a bug. The current code has: #define QI_PC_PASID_SEL (QI_PC_TYPE | QI_PC_GRAN(1)) Which already has the type and shift. In my vSVA series, I redefined granu such that I can use them in the 2D table lookup. -#define QI_PC_ALL_PASIDS (QI_PC_TYPE | QI_PC_GRAN(0)) -#define QI_PC_PASID_SEL (QI_PC_TYPE | QI_PC_GRAN(1)) +/* PASID cache invalidation granu */ +#define QI_PC_ALL_PASIDS 0 +#define QI_PC_PASID_SEL 1 Please ignore this, sorry about the confusion. On Tue, 31 Mar 2020 11:28:17 +0200 Auger Eric wrote: > Hi Jacob, > > On 3/31/20 1:25 AM, Jacob Pan wrote: > > PASID cache type and shift of granularity bits are missing in > > the current code. > > > > Fixes: 6f7db75e1c46 ("iommu/vt-d: Add second level page table > > interface") > > > > Cc: Eric Auger > > Signed-off-by: Jacob Pan > Reviewed-by: Eric Auger > > Thanks > > Eric > > > --- > > drivers/iommu/intel-pasid.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/iommu/intel-pasid.c > > b/drivers/iommu/intel-pasid.c index 22b30f10b396..57d05b0fbafc > > 100644 --- a/drivers/iommu/intel-pasid.c > > +++ b/drivers/iommu/intel-pasid.c > > @@ -365,7 +365,8 @@ pasid_cache_invalidation_with_pasid(struct > > intel_iommu *iommu, { > > struct qi_desc desc; > > > > - desc.qw0 = QI_PC_DID(did) | QI_PC_PASID_SEL | > > QI_PC_PASID(pasid); > > + desc.qw0 = QI_PC_DID(did) | QI_PC_GRAN(QI_PC_PASID_SEL) | > > + QI_PC_PASID(pasid) | QI_PC_TYPE; > > desc.qw1 = 0; > > desc.qw2 = 0; > > desc.qw3 = 0; > > > [Jacob Pan]