From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF738C432C0 for ; Mon, 18 Nov 2019 01:37:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC3C1206CC for ; Mon, 18 Nov 2019 01:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726518AbfKRBhW (ORCPT ); Sun, 17 Nov 2019 20:37:22 -0500 Received: from mga07.intel.com ([134.134.136.100]:21448 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbfKRBhW (ORCPT ); Sun, 17 Nov 2019 20:37:22 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Nov 2019 17:37:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,318,1569308400"; d="scan'208";a="203924537" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by fmsmga008.fm.intel.com with ESMTP; 17 Nov 2019 17:37:18 -0800 Cc: baolu.lu@linux.intel.com, "Tian, Kevin" , Raj Ashok , Yi Liu , Eric Auger Subject: Re: [PATCH 06/10] iommu/vt-d: Fix off-by-one in PASID allocation To: Jacob Pan , iommu@lists.linux-foundation.org, LKML , Joerg Roedel , David Woodhouse References: <1573859377-75924-1-git-send-email-jacob.jun.pan@linux.intel.com> <1573859377-75924-7-git-send-email-jacob.jun.pan@linux.intel.com> From: Lu Baolu Message-ID: <332ede86-4d39-74b4-b36c-f2de4a964672@linux.intel.com> Date: Mon, 18 Nov 2019 09:34:17 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1573859377-75924-7-git-send-email-jacob.jun.pan@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/16/19 7:09 AM, Jacob Pan wrote: > PASID allocator uses IDR which is exclusive for the end of the > allocation range. There is no need to decrement pasid_max. > > Fixes: af39507305fb ("iommu/vt-d: Apply global PASID in SVA") > Reported-by: Eric Auger > Signed-off-by: Jacob Pan Acked-by: Lu Baolu Best regards, baolu > --- > drivers/iommu/intel-svm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c > index 924a4de84be1..b5537f27592f 100644 > --- a/drivers/iommu/intel-svm.c > +++ b/drivers/iommu/intel-svm.c > @@ -338,7 +338,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ > /* Do not use PASID 0 in caching mode (virtualised IOMMU) */ > ret = intel_pasid_alloc_id(svm, > !!cap_caching_mode(iommu->cap), > - pasid_max - 1, GFP_KERNEL); > + pasid_max, GFP_KERNEL); > if (ret < 0) { > kfree(svm); > kfree(sdev); >