[git pull] IOMMU Updates for v3.9

From: Joerg Roedel
Date: Mon Feb 25 2013 - 12:14:30 EST


Hi Linus,

This time the pull-request conflicts at a few places with your tree
(mostly due to other changes on ARM). The conflicts are more or less
trivial, I attach my resolution diff to this pull request. Please let me
know if you want me to resolve the conflicts first before you pull.
Anyway, here is the pull-request:

The following changes since commit 19f949f52599ba7c3f67a5897ac6be14bfcb1200:

Linux 3.8 (2013-02-18 15:58:34 -0800)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git tags/iommu-updates-v3.9

for you to fetch changes up to 604542b824f72fa5d7fd977af277538c1e15b5f0:

Merge branches 'core', 'arm/omap', 'iommu/fixes', 'arm/tegra', 'arm/shmobile', 'arm/exynos', 'x86/vt-d' and 'x86/amd' into next (2013-02-19 15:45:17 +0100)

----------------------------------------------------------------

IOMMU Updates for Linux v3.9

Besides some fixes and cleanups in the code there are three more
important changes to point out this time:

* New IOMMU driver for the ARM SHMOBILE platform
* An IOMMU-API extension for non-paging IOMMUs (required for
upcoming PAMU driver)
* Rework of the way the Tegra IOMMU driver accesses its
registetrs - register windows are easier to extend now.

There are also a few changes to non-iommu code, but that is acked by the
respective maintainers.

----------------------------------------------------------------
Alexey Kardashevskiy (1):
iommu: moving initialization earlier

Cho KyongHo (1):
ARM: EXYNOS: remove system mmu initialization from exynos tree

Cong Ding (1):
iommu/omap: Remove unnecessary null pointer check

Cyril Roelandt (1):
iommu/amd: Remove redundant NULL check before dma_ops_domain_free().

Hannes Reinecke (1):
iommu/vt-d: Zero out allocated memory in dmar_enable_qi

Hideki EIRAKU (4):
iommu/shmobile: Add iommu driver for Renesas IPMMU modules
ARM: mach-shmobile: sh7372: Add IPMMU device
ARM: mach-shmobile: sh73a0: Add IPMMU device
ARM: mach-shmobile: r8a7740: Add IPMMU device

Hiroshi Doyu (3):
iommu/tegra: smmu: Support variable MMIO ranges/blocks
iommu/tegra: smmu: Change SMMU's dependency on ARCH_TEGRA
iommu/tegra: smmu: Fix incorrect mask for regbase

Joerg Roedel (8):
iommu/tegra: smmu: Use helper function to check for valid register offset
iommu: Make sure DOMAIN_ATTR_MAX is really the maximum
iommu: Check for valid pgsize_bitmap in iommu_map/unmap
iommu: Implement DOMAIN_ATTR_PAGING attribute
iommu: Add domain window handling functions
iommu: Add DOMAIN_ATTR_WINDOWS domain attribute
iommu/amd: Initialize device table after dma_ops
Merge branches 'core', 'arm/omap', 'iommu/fixes', 'arm/tegra', 'arm/shmobile', 'arm/exynos', 'x86/vt-d' and 'x86/amd' into next

Sachin Kamat (1):
iommu/exynos: Make exynos_sysmmu_disable static

Sami Liedes (1):
iommu/tegra: Add missing spinlock initialization

Stephen Warren (2):
iommu/tegra: assume CONFIG_OF in gart driver
iommu/tegra: assume CONFIG_OF in SMMU driver

