Skip to contentSkip to conversation

iommu/tegra: smmu: Unfied driver for Tegra SoCs

PATCH Superseded Hiroshi Doyu 3 participants 4 messages Jun 26, 2013 – Jul 1, 2013

Subsystems (3)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH 19/23 iommu/tegra: smmu: Unfied driver for Tegra SoCs

Support multiple generation of Tegra SoCs with this unified SMMU driver. Necessary info is expected to be passed from DT.

---
 drivers/iommu/tegra-smmu.c | 80 ++--------------------------------------------
 1 file changed, 3 insertions(+), 77 deletions(-)
drivers/iommu/tegra-smmu.c +3 -77
index 6e82df3..ae71721 100644
@@ -1,5 +1,5 @@
 /*
- * IOMMU API for SMMU in Tegra30
+ * IOMMU API for SMMU in Tegra SoC
  *
  * Copyright (c) 2011-2013, NVIDIA CORPORATION.  All rights reserved.
  *
@@ -41,46 +41,6 @@
 #include <asm/cacheflush.h>
 #include <asm/dma-iommu.h>
 
-enum smmu_hwgrp {
-	HWGRP_AFI,
-	HWGRP_AVPC,
-	HWGRP_DC,
-	HWGRP_DCB,
-	HWGRP_EPP,
-	HWGRP_G2,
-	HWGRP_HC,
-	HWGRP_HDA,
-	HWGRP_ISP,
-	HWGRP_MPE,
-	HWGRP_NV,
-	HWGRP_NV2,
-	HWGRP_PPCS,
-	HWGRP_SATA,
-	HWGRP_VDE,
-	HWGRP_VI,
-
-	HWGRP_COUNT,
-
-	HWGRP_END = ~0,
-};
-
-#define HWG_AFI		(1 << HWGRP_AFI)
-#define HWG_AVPC	(1 << HWGRP_AVPC)
-#define HWG_DC		(1 << HWGRP_DC)
-#define HWG_DCB		(1 << HWGRP_DCB)
-#define HWG_EPP		(1 << HWGRP_EPP)
-#define HWG_G2		(1 << HWGRP_G2)
-#define HWG_HC		(1 << HWGRP_HC)
-#define HWG_HDA		(1 << HWGRP_HDA)
-#define HWG_ISP		(1 << HWGRP_ISP)
-#define HWG_MPE		(1 << HWGRP_MPE)
-#define HWG_NV		(1 << HWGRP_NV)
-#define HWG_NV2		(1 << HWGRP_NV2)
-#define HWG_PPCS	(1 << HWGRP_PPCS)
-#define HWG_SATA	(1 << HWGRP_SATA)
-#define HWG_VDE		(1 << HWGRP_VDE)
-#define HWG_VI		(1 << HWGRP_VI)
-
 /* bitmap of the page sizes currently supported */
 #define SMMU_IOMMU_PGSIZES	(SZ_4K)
 
