From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752524AbcJJNBX (ORCPT ); Mon, 10 Oct 2016 09:01:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15052 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752433AbcJJM7Y (ORCPT ); Mon, 10 Oct 2016 08:59:24 -0400 Reply-To: xlpang@redhat.com Subject: Re: [PATCH] iommu/vt-d: Fix the size calculation of pasid table References: <1473648551-10025-1-git-send-email-xlpang@redhat.com> <20160919121827.GB3541@8bytes.org> To: David Woodhouse Cc: Joerg Roedel , Xunlei Pang , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org From: Xunlei Pang Message-ID: <57FB90DE.7010808@redhat.com> Date: Mon, 10 Oct 2016 21:00:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20160919121827.GB3541@8bytes.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 10 Oct 2016 12:59:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping David for confirmation On 2016/09/19 at 20:18, Joerg Roedel wrote: > [Cc'ing David] > > On Mon, Sep 12, 2016 at 10:49:11AM +0800, Xunlei Pang wrote: >> According to the vt-d spec, the size of pasid (state) entry is 8B >> which equals 3 in power of 2, the number of pasid (state) entries >> is (ecap_pss + 1) in power of 2. >> >> Thus the right size of pasid (state) table in power of 2 should be >> ecap_pss(iommu->ecap) plus "1+3=4" other than 7. >> >> Signed-off-by: Xunlei Pang >> --- >> 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 8ebb353..cfa75c2 100644 >> --- a/drivers/iommu/intel-svm.c >> +++ b/drivers/iommu/intel-svm.c >> @@ -39,7 +39,7 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu) >> struct page *pages; >> int order; >> >> - order = ecap_pss(iommu->ecap) + 7 - PAGE_SHIFT; >> + order = ecap_pss(iommu->ecap) + 4 - PAGE_SHIFT; >> if (order < 0) >> order = 0; > The patch seems to be correct, but I'll let David comment on it first. > > > > Joerg >