arch/arm/mach-exynos/Kconfig | 5 -
arch/arm/mach-exynos/Makefile | 1 -
arch/arm/mach-exynos/clock-exynos4.c | 41 ++-
arch/arm/mach-exynos/clock-exynos4210.c | 9 +-
arch/arm/mach-exynos/clock-exynos4212.c | 23 +-
arch/arm/mach-exynos/clock-exynos5.c | 62 +++--
arch/arm/mach-exynos/dev-sysmmu.c | 274 -------------------
arch/arm/mach-exynos/include/mach/sysmmu.h | 66 -----
arch/arm/mach-exynos/mach-exynos4-dt.c | 34 +++
arch/arm/mach-exynos/mach-exynos5-dt.c | 30 +++
arch/arm/mach-shmobile/setup-r8a7740.c | 33 +++
arch/arm/mach-shmobile/setup-sh7372.c | 39 +++
arch/arm/mach-shmobile/setup-sh73a0.c | 31 +++
drivers/iommu/Kconfig | 76 +++++-
drivers/iommu/Makefile | 2 +
drivers/iommu/amd_iommu.c | 3 +-
drivers/iommu/amd_iommu_init.c | 10 +-
drivers/iommu/dmar.c | 2 +-
drivers/iommu/exynos-iommu.c | 2 +-
drivers/iommu/iommu.c | 66 ++++-
drivers/iommu/omap-iommu.c | 4 +-
drivers/iommu/shmobile-iommu.c | 395 ++++++++++++++++++++++++++++
drivers/iommu/shmobile-ipmmu.c | 136 ++++++++++
drivers/iommu/shmobile-ipmmu.h | 34 +++
drivers/iommu/tegra-gart.c | 4 +-
drivers/iommu/tegra-smmu.c | 75 +++---
include/linux/iommu.h | 30 ++-
include/linux/platform_data/sh_ipmmu.h | 18 ++
28 files changed, 1043 insertions(+), 462 deletions(-)
delete mode 100644 arch/arm/mach-exynos/dev-sysmmu.c
delete mode 100644 arch/arm/mach-exynos/include/mach/sysmmu.h
create mode 100644 drivers/iommu/shmobile-iommu.c
create mode 100644 drivers/iommu/shmobile-ipmmu.c
create mode 100644 drivers/iommu/shmobile-ipmmu.h
create mode 100644 include/linux/platform_data/sh_ipmmu.h

Please pull.

Regards,

Joerg

My conflict resolution:

diff --cc arch/arm/mach-exynos/mach-exynos5-dt.c
index 973a066,2671075..acaeb14
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@@ -103,12 -104,36 +103,42 @@@ static const struct of_dev_auxdata exyn
OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000,
"exynos-tmu", NULL),
+ OF_DEV_AUXDATA("samsung,i2s-v5", 0x03830000,
+ "samsung-i2s.0", NULL),
+ OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D60000,
+ "samsung-i2s.1", NULL),
+ OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D70000,
+ "samsung-i2s.2", NULL),
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11210000,
+ "exynos-sysmmu.0", "mfc"), /* MFC_L */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11200000,
+ "exynos-sysmmu.1", "mfc"), /* MFC_R */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14650000,
+ "exynos-sysmmu.2", NULL), /* TV */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11F20000,
+ "exynos-sysmmu.3", "jpeg"), /* JPEG */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11D40000,
+ "exynos-sysmmu.4", NULL), /* ROTATOR */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E80000,
+ "exynos-sysmmu.5", "gscl"), /* GSCL0 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E90000,
+ "exynos-sysmmu.6", "gscl"), /* GSCL1 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EA0000,
+ "exynos-sysmmu.7", "gscl"), /* GSCL2 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EB0000,
+ "exynos-sysmmu.8", "gscl"), /* GSCL3 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13260000,
+ "exynos-sysmmu.9", NULL), /* FIMC-IS0 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x132C0000,
+ "exynos-sysmmu.10", NULL), /* FIMC-IS1 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14640000,
+ "exynos-sysmmu.11", NULL), /* FIMD1 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C40000,
+ "exynos-sysmmu.12", NULL), /* FIMC-LITE0 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C50000,
+ "exynos-sysmmu.13", NULL), /* FIMC-LITE1 */
+ OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x10A60000,
+ "exynos-sysmmu.14", NULL), /* G2D */
{},
};

diff --cc arch/arm/mach-shmobile/setup-r8a7740.c
index 30ac79c,b85bea5..3d7aa9d
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@@ -287,97 -263,37 +289,128 @@@ static struct platform_device cmt10_dev
.num_resources = ARRAY_SIZE(cmt10_resources),
};

