mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
AMD/IOMMU: abstract maximum number of page table levels
We will want to use the constant elsewhere.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
master commit: a038b514c1
master date: 2022-04-05 14:20:04 +0200
This commit is contained in:
1 parent
e6d6b5ba03
commit
454d5351a9
3 files changed
+3
-2
No files matched your search
@@ -260,7 +260,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
|
||||
|
||||
@@ -110,6 +110,7 @@ struct amd_iommu_dte {
|
||||
bool tv:1;
|
||||
unsigned int :5;
|
||||
unsigned int had:2;
|
||||
#define IOMMU_MAX_PT_LEVELS 6
|
||||
unsigned int paging_mode:3;
|
||||
uint64_t pt_root:40;
|
||||
bool ppr:1;
|
||||
|
||||
@@ -193,7 +193,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;
|
||||
}
|
||||
|
||||
|
||||