Skip to content

Commit 7016b30

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd: Initialize iommu_device->max_pasids
Commit 1adf3cc ("iommu: Add max_pasids field in struct iommu_device") introduced a variable struct iommu_device.max_pasids to track max PASIDS supported by each IOMMU. Let us initialize this field for AMD IOMMU. IOMMU core will use this value to set max PASIDs per device (see __iommu_probe_device()). Also remove unused global 'amd_iommu_max_pasid' variable. Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com> Link: https://lore.kernel.org/r/20230921092147.5930-15-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent eda8c28 commit 7016b30

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,9 +886,6 @@ extern unsigned amd_iommu_aperture_order;
886886
/* allocation bitmap for domain ids */
887887
extern unsigned long *amd_iommu_pd_alloc_bitmap;
888888

889-
/* Smallest max PASID supported by any IOMMU in the system */
890-
extern u32 amd_iommu_max_pasid;
891-
892889
extern bool amd_iommu_force_isolation;
893890

894891
/* Max levels of glxval supported */

drivers/iommu/amd/init.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ static int amd_iommus_present;
185185
bool amd_iommu_np_cache __read_mostly;
186186
bool amd_iommu_iotlb_sup __read_mostly = true;
187187

188-
u32 amd_iommu_max_pasid __read_mostly = ~0;
189-
190188
static bool amd_iommu_pc_present __read_mostly;
191189
bool amdr_ivrs_remap_support __read_mostly;
192190

@@ -2080,16 +2078,13 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
20802078

20812079
if (check_feature(FEATURE_GT)) {
20822080
int glxval;
2083-
u32 max_pasid;
20842081
u64 pasmax;
20852082

20862083
pasmax = amd_iommu_efr & FEATURE_PASID_MASK;
20872084
pasmax >>= FEATURE_PASID_SHIFT;
2088-
max_pasid = (1 << (pasmax + 1)) - 1;
2089-
2090-
amd_iommu_max_pasid = min(amd_iommu_max_pasid, max_pasid);
2085+
iommu->iommu.max_pasids = (1 << (pasmax + 1)) - 1;
20912086

2092-
BUG_ON(amd_iommu_max_pasid & ~PASID_MASK);
2087+
BUG_ON(iommu->iommu.max_pasids & ~PASID_MASK);
20932088

20942089
glxval = amd_iommu_efr & FEATURE_GLXVAL_MASK;
20952090
glxval >>= FEATURE_GLXVAL_SHIFT;

0 commit comments

Comments
 (0)