Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1480903 > unrolled thread

[PATCH] iommu/vt-d: Fix the size calculation of pasid table

Started byXunlei Pang <xlpang@redhat.com>
First post2016-09-12 04:50 +0200
Last post2016-09-19 14:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iommu/vt-d: Fix the size calculation of pasid table Xunlei Pang <xlpang@redhat.com> - 2016-09-12 04:50 +0200
    Re: [PATCH] iommu/vt-d: Fix the size calculation of pasid table Joerg Roedel <joro@8bytes.org> - 2016-09-19 14:20 +0200

#1480903 — [PATCH] iommu/vt-d: Fix the size calculation of pasid table

FromXunlei Pang <xlpang@redhat.com>
Date2016-09-12 04:50 +0200
Subject[PATCH] iommu/vt-d: Fix the size calculation of pasid table
Message-ID<sgptM-5TD-9@gated-at.bofh.it>
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 <xlpang@redhat.com>
---
 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;
 
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1486419

FromJoerg Roedel <joro@8bytes.org>
Date2016-09-19 14:20 +0200
Message-ID<sj5Id-5lV-5@gated-at.bofh.it>
In reply to#1480903
[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 <xlpang@redhat.com>
> ---
>  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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web