@@ -150,21 +110,7 @@ enum {
 #define SMMU_TRANSLATION_ENABLE_2		0x230
 
 #define SMMU_AFI_ASID	0x238   /* PCIE */
-#define SMMU_AVPC_ASID	0x23c   /* AVP */
-#define SMMU_DC_ASID	0x240   /* Display controller */
-#define SMMU_DCB_ASID	0x244   /* Display controller B */
-#define SMMU_EPP_ASID	0x248   /* Encoder pre-processor */
-#define SMMU_G2_ASID	0x24c   /* 2D engine */
-#define SMMU_HC_ASID	0x250   /* Host1x */
-#define SMMU_HDA_ASID	0x254   /* High-def audio */
-#define SMMU_ISP_ASID	0x258   /* Image signal processor */
-#define SMMU_MPE_ASID	0x264   /* MPEG encoder */
-#define SMMU_NV_ASID	0x268   /* (3D) */
-#define SMMU_NV2_ASID	0x26c   /* (3D) */
-#define SMMU_PPCS_ASID	0x270   /* AHB */
-#define SMMU_SATA_ASID	0x278   /* SATA */
-#define SMMU_VDE_ASID	0x27c   /* Video decoder */
-#define SMMU_VI_ASID	0x280   /* Video input */
+#define SMMU_SWGRP_ASID_BASE	SMMU_AFI_ASID
 
 #define SMMU_PDE_NEXT_SHIFT		28
 
@@ -236,26 +182,6 @@ enum {
 #define __smmu_client_enable_hwgrp(c, m) __smmu_client_set_hwgrp(c, m, 1)
 #define __smmu_client_disable_hwgrp(c)	__smmu_client_set_hwgrp(c, 0, 0)
 
-#define HWGRP_INIT(client) [HWGRP_##client] = SMMU_##client##_ASID
-
-static const u32 smmu_hwgrp_asid_reg[] = {
-	HWGRP_INIT(AFI),
-	HWGRP_INIT(AVPC),
-	HWGRP_INIT(DC),
-	HWGRP_INIT(DCB),
-	HWGRP_INIT(EPP),
-	HWGRP_INIT(G2),
-	HWGRP_INIT(HC),
-	HWGRP_INIT(HDA),
-	HWGRP_INIT(ISP),
-	HWGRP_INIT(MPE),
-	HWGRP_INIT(NV),
-	HWGRP_INIT(NV2),
-	HWGRP_INIT(PPCS),
-	HWGRP_INIT(SATA),
-	HWGRP_INIT(VDE),
-	HWGRP_INIT(VI),
-};
 #define HWGRP_ASID_REG(x) ((x) * sizeof(u32) + SMMU_AFI_ASID)
 
 /*
@@ -1353,7 +1279,7 @@ static void __exit tegra_smmu_exit(void)
 core_initcall(tegra_smmu_init);
 module_exit(tegra_smmu_exit);
 
-MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra30");
+MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra SoC");
 MODULE_AUTHOR("Hiroshi DOYU <[email protected]>");
 MODULE_ALIAS("platform:tegra-smmu");
 MODULE_LICENSE("GPL v2");
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 19/23 iommu/tegra: smmu: Unfied driver for Tegra SoCs

Quoted 13 lines · Hiroshi Doyu

Support multiple generation of Tegra SoCs with this unified SMMU driver. Necessary info is expected to be passed from DT.

---
 drivers/iommu/tegra-smmu.c | 80 ++--------------------------------------------
 1 file changed, 3 insertions(+), 77 deletions(-)
drivers/iommu/tegra-smmu.c +0 -0
index 6e82df3..ae71721 100644

drivers/iommu/tegra-smmu.c line 2

Quoted 3 lines
drivers/iommu/tegra-smmu.c +1 -1
@@ -1,5 +1,5 @@
 /*
- * IOMMU API for SMMU in Tegra30
+ * IOMMU API for SMMU in Tegra SoC

Maybe "Tegra30 and later SoCs" given that Tegra20 has no compatible IOMMU?

drivers/iommu/tegra-smmu.c static void __exit tegra_smmu_exit(void) · line 1282

Quoted 2 lines
drivers/iommu/tegra-smmu.c +1 -1
-MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra30");
+MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra SoC");

Same here.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130626/7a189b9e/attachment.sig>

#2 lore raw

PATCH 19/23 iommu/tegra: smmu: Unfied driver for Tegra SoCs

Thierry Reding <[email protected]> wrote @ Wed, 26 Jun 2013 13:07:47 +0200:

Quoted 23 lines

* PGP Signed by an unknown key

Quoted 13 lines · Hiroshi Doyu

Support multiple generation of Tegra SoCs with this unified SMMU driver. Necessary info is expected to be passed from DT.

---
 drivers/iommu/tegra-smmu.c | 80 ++--------------------------------------------
 1 file changed, 3 insertions(+), 77 deletions(-)
drivers/iommu/tegra-smmu.c +0 -0
index 6e82df3..ae71721 100644

drivers/iommu/tegra-smmu.c line 2

Quoted 3 lines
drivers/iommu/tegra-smmu.c +1 -1
@@ -1,5 +1,5 @@
 /*
- * IOMMU API for SMMU in Tegra30
+ * IOMMU API for SMMU in Tegra SoC

Maybe "Tegra30 and later SoCs" given that Tegra20 has no compatible IOMMU?

Quoted 4 lines

drivers/iommu/tegra-smmu.c static void __exit tegra_smmu_exit(void) · line 1282

Quoted 2 lines
drivers/iommu/tegra-smmu.c +1 -1
-MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra30");
+MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra SoC");

Same here.

Currently most of Tegra SoC has SMMU, and which doesn't have can be identified from DT. IMHO, we don't have to be so strict on this decritpions. Otherwise, we would need to list up which one (doesn't) has whenever a new one comes?

#3 lore raw

PATCH 19/23 iommu/tegra: smmu: Unfied driver for Tegra SoCs

Quoted 18 lines · Hiroshi Doyu

Thierry Reding <[email protected]> wrote @ Wed, 26 Jun 2013 13:07:47 +0200:

Quoted 9 lines · Hiroshi Doyu

drivers/iommu/tegra-smmu.c line 2

Quoted 7 lines

Support multiple generation of Tegra SoCs with this unified SMMU driver. Necessary info is expected to be passed from DT.

drivers/iommu/tegra-smmu.c +1 -1
 
- * IOMMU API for SMMU in Tegra30
+ * IOMMU API for SMMU in Tegra SoC
Quoted 7 lines

Maybe "Tegra30 and later SoCs" given that Tegra20 has no compatible IOMMU?

drivers/iommu/tegra-smmu.c static void __exit tegra_smmu_exit(void) · line 1282

Quoted 2 lines
drivers/iommu/tegra-smmu.c +1 -1
-MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra30");
+MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra SoC");

Same here.

Quoted 4 lines

Currently most of Tegra SoC has SMMU, and which doesn't have can be identified from DT. IMHO, we don't have to be so strict on this decritpions. Otherwise, we would need to list up which one (doesn't) has whenever a new one comes?

I would just say "Tegra30" here. The fact that other SoCs use the same HW block (or one compatible with it) doesn't really warrant changing those comments.