|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging-4.12] AMD/IOMMU: abstract maximum number of page table levels
commit 0af8d2dfc39f5841b5ccc2298487d5e2d3035145
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Apr 5 15:42:01 2022 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Apr 5 15:42:01 2022 +0200
AMD/IOMMU: abstract maximum number of page table levels
We will want to use the constant elsewhere.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Paul Durrant <paul@xxxxxxx>
master commit: a038b514c1e970a8dc32229cbd31f6769ee61ad5
master date: 2022-04-05 14:20:04 +0200
---
xen/drivers/passthrough/amd/iommu_map.c | 2 +-
xen/include/asm-x86/hvm/svm/amd-iommu-defs.h | 2 ++
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/xen/drivers/passthrough/amd/iommu_map.c
b/xen/drivers/passthrough/amd/iommu_map.c
index 0b619e235e..62bcfc5af7 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -477,7 +477,7 @@ static int iommu_pde_from_dfn(struct domain *d, unsigned
long dfn,
table = hd->arch.root_table;
level = hd->arch.paging_mode;
- BUG_ON( table == NULL || level < 1 || level > 6 );
+ BUG_ON( table == NULL || level < 1 || level > IOMMU_MAX_PT_LEVELS );
/*
* A frame number past what the current page tables can represent can't
diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
index d9ec20cc90..ee3380c131 100644
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
@@ -114,6 +114,8 @@
#define IOMMU_DEV_TABLE_PAGE_TABLE_PTR_LOW_MASK 0xFFFFF000
#define IOMMU_DEV_TABLE_PAGE_TABLE_PTR_LOW_SHIFT 12
+#define IOMMU_MAX_PT_LEVELS 6
+
/* DeviceTable Entry[63:32] */
#define IOMMU_DEV_TABLE_GV_SHIFT 23
#define IOMMU_DEV_TABLE_GV_MASK 0x800000
diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
index a3211ccdfb..35b7d9eb23 100644
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
@@ -185,7 +185,7 @@ static inline int amd_iommu_get_paging_mode(unsigned long
max_frames)
while ( max_frames > PTE_PER_TABLE_SIZE )
{
max_frames = PTE_PER_TABLE_ALIGN(max_frames) >> PTE_PER_TABLE_SHIFT;
- if ( ++level > 6 )
+ if ( ++level > IOMMU_MAX_PT_LEVELS )
return -ENOMEM;
}
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |