Skip to content

Commit 94a9921

Browse files
sarunkodjoergroedel
authored andcommitted
iommu/amd: Add support for HTRangeIgnore feature
AMD IOMMU reserves the address range 0xfd00000000-0xffffffffff for the hypertransport protocol (HT) and has special meaning. Hence devices cannot use this address range for the DMA. However on some AMD platforms this HT range is shifted to the very top of the address space and new feature bit `HTRangeIgnore` is introduced. When this feature bit is on, IOMMU treats the GPA access to the legacy HT range as regular GPA access. Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com> Reviewed-by: Vasant Hegde <vasant.hegde@amd.com> Link: https://lore.kernel.org/r/20250317055020.25214-1-sarunkod@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 94c721e commit 94a9921

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

drivers/iommu/amd/amd_iommu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ static inline int get_pci_sbdf_id(struct pci_dev *pdev)
147147
return PCI_SEG_DEVID_TO_SBDF(seg, devid);
148148
}
149149

150+
bool amd_iommu_ht_range_ignore(void);
151+
150152
/*
151153
* This must be called after device probe completes. During probe
152154
* use rlookup_amd_iommu() get the iommu.

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
#define FEATURE_SNPAVICSUP GENMASK_ULL(7, 5)
112112
#define FEATURE_SNPAVICSUP_GAM(x) \
113113
(FIELD_GET(FEATURE_SNPAVICSUP, x) == 0x1)
114+
#define FEATURE_HT_RANGE_IGNORE BIT_ULL(11)
114115

115116
#define FEATURE_NUM_INT_REMAP_SUP GENMASK_ULL(9, 8)
116117
#define FEATURE_NUM_INT_REMAP_SUP_2K(x) \

drivers/iommu/amd/init.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ int amd_iommu_get_num_iommus(void)
256256
return amd_iommus_present;
257257
}
258258

259+
bool amd_iommu_ht_range_ignore(void)
260+
{
261+
return check_feature2(FEATURE_HT_RANGE_IGNORE);
262+
}
263+
259264
/*
260265
* Iterate through all the IOMMUs to get common EFR
261266
* masks among all IOMMUs and warn if found inconsistency.

drivers/iommu/amd/iommu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,6 +2916,9 @@ static void amd_iommu_get_resv_regions(struct device *dev,
29162916
return;
29172917
list_add_tail(&region->list, head);
29182918

2919+
if (amd_iommu_ht_range_ignore())
2920+
return;
2921+
29192922
region = iommu_alloc_resv_region(HT_RANGE_START,
29202923
HT_RANGE_END - HT_RANGE_START + 1,
29212924
0, IOMMU_RESV_RESERVED, GFP_KERNEL);

0 commit comments

Comments
 (0)