+/* TMU */
+static struct sh_timer_config tmu00_platform_data = {
+ .name = "TMU00",
+ .channel_offset = 0x4,
+ .timer_bit = 0,
+ .clockevent_rating = 200,
+};
+
+static struct resource tmu00_resources[] = {
+ [0] = {
+ .name = "TMU00",
+ .start = 0xfff80008,
+ .end = 0xfff80014 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = intcs_evt2irq(0xe80),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device tmu00_device = {
+ .name = "sh_tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu00_platform_data,
+ },
+ .resource = tmu00_resources,
+ .num_resources = ARRAY_SIZE(tmu00_resources),
+};
+
+static struct sh_timer_config tmu01_platform_data = {
+ .name = "TMU01",
+ .channel_offset = 0x10,
+ .timer_bit = 1,
+ .clocksource_rating = 200,
+};
+
+static struct resource tmu01_resources[] = {
+ [0] = {
+ .name = "TMU01",
+ .start = 0xfff80014,
+ .end = 0xfff80020 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = intcs_evt2irq(0xea0),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device tmu01_device = {
+ .name = "sh_tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu01_platform_data,
+ },
+ .resource = tmu01_resources,
+ .num_resources = ARRAY_SIZE(tmu01_resources),
+};
+
+static struct sh_timer_config tmu02_platform_data = {
+ .name = "TMU02",
+ .channel_offset = 0x1C,
+ .timer_bit = 2,
+ .clocksource_rating = 200,
+};
+
+static struct resource tmu02_resources[] = {
+ [0] = {
+ .name = "TMU02",
+ .start = 0xfff80020,
+ .end = 0xfff8002C - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = intcs_evt2irq(0xec0),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device tmu02_device = {
+ .name = "sh_tmu",
+ .id = 2,
+ .dev = {
+ .platform_data = &tmu02_platform_data,
+ },
+ .resource = tmu02_resources,
+ .num_resources = ARRAY_SIZE(tmu02_resources),
+};
+
+ /* IPMMUI (an IPMMU module for ICB/LMB) */
+ static struct resource ipmmu_resources[] = {
+ [0] = {
+ .name = "IPMMUI",
+ .start = 0xfe951000,
+ .end = 0xfe9510ff,
+ .flags = IORESOURCE_MEM,
+ },
+ };
+
+ static const char * const ipmmu_dev_names[] = {
+ "sh_mobile_lcdc_fb.0",
+ "sh_mobile_lcdc_fb.1",
+ "sh_mobile_ceu.0",
+ };
+
+ static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
+ .dev_names = ipmmu_dev_names,
+ .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
+ };
+
+ static struct platform_device ipmmu_device = {
+ .name = "ipmmu",
+ .id = -1,
+ .dev = {
+ .platform_data = &ipmmu_platform_data,
+ },
+ .resource = ipmmu_resources,
+ .num_resources = ARRAY_SIZE(ipmmu_resources),
+ };
+
static struct platform_device *r8a7740_early_devices[] __initdata = {
&scif0_device,
&scif1_device,
@@@ -389,9 -305,7 +422,10 @@@
&scif7_device,
&scifb_device,
&cmt10_device,
+ &tmu00_device,
+ &tmu01_device,
+ &tmu02_device,
+ &ipmmu_device,
};

/* DMA */
diff --cc arch/arm/mach-shmobile/setup-sh73a0.c
index 2ecd668,36c2b2e..bdab575
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@@ -780,7 -755,36 +781,36 @@@ static struct platform_device pmu_devic
.resource = pmu_resources,
};

+ /* an IPMMU module for ICB */
+ static struct resource ipmmu_resources[] = {
+ [0] = {
+ .name = "IPMMU",
+ .start = 0xfe951000,
+ .end = 0xfe9510ff,
+ .flags = IORESOURCE_MEM,
+ },
+ };
+
+ static const char * const ipmmu_dev_names[] = {
+ "sh_mobile_lcdc_fb.0",
+ };
+
+ static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
+ .dev_names = ipmmu_dev_names,
+ .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
+ };
+
+ static struct platform_device ipmmu_device = {
+ .name = "ipmmu",
+ .id = -1,
+ .dev = {
+ .platform_data = &ipmmu_platform_data,
+ },
+ .resource = ipmmu_resources,
+ .num_resources = ARRAY_SIZE(ipmmu_resources),
+ };
+
-static struct platform_device *sh73a0_early_devices[] __initdata = {
+static struct platform_device *sh73a0_early_devices_dt[] __initdata = {
&scif0_device,
&scif1_device,
&scif2_device,
@@@ -791,11 -795,9 +821,12 @@@
&scif7_device,
&scif8_device,
&cmt10_device,
+};
+
+static struct platform_device *sh73a0_early_devices[] __initdata = {
&tmu00_device,
&tmu01_device,
+ &ipmmu_device,
};

static struct platform_device *sh73a0_late_devices[] __initdata = {
diff --cc drivers/iommu/tegra-smmu.c
index f08dbcd,8b1d9f7..eb0109f
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@@ -1177,10 -1185,13 +1186,13 @@@ static int tegra_smmu_probe(struct plat
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
if (!res)
return -ENODEV;
- smmu->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
- if (!smmu->regs[i])
- return -EBUSY;
+ smmu->regs[i] = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(smmu->regs[i]))
+ return PTR_ERR(smmu->regs[i]);
+ smmu->rege[i] = smmu->regs[i] + resource_size(res) - 1;
}
+ /* Same as "mc" 1st regiter block start address */
+ smmu->regbase = (void __iomem *)((u32)smmu->regs[0] & PAGE_MASK);

err = of_get_dma_window(dev->of_node, NULL, 0, NULL, &base, &size);
if (err)

Attachment: signature.asc
Description: Digital signature