iommu/ipmmu-vmsa: Disable cache snoop transactions on R-Car Gen3
According to the Hardware Manual Errata for Rev. 1.50 of April 10, 2019, cache snoop transactions for page table walk requests are not supported on R-Car Gen3. Hence, this patch removes setting these fields in the IMTTBCR register, since it will have no effect, and adds comments to the register bit definitions, to make it clear they apply to R-Car Gen2 only. Signed-off-by: Hai Nguyen Pham <hai.pham.ud@renesas.com> [geert: Reword, add comments] Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
5ca54fdc9b
commit
3623002f0f
|
@ -49,6 +49,7 @@ struct ipmmu_features {
|
|||
bool setup_imbuscr;
|
||||
bool twobit_imttbcr_sl0;
|
||||
bool reserved_context;
|
||||
bool cache_snoop;
|
||||
};
|
||||
|
||||
struct ipmmu_vmsa_device {
|
||||
|
@ -115,36 +116,36 @@ static struct ipmmu_vmsa_device *to_ipmmu(struct device *dev)
|
|||
#define IMTTBCR 0x0008
|
||||
#define IMTTBCR_EAE (1 << 31)
|
||||
#define IMTTBCR_PMB (1 << 30)
|
||||
#define IMTTBCR_SH1_NON_SHAREABLE (0 << 28)
|
||||
#define IMTTBCR_SH1_OUTER_SHAREABLE (2 << 28)
|
||||
#define IMTTBCR_SH1_INNER_SHAREABLE (3 << 28)
|
||||
#define IMTTBCR_SH1_MASK (3 << 28)
|
||||
#define IMTTBCR_ORGN1_NC (0 << 26)
|
||||
#define IMTTBCR_ORGN1_WB_WA (1 << 26)
|
||||
#define IMTTBCR_ORGN1_WT (2 << 26)
|
||||
#define IMTTBCR_ORGN1_WB (3 << 26)
|
||||
#define IMTTBCR_ORGN1_MASK (3 << 26)
|
||||
#define IMTTBCR_IRGN1_NC (0 << 24)
|
||||
#define IMTTBCR_IRGN1_WB_WA (1 << 24)
|
||||
#define IMTTBCR_IRGN1_WT (2 << 24)
|
||||
#define IMTTBCR_IRGN1_WB (3 << 24)
|
||||
#define IMTTBCR_IRGN1_MASK (3 << 24)
|
||||
#define IMTTBCR_SH1_NON_SHAREABLE (0 << 28) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_SH1_OUTER_SHAREABLE (2 << 28) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_SH1_INNER_SHAREABLE (3 << 28) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_SH1_MASK (3 << 28) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN1_NC (0 << 26) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN1_WB_WA (1 << 26) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN1_WT (2 << 26) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN1_WB (3 << 26) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN1_MASK (3 << 26) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN1_NC (0 << 24) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN1_WB_WA (1 << 24) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN1_WT (2 << 24) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN1_WB (3 << 24) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN1_MASK (3 << 24) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_TSZ1_MASK (7 << 16)
|
||||
#define IMTTBCR_TSZ1_SHIFT 16
|
||||
#define IMTTBCR_SH0_NON_SHAREABLE (0 << 12)
|
||||
#define IMTTBCR_SH0_OUTER_SHAREABLE (2 << 12)
|
||||
#define IMTTBCR_SH0_INNER_SHAREABLE (3 << 12)
|
||||
#define IMTTBCR_SH0_MASK (3 << 12)
|
||||
#define IMTTBCR_ORGN0_NC (0 << 10)
|
||||
#define IMTTBCR_ORGN0_WB_WA (1 << 10)
|
||||
#define IMTTBCR_ORGN0_WT (2 << 10)
|
||||
#define IMTTBCR_ORGN0_WB (3 << 10)
|
||||
#define IMTTBCR_ORGN0_MASK (3 << 10)
|
||||
#define IMTTBCR_IRGN0_NC (0 << 8)
|
||||
#define IMTTBCR_IRGN0_WB_WA (1 << 8)
|
||||
#define IMTTBCR_IRGN0_WT (2 << 8)
|
||||
#define IMTTBCR_IRGN0_WB (3 << 8)
|
||||
#define IMTTBCR_IRGN0_MASK (3 << 8)
|
||||
#define IMTTBCR_SH0_NON_SHAREABLE (0 << 12) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_SH0_OUTER_SHAREABLE (2 << 12) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_SH0_INNER_SHAREABLE (3 << 12) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_SH0_MASK (3 << 12) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN0_NC (0 << 10) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN0_WB_WA (1 << 10) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN0_WT (2 << 10) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN0_WB (3 << 10) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_ORGN0_MASK (3 << 10) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN0_NC (0 << 8) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN0_WB_WA (1 << 8) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN0_WT (2 << 8) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN0_WB (3 << 8) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_IRGN0_MASK (3 << 8) /* R-Car Gen2 only */
|
||||
#define IMTTBCR_SL0_TWOBIT_LVL_3 (0 << 6) /* R-Car Gen3 only */
|
||||
#define IMTTBCR_SL0_TWOBIT_LVL_2 (1 << 6) /* R-Car Gen3 only */
|
||||
#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)
|
|||
|
||||
/*
|
||||
* TTBCR
|
||||
* We use long descriptors with inner-shareable WBWA tables and allocate
|
||||
* the whole 32-bit VA space to TTBR0.
|
||||
* We use long descriptors and allocate the whole 32-bit VA space to
|
||||
* TTBR0.
|
||||
*/
|
||||
if (domain->mmu->features->twobit_imttbcr_sl0)
|
||||
tmp = IMTTBCR_SL0_TWOBIT_LVL_1;
|
||||
else
|
||||
tmp = IMTTBCR_SL0_LVL_1;
|
||||
|
||||
ipmmu_ctx_write_root(domain, IMTTBCR, IMTTBCR_EAE |
|
||||
IMTTBCR_SH0_INNER_SHAREABLE | IMTTBCR_ORGN0_WB_WA |
|
||||
IMTTBCR_IRGN0_WB_WA | tmp);
|
||||
if (domain->mmu->features->cache_snoop)
|
||||
tmp |= IMTTBCR_SH0_INNER_SHAREABLE | IMTTBCR_ORGN0_WB_WA |
|
||||
IMTTBCR_IRGN0_WB_WA;
|
||||
|
||||
ipmmu_ctx_write_root(domain, IMTTBCR, IMTTBCR_EAE | tmp);
|
||||
|
||||
/* MAIR0 */
|
||||
ipmmu_ctx_write_root(domain, IMMAIR0,
|
||||
|
@ -987,6 +990,7 @@ static const struct ipmmu_features ipmmu_features_default = {
|
|||
.setup_imbuscr = true,
|
||||
.twobit_imttbcr_sl0 = false,
|
||||
.reserved_context = false,
|
||||
.cache_snoop = true,
|
||||
};
|
||||
|
||||
static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
|
||||
|
@ -997,6 +1001,7 @@ static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
|
|||
.setup_imbuscr = false,
|
||||
.twobit_imttbcr_sl0 = true,
|
||||
.reserved_context = true,
|
||||
.cache_snoop = false,
|
||||
};
|
||||
|
||||
static const struct of_device_id ipmmu_of_ids[] = {
|
||||
|
|
Loading…
Reference in New Issue