[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging-4.15] AMD/IOMMU: abstract maximum number of page table levels
commit ed84ea00e0e53c5fb9776034ef43d3048cae8362 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Tue Apr 5 15:00:55 2022 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Apr 5 15:00:55 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-defs.h | 1 + xen/drivers/passthrough/amd/iommu.h | 2 +- xen/drivers/passthrough/amd/iommu_map.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu-defs.h b/xen/drivers/passthrough/amd/iommu-defs.h index 0c97db2a32..8810e497b9 100644 --- a/xen/drivers/passthrough/amd/iommu-defs.h +++ b/xen/drivers/passthrough/amd/iommu-defs.h @@ -106,6 +106,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; diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h index e4d13f6ef5..b64ef0bf70 100644 --- a/xen/drivers/passthrough/amd/iommu.h +++ b/xen/drivers/passthrough/amd/iommu.h @@ -358,7 +358,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; } diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c index 8746b00e87..93e4ea2826 100644 --- a/xen/drivers/passthrough/amd/iommu_map.c +++ b/xen/drivers/passthrough/amd/iommu_map.c @@ -250,7 +250,7 @@ static int iommu_pde_from_dfn(struct domain *d, unsigned long dfn, table = hd->arch.amd.root_table; level = hd->arch.amd.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 -- generated by git-patchbot for /home/xen/git/xen.git#staging-4.15
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |