@@ -49,6 +49,7 @@ struct ipmmu_features {
49
49
bool setup_imbuscr ;
50
50
bool twobit_imttbcr_sl0 ;
51
51
bool reserved_context ;
52
+ bool cache_snoop ;
52
53
};
53
54
54
55
struct ipmmu_vmsa_device {
@@ -115,36 +116,36 @@ static struct ipmmu_vmsa_device *to_ipmmu(struct device *dev)
115
116
#define IMTTBCR 0x0008
116
117
#define IMTTBCR_EAE (1 << 31)
117
118
#define IMTTBCR_PMB (1 << 30)
118
- #define IMTTBCR_SH1_NON_SHAREABLE (0 << 28)
119
- #define IMTTBCR_SH1_OUTER_SHAREABLE (2 << 28)
120
- #define IMTTBCR_SH1_INNER_SHAREABLE (3 << 28)
121
- #define IMTTBCR_SH1_MASK (3 << 28)
122
- #define IMTTBCR_ORGN1_NC (0 << 26)
123
- #define IMTTBCR_ORGN1_WB_WA (1 << 26)
124
- #define IMTTBCR_ORGN1_WT (2 << 26)
125
- #define IMTTBCR_ORGN1_WB (3 << 26)
126
- #define IMTTBCR_ORGN1_MASK (3 << 26)
127
- #define IMTTBCR_IRGN1_NC (0 << 24)
128
- #define IMTTBCR_IRGN1_WB_WA (1 << 24)
129
- #define IMTTBCR_IRGN1_WT (2 << 24)
130
- #define IMTTBCR_IRGN1_WB (3 << 24)
131
- #define IMTTBCR_IRGN1_MASK (3 << 24)
119
+ #define IMTTBCR_SH1_NON_SHAREABLE (0 << 28) /* R-Car Gen2 only */
120
+ #define IMTTBCR_SH1_OUTER_SHAREABLE (2 << 28) /* R-Car Gen2 only */
121
+ #define IMTTBCR_SH1_INNER_SHAREABLE (3 << 28) /* R-Car Gen2 only */
122
+ #define IMTTBCR_SH1_MASK (3 << 28) /* R-Car Gen2 only */
123
+ #define IMTTBCR_ORGN1_NC (0 << 26) /* R-Car Gen2 only */
124
+ #define IMTTBCR_ORGN1_WB_WA (1 << 26) /* R-Car Gen2 only */
125
+ #define IMTTBCR_ORGN1_WT (2 << 26) /* R-Car Gen2 only */
126
+ #define IMTTBCR_ORGN1_WB (3 << 26) /* R-Car Gen2 only */
127
+ #define IMTTBCR_ORGN1_MASK (3 << 26) /* R-Car Gen2 only */
128
+ #define IMTTBCR_IRGN1_NC (0 << 24) /* R-Car Gen2 only */
129
+ #define IMTTBCR_IRGN1_WB_WA (1 << 24) /* R-Car Gen2 only */
130
+ #define IMTTBCR_IRGN1_WT (2 << 24) /* R-Car Gen2 only */
131
+ #define IMTTBCR_IRGN1_WB (3 << 24) /* R-Car Gen2 only */
132
+ #define IMTTBCR_IRGN1_MASK (3 << 24) /* R-Car Gen2 only */
132
133
#define IMTTBCR_TSZ1_MASK (7 << 16)
133
134
#define IMTTBCR_TSZ1_SHIFT 16
134
- #define IMTTBCR_SH0_NON_SHAREABLE (0 << 12)
135
- #define IMTTBCR_SH0_OUTER_SHAREABLE (2 << 12)
136
- #define IMTTBCR_SH0_INNER_SHAREABLE (3 << 12)
137
- #define IMTTBCR_SH0_MASK (3 << 12)
138
- #define IMTTBCR_ORGN0_NC (0 << 10)
139
- #define IMTTBCR_ORGN0_WB_WA (1 << 10)
140
- #define IMTTBCR_ORGN0_WT (2 << 10)
141
- #define IMTTBCR_ORGN0_WB (3 << 10)
142
- #define IMTTBCR_ORGN0_MASK (3 << 10)
143
- #define IMTTBCR_IRGN0_NC (0 << 8)
144
- #define IMTTBCR_IRGN0_WB_WA (1 << 8)
145
- #define IMTTBCR_IRGN0_WT (2 << 8)
146
- #define IMTTBCR_IRGN0_WB (3 << 8)
147
- #define IMTTBCR_IRGN0_MASK (3 << 8)
135
+ #define IMTTBCR_SH0_NON_SHAREABLE (0 << 12) /* R-Car Gen2 only */
136
+ #define IMTTBCR_SH0_OUTER_SHAREABLE (2 << 12) /* R-Car Gen2 only */
137
+ #define IMTTBCR_SH0_INNER_SHAREABLE (3 << 12) /* R-Car Gen2 only */
138
+ #define IMTTBCR_SH0_MASK (3 << 12) /* R-Car Gen2 only */
139
+ #define IMTTBCR_ORGN0_NC (0 << 10) /* R-Car Gen2 only */
140
+ #define IMTTBCR_ORGN0_WB_WA (1 << 10) /* R-Car Gen2 only */
141
+ #define IMTTBCR_ORGN0_WT (2 << 10) /* R-Car Gen2 only */
142
+ #define IMTTBCR_ORGN0_WB (3 << 10) /* R-Car Gen2 only */
143
+ #define IMTTBCR_ORGN0_MASK (3 << 10) /* R-Car Gen2 only */
144
+ #define IMTTBCR_IRGN0_NC (0 << 8) /* R-Car Gen2 only */
145
+ #define IMTTBCR_IRGN0_WB_WA (1 << 8) /* R-Car Gen2 only */
146
+ #define IMTTBCR_IRGN0_WT (2 << 8) /* R-Car Gen2 only */
147
+ #define IMTTBCR_IRGN0_WB (3 << 8) /* R-Car Gen2 only */
148
+ #define IMTTBCR_IRGN0_MASK (3 << 8) /* R-Car Gen2 only */
148
149
#define IMTTBCR_SL0_TWOBIT_LVL_3 (0 << 6) /* R-Car Gen3 only */
149
150
#define IMTTBCR_SL0_TWOBIT_LVL_2 (1 << 6) /* R-Car Gen3 only */
150
151
#define IMTTBCR_SL0_TWOBIT_LVL_1 (2 << 6) /* R-Car Gen3 only */
@@ -421,17 +422,19 @@ static void ipmmu_domain_setup_context(struct ipmmu_vmsa_domain *domain)
421
422
422
423
/*
423
424
* TTBCR
424
- * We use long descriptors with inner-shareable WBWA tables and allocate
425
- * the whole 32-bit VA space to TTBR0.
425
+ * We use long descriptors and allocate the whole 32-bit VA space to
426
+ * TTBR0.
426
427
*/
427
428
if (domain -> mmu -> features -> twobit_imttbcr_sl0 )
428
429
tmp = IMTTBCR_SL0_TWOBIT_LVL_1 ;
429
430
else
430
431
tmp = IMTTBCR_SL0_LVL_1 ;
431
432
432
- ipmmu_ctx_write_root (domain , IMTTBCR , IMTTBCR_EAE |
433
- IMTTBCR_SH0_INNER_SHAREABLE | IMTTBCR_ORGN0_WB_WA |
434
- IMTTBCR_IRGN0_WB_WA | tmp );
433
+ if (domain -> mmu -> features -> cache_snoop )
434
+ tmp |= IMTTBCR_SH0_INNER_SHAREABLE | IMTTBCR_ORGN0_WB_WA |
435
+ IMTTBCR_IRGN0_WB_WA ;
436
+
437
+ ipmmu_ctx_write_root (domain , IMTTBCR , IMTTBCR_EAE | tmp );
435
438
436
439
/* MAIR0 */
437
440
ipmmu_ctx_write_root (domain , IMMAIR0 ,
@@ -987,6 +990,7 @@ static const struct ipmmu_features ipmmu_features_default = {
987
990
.setup_imbuscr = true,
988
991
.twobit_imttbcr_sl0 = false,
989
992
.reserved_context = false,
993
+ .cache_snoop = true,
990
994
};
991
995
992
996
static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
@@ -997,6 +1001,7 @@ static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
997
1001
.setup_imbuscr = false,
998
1002
.twobit_imttbcr_sl0 = true,
999
1003
.reserved_context = true,
1004
+ .cache_snoop = false,
1000
1005
};
1001
1006
1002
1007
static const struct of_device_id ipmmu_of_ids [] = {
0 commit comments