Skip to content

Commit b2bb057

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Always enable GCR3TRPMode when supported.
The GCR3TRPMode feature allows the DTE[GCR3TRP] field to be configured with GPA (instead of SPA). This simplifies the implementation, and is a pre-requisite for nested translation support. Therefore, always enable this feature if available. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent e05698c commit b2bb057

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108

109109
/* Extended Feature 2 Bits */
110110
#define FEATURE_SEVSNPIO_SUP BIT_ULL(1)
111+
#define FEATURE_GCR3TRPMODE BIT_ULL(3)
111112
#define FEATURE_SNPAVICSUP GENMASK_ULL(7, 5)
112113
#define FEATURE_SNPAVICSUP_GAM(x) \
113114
(FIELD_GET(FEATURE_SNPAVICSUP, x) == 0x1)
@@ -186,6 +187,7 @@
186187
#define CONTROL_EPH_EN 45
187188
#define CONTROL_XT_EN 50
188189
#define CONTROL_INTCAPXT_EN 51
190+
#define CONTROL_GCR3TRPMODE 58
189191
#define CONTROL_IRTCACHEDIS 59
190192
#define CONTROL_SNPAVIC_EN 61
191193

drivers/iommu/amd/init.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,14 @@ static void iommu_enable_gt(struct amd_iommu *iommu)
11221122
return;
11231123

11241124
iommu_feature_enable(iommu, CONTROL_GT_EN);
1125+
1126+
/*
1127+
* This feature needs to be enabled prior to a call
1128+
* to iommu_snp_enable(). Since this function is called
1129+
* in early_enable_iommu(), it is safe to enable here.
1130+
*/
1131+
if (check_feature2(FEATURE_GCR3TRPMODE))
1132+
iommu_feature_enable(iommu, CONTROL_GCR3TRPMODE);
11251133
}
11261134

11271135
/* sets a specific bit in the device table entry. */

0 commit comments

Comments
 (0)