On 2015년 06월 04일 22:08, Inki Dae wrote: > Hi Marek, > > On 2015년 06월 03일 17:26, Marek Szyprowski wrote: >> One should not do any assumptions on the stare of the fimd hardware >> during driver initialization, so to properly reset fimd before enabling >> IOMMU, one should ensure that all power domains and clocks are really >> enabled. This patch adds pm_runtime and clocks management in the >> fimd_clear_channel() function to ensure that any access to fimd >> registers will be performed with clocks and power domains enabled. > > I have tested this patch series on trats2 board which uses Exynos4412 > SoC. However, the booting is halted out. Without iommu, the booting and > display works well. > > For this test, I also merged another your patch series in iommu exynos > tree and added device node relevant codes like below, > > in exynos4.dtsi file: > fimd: fimd@11c00000 { > ... > iommus = <&sysmmu_fimd0>; > ... > > sysmmu_fimd0: sysmmu@11E20000 { > compatible = "samsung,exynos-sysmmu"; > reg = <0x11E20000 0x1000>; > interrupt-parent = <&combiner>; > interrupts = <5 2>; > clock-names = "sysmmu", "master"; > clocks = <&clock CLK_SMMU_FIMD0>, <&clock CLK_FIMD0>; > power-domains = <&pd_lcd0>; > #iommu-cells = <0>; > }; > > in exynos4412-trats2.dts file: > fimd@11c00000 { > status = "okay"; > iommu-reserved-mapping = <0x40000000 0x40000000 0x40000000>; > }; > > Can you check it out? In addition, sometimes I see below kernel panic logs which means page fault to fimd occurs while booting: [ 0.394228] 13800000.serial: ttySAC0 at MMIO 0x13800000 (irq = 56, base_baud = 0) is a S3C6400/10 [ 0.394788] 13810000.serial: ttySAC1 at MMIO 0x13810000 (irq = 57, base_baud = 0) is a S3C6400/10 [ 0.395281] 13820000.serial: ttySAC2 at MMIO 0x13820000 (irq = 58, base_baud = 0) is a S3C6400/10 [ 1.122219] console [ttySAC2] enabled [ 1.126419] 13830000.serial: ttySAC3 at MMIO 0x13830000 (irq = 59, base_baud = 0) is a S3C6400/10 [ 1.136250] [drm] Initialized drm 1.1.0 20060810 [ 1.142710] PAGE FAULT occurred at 0x52188000 by 11e20000.sysmmu(Page table base: 0x6ea80000) [ 1.149754] Lv1 entry: 0x6e92dc01 [ 1.153172] ------------[ cut here ]------------ [ 1.157740] kernel BUG at drivers/iommu/exynos-iommu.c:364! [ 1.163296] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 1.169110] Modules linked in: [ 1.172154] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.1.0-rc4-00563-gee14f4e-dirty #1384 [ 1.180394] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 1.186472] task: c06d2df0 ti: c06ce000 task.ti: c06ce000 [ 1.191861] PC is at exynos_sysmmu_irq+0x184/0x208 [ 1.196628] LR is at exynos_sysmmu_irq+0xd4/0x208 [ 1.201316] pc : [<c02677cc>] lr : [<c026771c>] psr: 60000193 [ 1.201316] sp : c06cfe90 ip : 00000000 fp : 00000000 [ 1.212772] r10: c06ff6a3 r9 : 00000521 r8 : 52188000 [ 1.217980] r7 : eea80000 r6 : ee9b3428 r5 : ee9b3410 r4 : 00000000 [ 1.224489] r3 : 6e92dc01 r2 : 6e92dc01 r1 : eea55810 r0 : ee9c4e00 [ 1.231002] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel [ 1.238378] Control: 10c5387d Table: 4000404a DAC: 00000015 [ 1.244107] Process swapper/0 (pid: 0, stack limit = 0xc06ce210) [ 1.250096] Stack: (0xc06cfe90 to 0xc06d0000) [ 1.254438] fe80: c06cfe9c c039caac eef82b80 6ea80000 [ 1.262599] fea0: 16b1580f ee9b4240 ee84ad20 00000000 00000000 00000026 ee84acc0 c0060308 [ 1.270757] fec0: 00000000 eef81380 ee84acc0 ee84ad20 ee9b4240 00000015 ee804450 c06cff68 [ 1.278916] fee0: ee808000 c0060400 ee84acc0 ee84ad20 ee807000 c00630a8 00000026 c06dddb8 [ 1.287075] ff00: ee807000 c005f98c 0000000a c0200ccc 00000015 00000000 00000015 00000000 [ 1.295235] ff20: 00000001 c005f98c c06caaac c005fc58 f002000c 00000015 c06d07a0 c06cff68 [ 1.303394] ff40: f0020000 c06ff6a1 00000001 c0009434 c0010068 60000113 ffffffff c06cff9c [ 1.311553] ff60: c06cffb8 c0012f40 00000000 00000000 00001288 c001c880 c06ce000 c06d04f8 [ 1.319712] ff80: c04a1f50 c06c92c4 c06cffb8 c06ff6a1 00000001 00000000 01000000 c06cffb0 [ 1.327871] ffa0: c0010064 c0010068 60000113 ffffffff c06ce000 c0053f58 ffffffff c067bc54 [ 1.336031] ffc0: ffffffff ffffffff c067b678 00000000 00000000 c06a70b8 c07023d4 c06d0480 [ 1.344190] ffe0: c06a70b4 c06d3f04 4000406a 413fc090 00000000 4000807c 00000000 00000000 [ 1.352366] [<c02677cc>] (exynos_sysmmu_irq) from [<c0060308>] (handle_irq_event_percpu+0x78/0x134) [ 1.361382] [<c0060308>] (handle_irq_event_percpu) from [<c0060400>] (handle_irq_event+0x3c/0x5c) [ 1.370235] [<c0060400>] (handle_irq_event) from [<c00630a8>] (handle_level_irq+0xc4/0x13c) [ 1.378567] [<c00630a8>] (handle_level_irq) from [<c005f98c>] (generic_handle_irq+0x2c/0x3c) [ 1.386990] [<c005f98c>] (generic_handle_irq) from [<c0200ccc>] (combiner_handle_cascade_irq+0x94/0x100) [ 1.396448] [<c0200ccc>] (combiner_handle_cascade_irq) from [<c005f98c>] (generic_handle_irq+0x2c/0x3c) [ 1.405820] [<c005f98c>] (generic_handle_irq) from [<c005fc58>] (__handle_domain_irq+0x7c/0xec) [ 1.414502] [<c005fc58>] (__handle_domain_irq) from [<c0009434>] (gic_handle_irq+0x30/0x68) [ 1.422833] [<c0009434>] (gic_handle_irq) from [<c0012f40>] (__irq_svc+0x40/0x74) [ 1.430292] Exception stack(0xc06cff68 to 0xc06cffb0) [ 1.435330] ff60: 00000000 00000000 00001288 c001c880 c06ce000 c06d04f8 [ 1.443489] ff80: c04a1f50 c06c92c4 c06cffb8 c06ff6a1 00000001 00000000 01000000 c06cffb0 [ 1.451646] ffa0: c0010064 c0010068 60000113 ffffffff [ 1.456689] [<c0012f40>] (__irq_svc) from [<c0010068>] (arch_cpu_idle+0x38/0x3c) [ 1.464069] [<c0010068>] (arch_cpu_idle) from [<c0053f58>] (cpu_startup_entry+0x12c/0x1c4) [ 1.472314] [<c0053f58>] (cpu_startup_entry) from [<c067bc54>] (start_kernel+0x398/0x3a4) [ 1.480468] [<c067bc54>] (start_kernel) from [<4000807c>] (0x4000807c) [ 1.486977] Code: e28dd014 e8bd83f0 e5913008 eaffffc0 (e7f001f2) [ 1.493062] ---[ end trace e8c5db152e219756 ]--- [ 1.497650] Kernel panic - not syncing: Fatal exception in interrupt [ 1.503990] CPU2: stopping [ 1.506681] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G D 4.1.0-rc4-00563-gee14f4e-dirty #1384 [ 1.516137] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 1.522229] [<c0015388>] (unwind_backtrace) from [<c0012440>] (show_stack+0x10/0x14) [ 1.529951] [<c0012440>] (show_stack) from [<c0499840>] (dump_stack+0x84/0xc4) [ 1.537151] [<c0499840>] (dump_stack) from [<c0014634>] (handle_IPI+0x17c/0x18c) [ 1.544526] [<c0014634>] (handle_IPI) from [<c0009468>] (gic_handle_irq+0x64/0x68) [ 1.552078] [<c0009468>] (gic_handle_irq) from [<c0012f40>] (__irq_svc+0x40/0x74) [ 1.559537] Exception stack(0xee8b1fa0 to 0xee8b1fe8) [ 1.564576] 1fa0: 00000002 00000000 000005de c001c880 ee8b0000 c06d04f8 c04a1f50 c06c92c4 [ 1.572735] 1fc0: ee8b1ff0 c06ff6a1 00000001 00000000 01000000 ee8b1fe8 c0010064 c0010068 [ 1.580890] 1fe0: 60000113 ffffffff [ 1.584369] [<c0012f40>] (__irq_svc) from [<c0010068>] (arch_cpu_idle+0x38/0x3c) [ 1.591749] [<c0010068>] (arch_cpu_idle) from [<c0053f58>] (cpu_startup_entry+0x12c/0x1c4) [ 1.599992] [<c0053f58>] (cpu_startup_entry) from [<4000950c>] (0x4000950c) [ 1.606932] CPU3: stopping [ 1.609626] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G D 4.1.0-rc4-00563-gee14f4e-dirty #1384 [ 1.619082] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 1.625171] [<c0015388>] (unwind_backtrace) from [<c0012440>] (show_stack+0x10/0x14) [ 1.632892] [<c0012440>] (show_stack) from [<c0499840>] (dump_stack+0x84/0xc4) [ 1.640094] [<c0499840>] (dump_stack) from [<c0014634>] (handle_IPI+0x17c/0x18c) [ 1.647470] [<c0014634>] (handle_IPI) from [<c0009468>] (gic_handle_irq+0x64/0x68) [ 1.655022] [<c0009468>] (gic_handle_irq) from [<c0012f40>] (__irq_svc+0x40/0x74) [ 1.662482] Exception stack(0xee8b3fa0 to 0xee8b3fe8) [ 1.667521] 3fa0: 00000003 00000000 000009c4 c001c880 ee8b2000 c06d04f8 c04a1f50 c06c92c4 [ 1.675680] 3fc0: ee8b3ff0 c06ff6a1 00000001 00000000 01000000 ee8b3fe8 c0010064 c0010068 [ 1.683835] 3fe0: 60000113 ffffffff [ 1.687314] [<c0012f40>] (__irq_svc) from [<c0010068>] (arch_cpu_idle+0x38/0x3c) [ 1.694694] [<c0010068>] (arch_cpu_idle) from [<c0053f58>] (cpu_startup_entry+0x12c/0x1c4) [ 1.702936] [<c0053f58>] (cpu_startup_entry) from [<4000950c>] (0x4000950c) [ 2.847590] SMP: failed to stop secondary CPUs [ 2.850551] ---[ end Kernel panic - not syncing: Fatal exception in interrupt > > Thanks, > Inki Dae > >> >> Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> >> Tested-by: Javier Martinez Canillas <javier.martinez@xxxxxxxxxxxxxxx> >> --- >> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 22 ++++++++++++++++++---- >> 1 file changed, 18 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c >> index 96618534358e..3ec9d4299a86 100644 >> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c >> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c >> @@ -242,12 +242,21 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, >> writel(val, ctx->regs + SHADOWCON); >> } >> >> +static int fimd_enable_vblank(struct exynos_drm_crtc *crtc); >> +static void fimd_disable_vblank(struct exynos_drm_crtc *crtc); >> + >> static void fimd_clear_channel(struct fimd_context *ctx) >> { >> unsigned int win, ch_enabled = 0; >> >> DRM_DEBUG_KMS("%s\n", __FILE__); >> >> + /* Hardware is in unknown state, so ensure it gets enabled properly */ >> + pm_runtime_get_sync(ctx->dev); >> + >> + clk_prepare_enable(ctx->bus_clk); >> + clk_prepare_enable(ctx->lcd_clk); >> + >> /* Check if any channel is enabled. */ >> for (win = 0; win < WINDOWS_NR; win++) { >> u32 val = readl(ctx->regs + WINCON(win)); >> @@ -265,12 +274,17 @@ static void fimd_clear_channel(struct fimd_context *ctx) >> >> /* Wait for vsync, as disable channel takes effect at next vsync */ >> if (ch_enabled) { >> - unsigned int state = ctx->suspended; >> - >> - ctx->suspended = 0; >> + ctx->suspended = false; >> + fimd_enable_vblank(ctx->crtc); >> fimd_wait_for_vblank(ctx->crtc); >> - ctx->suspended = state; >> + fimd_disable_vblank(ctx->crtc); >> + ctx->suspended = true; >> } >> + >> + clk_disable_unprepare(ctx->lcd_clk); >> + clk_disable_unprepare(ctx->bus_clk); >> + >> + pm_runtime_put(ctx->dev); >> } >> >> static int fimd_iommu_attach_devices(struct fimd_context *ctx, >> > -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html