iommu/exynos: Add IOMMU and Enhance System MMU driver for Exynos4
Subsystems (4)
v2 cover iommu/exynos: Add IOMMU and Enhance System MMU driver for Exynos4
This is the second try of submitting patches about IOMMU/System MMU driver for Exynos4 SoCs with the fixes of the following probles pointed by Russell King.:
- Missing unlocking a spinlock in exynos_iommu_attach_dev().
- atomic_t -> int in sysmmu_drvdata.activations
- sysmmu_platdata -> sysmmu_drvdata
- Change in error messages in irq handler
- Removed casting in format of error message
- omap_iommu_ops -> exynos_iommu_ops in the last patch.
First 2 patches enhance System MMU platform device definition:
- Removed System MMU for MDMA0 in LCD block because it is not used. Use MDMA2 in TOP block.
- Removed System MMU ID. Instead a System MMU is bound to a device that the System MMU is dedicated during machin initialization. If a device driver wants to handle System MMU, it must bind its device with System MMU with sysmmu_set_owner().
- clkdev
- System MMU device driver is removed from arch/arm/plat-s5p to move it to driver/iommu directory.
Last 2 patches implements IOMMU API:
- Implements IOMMU API and System MMU driver that is moved from arch/arm/plat-s5p.
- Implements fault handling that is suggested by Ohad.
- Used bus_set_iommu instead of register_iommu that is suggested by Joerg.
Regards,
Cho KyongHo.
Diffstats:
arch/arm/mach-exynos4/Kconfig | 2 - arch/arm/mach-exynos4/clock.c | 43 +- arch/arm/mach-exynos4/dev-sysmmu.c | 270 ++------ arch/arm/mach-exynos4/include/mach/irqs.h | 1 - arch/arm/mach-exynos4/include/mach/map.h | 1 - arch/arm/mach-exynos4/include/mach/sysmmu.h | 85 ++- arch/arm/mach-exynos4/mach-armlex4210.c | 24 +- arch/arm/mach-exynos4/mach-smdkv310.c | 28 +- arch/arm/plat-s5p/Kconfig | 8 - arch/arm/plat-s5p/Makefile | 1 - arch/arm/plat-s5p/include/plat/sysmmu.h | 95 --- arch/arm/plat-s5p/sysmmu.c | 312 --------- drivers/iommu/Kconfig | 14 + drivers/iommu/Makefile | 1 + drivers/iommu/exynos_iommu.c | 933 +++++++++++++++++++++++++++ 15 files changed, 1134 insertions(+), 684 deletions(-)
PATCH v2 1/4 ARM: EXYNOS4: Change System MMU device definition
This patch contains a lot of changes of System MMU device definition.
1. Removed sysmmu_ips enumeration that are definitions of ID of System MMU Instead, a System MMU device descriptor must be bound with a device descriptor that needs System MMU in machine initialization.
2. Removed MDMA that is included in LCD0 block because it is not used anymore. Use MDMA in TOP block.
3. Changed System MMU definitions of platform device. It is not an array anymore.
--- arch/arm/mach-exynos4/Kconfig | 2 - arch/arm/mach-exynos4/clock.c | 43 +++-- arch/arm/mach-exynos4/dev-sysmmu.c | 270 ++++++--------------------- arch/arm/mach-exynos4/include/mach/irqs.h | 1 - arch/arm/mach-exynos4/include/mach/map.h | 1 - arch/arm/mach-exynos4/include/mach/sysmmu.h | 85 +++++---- arch/arm/mach-exynos4/mach-armlex4210.c | 24 +++- arch/arm/mach-exynos4/mach-smdkv310.c | 28 +++- 8 files changed, 186 insertions(+), 268 deletions(-)
arch/arm/mach-exynos4/Kconfig +0 -2
@@ -141,7 +141,6 @@ config MACH_SMDKV310 select SAMSUNG_DEV_KEYPAD select EXYNOS4_DEV_PD select SAMSUNG_DEV_PWM - select EXYNOS4_DEV_SYSMMU select EXYNOS4_SETUP_FIMD0 select EXYNOS4_SETUP_I2C1 select EXYNOS4_SETUP_KEYPAD
@@ -158,7 +157,6 @@ config MACH_ARMLEX4210 select S3C_DEV_HSMMC2 select S3C_DEV_HSMMC3 select EXYNOS4_DEV_AHCI - select EXYNOS4_DEV_SYSMMU select EXYNOS4_SETUP_SDHCI help Machine support for Samsung ARMLEX4210 based on EXYNOS4210
arch/arm/mach-exynos4/clock.c +26 -17
85 lines not on this page · raw message
arch/arm/mach-exynos4/dev-sysmmu.c +60 -210
287 lines not on this page · raw message
arch/arm/mach-exynos4/include/mach/irqs.h +0 -1
@@ -123,7 +123,6 @@#define COMBINER_GROUP (x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128))#define COMBINER_IRQ (x, y) (COMBINER_GROUP(x) + y) -#define IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)#define IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)#define IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)#define IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3)
arch/arm/mach-exynos4/include/mach/map.h +0 -1
@@ -72,7 +72,6 @@#define EXYNOS4_PA_PDMA0 0x12680000#define EXYNOS4_PA_PDMA1 0x12690000 -#define EXYNOS4_PA_SYSMMU_MDMA 0x10A40000#define EXYNOS4_PA_SYSMMU_SSS 0x10A50000#define EXYNOS4_PA_SYSMMU_FIMC0 0x11A20000#define EXYNOS4_PA_SYSMMU_FIMC1 0x11A30000
arch/arm/mach-exynos4/include/mach/sysmmu.h +50 -35
94 lines not on this page · raw message
arch/arm/mach-exynos4/mach-armlex4210.c +23 -1
@@ -155,7 +155,23 @@ static struct platform_device *armlex4210_devices[] __initdata = { &s3c_device_hsmmc3, &s3c_device_rtc, &s3c_device_wdt, - &exynos4_device_sysmmu, +#ifdef CONFIG_EXYNOS4_DEV_SYSMMU + &SYSMMU_PLATDEV (sss), + &SYSMMU_PLATDEV (fimc0), + &SYSMMU_PLATDEV (fimc1), + &SYSMMU_PLATDEV (fimc2), + &SYSMMU_PLATDEV (fimc3), + &SYSMMU_PLATDEV (jpeg), + &SYSMMU_PLATDEV (fimd0), + &SYSMMU_PLATDEV (fimd1), + &SYSMMU_PLATDEV (pcie), + &SYSMMU_PLATDEV (g2d), + &SYSMMU_PLATDEV (rot), + &SYSMMU_PLATDEV (mdma), + &SYSMMU_PLATDEV (tv), + &SYSMMU_PLATDEV (mfc_l), + &SYSMMU_PLATDEV (mfc_r), +#endif &samsung_asoc_dma, &armlex4210_smsc911x, &exynos4_device_ahci,
@@ -193,6 +209,10 @@ static void __init armlex4210_map_io(void) ARRAY_SIZE(armlex4210_uartcfgs)); } +static void __init sysmmu_init (void ) +{ +} +static void __init armlex4210_machine_init (void ) {armlex4210_smsc911x_init ();
@@ -201,6 +221,8 @@ static void __init armlex4210_machine_init(void)armlex4210_wlan_init (); +sysmmu_init (); +platform_add_devices (armlex4210_devices,ARRAY_SIZE (armlex4210_devices)); }
arch/arm/mach-exynos4/mach-smdkv310.c +27 -1
@@ -40,6 +40,7 @@#include <plat/mfc.h> #include <mach/map.h> +#include <mach/sysmmu.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -255,7 +256,23 @@ static struct platform_device *smdkv310_devices[] __initdata = { &exynos4_device_pd[PD_TV ], &exynos4_device_pd[PD_GPS ], &exynos4_device_spdif, - &exynos4_device_sysmmu, +#ifdef CONFIG_S5P_SYSTEM_MMU + &SYSMMU_PLATDEV (sss), + &SYSMMU_PLATDEV (fimc0), + &SYSMMU_PLATDEV (fimc1), + &SYSMMU_PLATDEV (fimc2), + &SYSMMU_PLATDEV (fimc3), + &SYSMMU_PLATDEV (jpeg), + &SYSMMU_PLATDEV (fimd0), + &SYSMMU_PLATDEV (fimd1), + &SYSMMU_PLATDEV (pcie), + &SYSMMU_PLATDEV (g2d), + &SYSMMU_PLATDEV (rot), + &SYSMMU_PLATDEV (mdma), + &SYSMMU_PLATDEV (tv), + &SYSMMU_PLATDEV (mfc_l), + &SYSMMU_PLATDEV (mfc_r), +#endif &samsung_asoc_dma, &samsung_asoc_idma, &s5p_device_fimd0,
@@ -310,6 +327,13 @@ static void __init smdkv310_reserve(void)s5p_mfc_reserve_mem (0x43000000 ,8 <<20 ,0x51000000 ,8 <<20 ); } +static void __init sysmmu_init (void ) +{ +ASSIGN_SYSMMU_POWERDOMAIN (mfc, &exynos4_device_pd[PD_MFC ].dev); +sysmmu_set_owner (&SYSMMU_PLATDEV (mfc_l).dev, &s5p_device_mfc.dev); +sysmmu_set_owner (&SYSMMU_PLATDEV (mfc_r).dev, &s5p_device_mfc.dev); +} +static void __init smdkv310_machine_init (void ) {s3c_i2c1_set_platdata (NULL );
@@ -327,6 +351,8 @@ static void __init smdkv310_machine_init(void)samsung_bl_set (&smdkv310_bl_gpio_info, &smdkv310_bl_data);s5p_fimd0_set_platdata (&smdkv310_lcd0_pdata); +sysmmu_init (); +platform_add_devices (smdkv310_devices,ARRAY_SIZE (smdkv310_devices)); s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC ].dev; }
Signature · 1 line
1.7.1
PATCH v2 2/4 ARM: S5P: Remove system MMU driver from arm/plat-s5p
In reply to KyongHo ChoDue to Ohad Ben-Cohen gathered IOMMU drivers in drivers/iommu directory, System MMU driver is moved to drivers/iommu directory and removed from arch/arm/plat-s5p directory.
Please see
https://lkml.org/lkml/2011/6/8/69
--- arch/arm/plat-s5p/Kconfig | 8 - arch/arm/plat-s5p/Makefile | 1 - arch/arm/plat-s5p/include/plat/sysmmu.h | 95 ---------- arch/arm/plat-s5p/sysmmu.c | 312 ------------------------------- 4 files changed, 0 insertions(+), 416 deletions(-) delete mode 100644 arch/arm/plat-s5p/include/plat/sysmmu.h delete mode 100644 arch/arm/plat-s5p/sysmmu.c
arch/arm/plat-s5p/Kconfig +0 -8
@@ -40,14 +40,6 @@ config S5P_HRT help Use the High Resolution timer support -comment "System MMU" - -config S5P_SYSTEM_MMU - bool "S5P SYSTEM MMU" - depends on ARCH_EXYNOS4 - help - Say Y here if you want to enable System MMU - config S5P_DEV_FIMC0 bool help
arch/arm/plat-s5p/Makefile +0 -1
@@ -19,7 +19,6 @@ obj-y += clock.o obj-y += irq.o obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o obj-$(CONFIG_S5P_GPIO_INT) += irq-gpioint.o -obj-$(CONFIG_S5P_SYSTEM_MMU) += sysmmu.o obj-$(CONFIG_PM) += pm.o obj-$(CONFIG_PM) += irq-pm.o obj-$(CONFIG_S5P_HRT) += s5p-time.o
arch/arm/plat-s5p/include/plat/sysmmu.h deleted +0 -95
95 lines not on this page · raw message
arch/arm/plat-s5p/sysmmu.c deleted +0 -312
312 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 3/4 iommu/exynos: Add iommu driver for Exynos4 Platforms
In reply to KyongHo ChoThis is the System MMU driver and IOMMU API implementation for Exynos4 SOC platforms. Exynos4 platforms has more than 10 System MMUs dedicated for each multimedia accellerators.
--- drivers/iommu/Kconfig | 14 + drivers/iommu/Makefile | 1 + drivers/iommu/exynos_iommu.c | 933 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 948 insertions(+), 0 deletions(-) create mode 100644 drivers/iommu/exynos_iommu.c
drivers/iommu/Kconfig +14 -0
@@ -107,4 +107,18 @@ config INTR_REMAP To use x2apic mode in the CPU's which support x2APIC enhancements or to support platforms with CPU's having > 8 bit APIC ID, say Y. +# EXYNOS IOMMU support +config EXYNOS_IOMMU + bool "Exynos IOMMU Support" + depends on ARCH_EXYNOS4 + select IOMMU_API + select EXYNOS4_DEV_SYSMMU + help + Support for the IOMMUs (System MMUs) Samsung Exynos application + processor family. This enables H/W multimedia accellerators to view + non-linear physical memory chunks as a linear memory in their virtual + address spaces. + + If unsure, say N here. + endif # IOMMU_SUPPORT
drivers/iommu/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o obj-$(CONFIG_DMAR) += dmar.o iova.o intel-iommu.o obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o +obj-$(CONFIG_EXYNOS_IOMMU) += exynos_iommu.o
drivers/iommu/exynos_iommu.c new file +933 -0
933 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 4/4 iommu/exynos: Use bus_set_iommu instead of register_iommu
In reply to KyongHo ChoThis replaces register_iommu() with bus_set_iommu() according to the suggestion of Joerg Roedel.
--- drivers/iommu/exynos_iommu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/iommu/exynos_iommu.c +1 -1
@@ -926,7 +926,7 @@ static int __init exynos_iommu_init(void)if (!l2table_cachep)return -ENOMEM ; -register_iommu (&exynos_iommu_ops); +bus_set_iommu (&platform_bus_type, &exynos_iommu_ops);return 0 ; }
Signature · 1 line
1.7.1