@@ -1033,9 +1033,9 @@ static __le64 *arm_smmu_get_cd_ptr(struct arm_smmu_domain *smmu_domain,
1033
1033
unsigned int idx ;
1034
1034
struct arm_smmu_l1_ctx_desc * l1_desc ;
1035
1035
struct arm_smmu_device * smmu = smmu_domain -> smmu ;
1036
- struct arm_smmu_ctx_desc_cfg * cdcfg = & smmu_domain -> s1_cfg . cdcfg ;
1036
+ struct arm_smmu_ctx_desc_cfg * cdcfg = & smmu_domain -> cd_table ;
1037
1037
1038
- if (smmu_domain -> s1_cfg . s1fmt == STRTAB_STE_0_S1FMT_LINEAR )
1038
+ if (cdcfg -> s1fmt == STRTAB_STE_0_S1FMT_LINEAR )
1039
1039
return cdcfg -> cdtab + ssid * CTXDESC_CD_DWORDS ;
1040
1040
1041
1041
idx = ssid >> CTXDESC_SPLIT ;
@@ -1071,7 +1071,7 @@ int arm_smmu_write_ctx_desc(struct arm_smmu_domain *smmu_domain, int ssid,
1071
1071
bool cd_live ;
1072
1072
__le64 * cdptr ;
1073
1073
1074
- if (WARN_ON (ssid >= (1 << smmu_domain -> s1_cfg .s1cdmax )))
1074
+ if (WARN_ON (ssid >= (1 << smmu_domain -> cd_table .s1cdmax )))
1075
1075
return - E2BIG ;
1076
1076
1077
1077
cdptr = arm_smmu_get_cd_ptr (smmu_domain , ssid );
@@ -1138,19 +1138,18 @@ static int arm_smmu_alloc_cd_tables(struct arm_smmu_domain *smmu_domain)
1138
1138
size_t l1size ;
1139
1139
size_t max_contexts ;
1140
1140
struct arm_smmu_device * smmu = smmu_domain -> smmu ;
1141
- struct arm_smmu_s1_cfg * cfg = & smmu_domain -> s1_cfg ;
1142
- struct arm_smmu_ctx_desc_cfg * cdcfg = & cfg -> cdcfg ;
1141
+ struct arm_smmu_ctx_desc_cfg * cdcfg = & smmu_domain -> cd_table ;
1143
1142
1144
- max_contexts = 1 << cfg -> s1cdmax ;
1143
+ max_contexts = 1 << cdcfg -> s1cdmax ;
1145
1144
1146
1145
if (!(smmu -> features & ARM_SMMU_FEAT_2_LVL_CDTAB ) ||
1147
1146
max_contexts <= CTXDESC_L2_ENTRIES ) {
1148
- cfg -> s1fmt = STRTAB_STE_0_S1FMT_LINEAR ;
1147
+ cdcfg -> s1fmt = STRTAB_STE_0_S1FMT_LINEAR ;
1149
1148
cdcfg -> num_l1_ents = max_contexts ;
1150
1149
1151
1150
l1size = max_contexts * (CTXDESC_CD_DWORDS << 3 );
1152
1151
} else {
1153
- cfg -> s1fmt = STRTAB_STE_0_S1FMT_64K_L2 ;
1152
+ cdcfg -> s1fmt = STRTAB_STE_0_S1FMT_64K_L2 ;
1154
1153
cdcfg -> num_l1_ents = DIV_ROUND_UP (max_contexts ,
1155
1154
CTXDESC_L2_ENTRIES );
1156
1155
@@ -1186,7 +1185,7 @@ static void arm_smmu_free_cd_tables(struct arm_smmu_domain *smmu_domain)
1186
1185
int i ;
1187
1186
size_t size , l1size ;
1188
1187
struct arm_smmu_device * smmu = smmu_domain -> smmu ;
1189
- struct arm_smmu_ctx_desc_cfg * cdcfg = & smmu_domain -> s1_cfg . cdcfg ;
1188
+ struct arm_smmu_ctx_desc_cfg * cdcfg = & smmu_domain -> cd_table ;
1190
1189
1191
1190
if (cdcfg -> l1_desc ) {
1192
1191
size = CTXDESC_L2_ENTRIES * (CTXDESC_CD_DWORDS << 3 );
@@ -1276,7 +1275,7 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
1276
1275
u64 val = le64_to_cpu (dst [0 ]);
1277
1276
bool ste_live = false;
1278
1277
struct arm_smmu_device * smmu = NULL ;
1279
- struct arm_smmu_s1_cfg * s1_cfg = NULL ;
1278
+ struct arm_smmu_ctx_desc_cfg * cd_table = NULL ;
1280
1279
struct arm_smmu_s2_cfg * s2_cfg = NULL ;
1281
1280
struct arm_smmu_domain * smmu_domain = NULL ;
1282
1281
struct arm_smmu_cmdq_ent prefetch_cmd = {
@@ -1294,7 +1293,7 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
1294
1293
if (smmu_domain ) {
1295
1294
switch (smmu_domain -> stage ) {
1296
1295
case ARM_SMMU_DOMAIN_S1 :
1297
- s1_cfg = & smmu_domain -> s1_cfg ;
1296
+ cd_table = & smmu_domain -> cd_table ;
1298
1297
break ;
1299
1298
case ARM_SMMU_DOMAIN_S2 :
1300
1299
case ARM_SMMU_DOMAIN_NESTED :
@@ -1325,7 +1324,7 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
1325
1324
val = STRTAB_STE_0_V ;
1326
1325
1327
1326
/* Bypass/fault */
1328
- if (!smmu_domain || !(s1_cfg || s2_cfg )) {
1327
+ if (!smmu_domain || !(cd_table || s2_cfg )) {
1329
1328
if (!smmu_domain && disable_bypass )
1330
1329
val |= FIELD_PREP (STRTAB_STE_0_CFG , STRTAB_STE_0_CFG_ABORT );
1331
1330
else
@@ -1344,7 +1343,7 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
1344
1343
return ;
1345
1344
}
1346
1345
1347
- if (s1_cfg ) {
1346
+ if (cd_table ) {
1348
1347
u64 strw = smmu -> features & ARM_SMMU_FEAT_E2H ?
1349
1348
STRTAB_STE_1_STRW_EL2 : STRTAB_STE_1_STRW_NSEL1 ;
1350
1349
@@ -1360,10 +1359,10 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
1360
1359
!master -> stall_enabled )
1361
1360
dst [1 ] |= cpu_to_le64 (STRTAB_STE_1_S1STALLD );
1362
1361
1363
- val |= (s1_cfg -> cdcfg . cdtab_dma & STRTAB_STE_0_S1CTXPTR_MASK ) |
1362
+ val |= (cd_table -> cdtab_dma & STRTAB_STE_0_S1CTXPTR_MASK ) |
1364
1363
FIELD_PREP (STRTAB_STE_0_CFG , STRTAB_STE_0_CFG_S1_TRANS ) |
1365
- FIELD_PREP (STRTAB_STE_0_S1CDMAX , s1_cfg -> s1cdmax ) |
1366
- FIELD_PREP (STRTAB_STE_0_S1FMT , s1_cfg -> s1fmt );
1364
+ FIELD_PREP (STRTAB_STE_0_S1CDMAX , cd_table -> s1cdmax ) |
1365
+ FIELD_PREP (STRTAB_STE_0_S1FMT , cd_table -> s1fmt );
1367
1366
}
1368
1367
1369
1368
if (s2_cfg ) {
@@ -2069,11 +2068,11 @@ static void arm_smmu_domain_free(struct iommu_domain *domain)
2069
2068
2070
2069
/* Free the CD and ASID, if we allocated them */
2071
2070
if (smmu_domain -> stage == ARM_SMMU_DOMAIN_S1 ) {
2072
- struct arm_smmu_s1_cfg * cfg = & smmu_domain -> s1_cfg ;
2071
+ struct arm_smmu_ctx_desc_cfg * cd_table = & smmu_domain -> cd_table ;
2073
2072
2074
2073
/* Prevent SVA from touching the CD while we're freeing it */
2075
2074
mutex_lock (& arm_smmu_asid_lock );
2076
- if (cfg -> cdcfg . cdtab )
2075
+ if (cd_table -> cdtab )
2077
2076
arm_smmu_free_cd_tables (smmu_domain );
2078
2077
arm_smmu_free_asid (& smmu_domain -> cd );
2079
2078
mutex_unlock (& arm_smmu_asid_lock );
@@ -2093,7 +2092,7 @@ static int arm_smmu_domain_finalise_s1(struct arm_smmu_domain *smmu_domain,
2093
2092
int ret ;
2094
2093
u32 asid ;
2095
2094
struct arm_smmu_device * smmu = smmu_domain -> smmu ;
2096
- struct arm_smmu_s1_cfg * cfg = & smmu_domain -> s1_cfg ;
2095
+ struct arm_smmu_ctx_desc_cfg * cd_table = & smmu_domain -> cd_table ;
2097
2096
struct arm_smmu_ctx_desc * cd = & smmu_domain -> cd ;
2098
2097
typeof (& pgtbl_cfg -> arm_lpae_s1_cfg .tcr ) tcr = & pgtbl_cfg -> arm_lpae_s1_cfg .tcr ;
2099
2098
@@ -2106,7 +2105,7 @@ static int arm_smmu_domain_finalise_s1(struct arm_smmu_domain *smmu_domain,
2106
2105
if (ret )
2107
2106
goto out_unlock ;
2108
2107
2109
- cfg -> s1cdmax = master -> ssid_bits ;
2108
+ cd_table -> s1cdmax = master -> ssid_bits ;
2110
2109
2111
2110
smmu_domain -> stall_enabled = master -> stall_enabled ;
2112
2111
@@ -2446,7 +2445,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
2446
2445
ret = - EINVAL ;
2447
2446
goto out_unlock ;
2448
2447
} else if (smmu_domain -> stage == ARM_SMMU_DOMAIN_S1 &&
2449
- master -> ssid_bits != smmu_domain -> s1_cfg .s1cdmax ) {
2448
+ master -> ssid_bits != smmu_domain -> cd_table .s1cdmax ) {
2450
2449
ret = - EINVAL ;
2451
2450
goto out_unlock ;
2452
2451
} else if (smmu_domain -> stage == ARM_SMMU_DOMAIN_S1 &&
0 commit comments