Re: [PATCH 2/2] iommu/ipmmu-vmsa: Disable cache snoop transactions on R-Car Gen3

2019-09-05 Thread Simon Horman
On Wed, Sep 04, 2019 at 02:08:02PM +0200, Geert Uytterhoeven wrote:
> From: Hai Nguyen Pham 
> 
> 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 
> [geert: Reword, add comments]
> Signed-off-by: Geert Uytterhoeven 

Reviewed-by: Simon Horman 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH 2/2] iommu/ipmmu-vmsa: Disable cache snoop transactions on R-Car Gen3

2019-09-04 Thread Geert Uytterhoeven
From: Hai Nguyen Pham 

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 
[geert: Reword, add comments]
Signed-off-by: Geert Uytterhoeven 
---
 drivers/iommu/ipmmu-vmsa.c | 71 --
 1 file changed, 38 insertions(+), 33 deletions(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 1baabeaddc9cba1b..9da8309f71708f21 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -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 IMTTBCR0x0008
 #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