Re: [PATCH v3 (alternative) 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()

2015-06-15 Thread Marek Szyprowski

Hello,

On 2015-06-12 15:51, Inki Dae wrote:

On 2015년 06월 12일 21:10, Inki Dae wrote:

On 2015년 06월 12일 18:07, 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.

Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
Changelog:
v3 (alternative):
- araranged code by moving fimd_{enable,disable}_vblank functions before
   fimd_clear_channel to avoid forward declaration usage

Marek,

For the iommu and atomic feature test, I merged below patches in
addition and tested them.

[PATCH v2 1/3] drm/exynos: remove to call mixer_wait_for_vblank
[PATCH v2 2/3] drm/exynos: remove chained calls to enable
[PATCH v2 3/3] drm/exynos: initialize VIDCON0 when fimd is disabled


However, I see below one warning log,

[1.227115] [drm] Initialized drm 1.1.0 20060810
[1.235852] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
vidi_component_ops)
[1.253548] [ cut here ]
[1.256700] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/drm_irq.c:1718
drm_handle_vblank+0x2a0/0x308()
[1.265800] Modules linked in:
[1.268844] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.1.0-rc4-00574-gf8eb363-dirty #1412
[1.277085] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[1.283184] [c0015464] (unwind_backtrace) from [c00123c0]
(show_stack+0x10/0x14)
[1.288540] exynos-drm exynos-drm: bound 11c0.fimd (ops
fimd_component_ops)
[1.23] exynos-drm exynos-drm: bound 11c8.dsi (ops
exynos_dsi_component_ops)
[1.28] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[1.288891] [drm] No driver support for vblank timestamp query.
[1.288932] [drm] Initialized exynos 1.0.0 20110530 on minor 0
[1.324248] [c00123c0] (show_stack) from [c0528f74]
(dump_stack+0x84/0xc4)
[1.331437] [c0528f74] (dump_stack) from [c00246ac]
(warn_slowpath_common+0x80/0xb0)
[1.339504] [c00246ac] (warn_slowpath_common) from [c0024778]
(warn_slowpath_null+0x1c/0x24)
[1.348270] [c0024778] (warn_slowpath_null) from [c029c898]
(drm_handle_vblank+0x2a0/0x308)
[1.356965] [c029c898] (drm_handle_vblank) from [c02b8c80]
(fimd_irq_handler+0x78/0xd0)
[1.365292] [c02b8c80] (fimd_irq_handler) from [c00608f8]
(handle_irq_event_percpu+0x78/0x134)
[1.374231] [c00608f8] (handle_irq_event_percpu) from [c00609f0]
(handle_irq_event+0x3c/0x5c)
[1.374244] [c00609f0] (handle_irq_event) from [c0063698]
(handle_level_irq+0xc4/0x13c)
[1.374256] [c0063698] (handle_level_irq) from [c005ff7c]
(generic_handle_irq+0x2c/0x3c)
[1.374269] [c005ff7c] (generic_handle_irq) from [c02214ec]
(combiner_handle_cascade_irq+0x94/0x100)
[1.374281] [c02214ec] (combiner_handle_cascade_irq) from
[c005ff7c] (generic_handle_irq+0x2c/0x3c)
[1.374290] [c005ff7c] (generic_handle_irq) from [c0060248]
(__handle_domain_irq+0x7c/0xec)
[1.374300] [c0060248] (__handle_domain_irq) from [c0009434]
(gic_handle_irq+0x30/0x68)


And below one page fault error when modetest is terminated,

# modetest -M exynos -v -s 31@29:720x1280
setting mode 720x1280-60Hz@XR24 on connectors 31, crtc 29
freq: 59.99Hz

[   34.831025] PAGE FAULT occurred at 0x2040 by 11e2.sysmmu(Page
table base: 0x6e324000)
[   34.838072]  Lv1 entry: 0x6e92dc01
[   34.841489] [ cut here ]
[   34.846058] kernel BUG at drivers/iommu/exynos-iommu.c:364!
[   34.851614] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[   34.857428] Modules linked in:
[   34.860472] CPU: 0 PID: 6 Comm: kworker/u8:0 Tainted: GW
   4.1.0-rc4-00574-gf8eb363-dirty #1412
[   34.870188] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   34.876273] Workqueue: events_unbound async_run_entry_fn
[   34.881560] task: ee879540 ti: ee8a2000 task.ti: ee8a2000
[   34.886946] PC is at exynos_sysmmu_irq+0x184/0x208
[   34.891716] LR is at exynos_sysmmu_irq+0xd4/0x208
[   34.896404] pc : [c02880d0]lr : [c0288020]psr: 6193
[   34.896404] sp : ee8a3c00  ip :   fp : eeacbc10
[   34.907860] r10: c07c27ef  r9 : 0204  r8 : 2040
[   34.913068] r7 : ee324000  r6 : ee9b3428  r5 : ee9b3410  r4 : 
[   34.919577] r3 : 6e92dc01  r2 : 6e92dc01  r1 : eea55810  r0 : eeb0a000
[   34.926089] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
Segment kernel
[   34.933466] Control: 10c5387d  Table: 6dd2c04a  DAC: 0015
[   34.939195] Process kworker/u8:0 (pid: 6, stack limit = 0xee8a2210)
[   34.945444] Stack: (0xee8a3c00 to 0xee8a4000)
[   34.949788] 3c00: ee8a3c0c c0049df8  6e324000 0003d4f3
ee9b13c0 ee84ad20 
[   34.957947] 3c20:  

Re: [PATCH v3 (alternative) 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()

2015-06-15 Thread Inki Dae
On 2015년 06월 12일 22:00, Marek Szyprowski wrote:
 Hello,
 
 On 2015-06-12 14:10, Inki Dae wrote:
 On 2015년 06월 12일 18:07, 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.

 Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
 Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 ---
 Changelog:
 v3 (alternative):
 - araranged code by moving fimd_{enable,disable}_vblank functions before
fimd_clear_channel to avoid forward declaration usage
 Marek,

 For the iommu and atomic feature test, I merged below patches in
 addition and tested them.

 [PATCH v2 1/3] drm/exynos: remove to call mixer_wait_for_vblank
 [PATCH v2 2/3] drm/exynos: remove chained calls to enable
 [PATCH v2 3/3] drm/exynos: initialize VIDCON0 when fimd is disabled


 However, I see below one warning log,

 [1.227115] [drm] Initialized drm 1.1.0 20060810
 [1.235852] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
 vidi_component_ops)
 [1.253548] [ cut here ]
 [1.256700] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/drm_irq.c:1718
 drm_handle_vblank+0x2a0/0x308()
 [1.265800] Modules linked in:
 [1.268844] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
 4.1.0-rc4-00574-gf8eb363-dirty #1412
 [1.277085] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
 [1.283184] [c0015464] (unwind_backtrace) from [c00123c0]
 (show_stack+0x10/0x14)
 [1.288540] exynos-drm exynos-drm: bound 11c0.fimd (ops
 fimd_component_ops)
 [1.23] exynos-drm exynos-drm: bound 11c8.dsi (ops
 exynos_dsi_component_ops)
 [1.28] [drm] Supports vblank timestamp caching Rev 2
 (21.10.2013).
 [1.288891] [drm] No driver support for vblank timestamp query.
 [1.288932] [drm] Initialized exynos 1.0.0 20110530 on minor 0
 [1.324248] [c00123c0] (show_stack) from [c0528f74]
 (dump_stack+0x84/0xc4)
 [1.331437] [c0528f74] (dump_stack) from [c00246ac]
 (warn_slowpath_common+0x80/0xb0)
 [1.339504] [c00246ac] (warn_slowpath_common) from [c0024778]
 (warn_slowpath_null+0x1c/0x24)
 [1.348270] [c0024778] (warn_slowpath_null) from [c029c898]
 (drm_handle_vblank+0x2a0/0x308)
 [1.356965] [c029c898] (drm_handle_vblank) from [c02b8c80]
 (fimd_irq_handler+0x78/0xd0)
 [1.365292] [c02b8c80] (fimd_irq_handler) from [c00608f8]
 (handle_irq_event_percpu+0x78/0x134)
 [1.374231] [c00608f8] (handle_irq_event_percpu) from [c00609f0]
 (handle_irq_event+0x3c/0x5c)
 [1.374244] [c00609f0] (handle_irq_event) from [c0063698]
 (handle_level_irq+0xc4/0x13c)
 [1.374256] [c0063698] (handle_level_irq) from [c005ff7c]
 (generic_handle_irq+0x2c/0x3c)
 [1.374269] [c005ff7c] (generic_handle_irq) from [c02214ec]
 (combiner_handle_cascade_irq+0x94/0x100)
 [1.374281] [c02214ec] (combiner_handle_cascade_irq) from
 [c005ff7c] (generic_handle_irq+0x2c/0x3c)
 [1.374290] [c005ff7c] (generic_handle_irq) from [c0060248]
 (__handle_domain_irq+0x7c/0xec)
 [1.374300] [c0060248] (__handle_domain_irq) from [c0009434]
 (gic_handle_irq+0x30/0x68)


 And below one page fault error when modetest is terminated,

 # modetest -M exynos -v -s 31@29:720x1280
 setting mode 720x1280-60Hz@XR24 on connectors 31, crtc 29
 freq: 59.99Hz

 [   34.831025] PAGE FAULT occurred at 0x2040 by 11e2.sysmmu(Page
 table base: 0x6e324000)
 [   34.838072]  Lv1 entry: 0x6e92dc01
 [   34.841489] [ cut here ]
 [   34.846058] kernel BUG at drivers/iommu/exynos-iommu.c:364!
 [   34.851614] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
 [   34.857428] Modules linked in:
 [   34.860472] CPU: 0 PID: 6 Comm: kworker/u8:0 Tainted: GW
4.1.0-rc4-00574-gf8eb363-dirty #1412
 [   34.870188] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
 [   34.876273] Workqueue: events_unbound async_run_entry_fn
 [   34.881560] task: ee879540 ti: ee8a2000 task.ti: ee8a2000
 [   34.886946] PC is at exynos_sysmmu_irq+0x184/0x208
 [   34.891716] LR is at exynos_sysmmu_irq+0xd4/0x208
 [   34.896404] pc : [c02880d0]lr : [c0288020]psr: 6193
 [   34.896404] sp : ee8a3c00  ip :   fp : eeacbc10
 [   34.907860] r10: c07c27ef  r9 : 0204  r8 : 2040
 [   34.913068] r7 : ee324000  r6 : ee9b3428  r5 : ee9b3410  r4 : 
 [   34.919577] r3 : 6e92dc01  r2 : 6e92dc01  r1 : eea55810  r0 : eeb0a000
 [   34.926089] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
 Segment kernel
 [   34.933466] Control: 10c5387d  Table: 6dd2c04a  DAC: 0015
 [   34.939195] Process kworker/u8:0 (pid: 6, stack limit = 0xee8a2210)
 [   34.945444] Stack: (0xee8a3c00 to 0xee8a4000)
 [   34.949788] 3c00: 

[PATCH v3 (alternative) 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()

2015-06-12 Thread Marek Szyprowski
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.

Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
Changelog:
v3 (alternative):
- araranged code by moving fimd_{enable,disable}_vblank functions before
  fimd_clear_channel to avoid forward declaration usage

v2:
- rebased onto latest exynos-drm-next branch with atomic mode setting
  patches applied.


 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 130 +--
 1 file changed, 71 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 96618534358e..f490895a8b02 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -196,6 +196,62 @@ static inline struct fimd_driver_data 
*drm_fimd_get_driver_data(
return (struct fimd_driver_data *)of_id-data;
 }
 
+static int fimd_enable_vblank(struct exynos_drm_crtc *crtc)
+{
+   struct fimd_context *ctx = crtc-ctx;
+   u32 val;
+
+   if (ctx-suspended)
+   return -EPERM;
+
+   if (!test_and_set_bit(0, ctx-irq_flags)) {
+   val = readl(ctx-regs + VIDINTCON0);
+
+   val |= VIDINTCON0_INT_ENABLE;
+
+   if (ctx-i80_if) {
+   val |= VIDINTCON0_INT_I80IFDONE;
+   val |= VIDINTCON0_INT_SYSMAINCON;
+   val = ~VIDINTCON0_INT_SYSSUBCON;
+   } else {
+   val |= VIDINTCON0_INT_FRAME;
+
+   val = ~VIDINTCON0_FRAMESEL0_MASK;
+   val |= VIDINTCON0_FRAMESEL0_VSYNC;
+   val = ~VIDINTCON0_FRAMESEL1_MASK;
+   val |= VIDINTCON0_FRAMESEL1_NONE;
+   }
+
+   writel(val, ctx-regs + VIDINTCON0);
+   }
+
+   return 0;
+}
+
+static void fimd_disable_vblank(struct exynos_drm_crtc *crtc)
+{
+   struct fimd_context *ctx = crtc-ctx;
+   u32 val;
+
+   if (ctx-suspended)
+   return;
+
+   if (test_and_clear_bit(0, ctx-irq_flags)) {
+   val = readl(ctx-regs + VIDINTCON0);
+
+   val = ~VIDINTCON0_INT_ENABLE;
+
+   if (ctx-i80_if) {
+   val = ~VIDINTCON0_INT_I80IFDONE;
+   val = ~VIDINTCON0_INT_SYSMAINCON;
+   val = ~VIDINTCON0_INT_SYSSUBCON;
+   } else
+   val = ~VIDINTCON0_INT_FRAME;
+
+   writel(val, ctx-regs + VIDINTCON0);
+   }
+}
+
 static void fimd_wait_for_vblank(struct exynos_drm_crtc *crtc)
 {
struct fimd_context *ctx = crtc-ctx;
@@ -248,6 +304,12 @@ static void fimd_clear_channel(struct fimd_context *ctx)
 
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 +327,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,
@@ -434,61 +501,6 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
writel(val, ctx-regs + VIDCON0);
 }
 
-static int fimd_enable_vblank(struct exynos_drm_crtc *crtc)
-{
-   struct fimd_context *ctx = crtc-ctx;
-   u32 val;
-
-   if (ctx-suspended)
-   return -EPERM;
-
-   if (!test_and_set_bit(0, ctx-irq_flags)) {
-   val = readl(ctx-regs + VIDINTCON0);
-
-   val |= VIDINTCON0_INT_ENABLE;
-
-   if (ctx-i80_if) {
-   val |= VIDINTCON0_INT_I80IFDONE;
-   val |= VIDINTCON0_INT_SYSMAINCON;
-   val = ~VIDINTCON0_INT_SYSSUBCON;
-   } else {
-   val 

Re: [PATCH v3 (alternative) 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()

2015-06-12 Thread Inki Dae
On 2015년 06월 12일 18:07, 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.
 
 Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
 Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 ---
 Changelog:
 v3 (alternative):
 - araranged code by moving fimd_{enable,disable}_vblank functions before
   fimd_clear_channel to avoid forward declaration usage

Marek,

For the iommu and atomic feature test, I merged below patches in
addition and tested them.

[PATCH v2 1/3] drm/exynos: remove to call mixer_wait_for_vblank
[PATCH v2 2/3] drm/exynos: remove chained calls to enable
[PATCH v2 3/3] drm/exynos: initialize VIDCON0 when fimd is disabled


However, I see below one warning log,

[1.227115] [drm] Initialized drm 1.1.0 20060810
[1.235852] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
vidi_component_ops)
[1.253548] [ cut here ]
[1.256700] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/drm_irq.c:1718
drm_handle_vblank+0x2a0/0x308()
[1.265800] Modules linked in:
[1.268844] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.1.0-rc4-00574-gf8eb363-dirty #1412
[1.277085] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[1.283184] [c0015464] (unwind_backtrace) from [c00123c0]
(show_stack+0x10/0x14)
[1.288540] exynos-drm exynos-drm: bound 11c0.fimd (ops
fimd_component_ops)
[1.23] exynos-drm exynos-drm: bound 11c8.dsi (ops
exynos_dsi_component_ops)
[1.28] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[1.288891] [drm] No driver support for vblank timestamp query.
[1.288932] [drm] Initialized exynos 1.0.0 20110530 on minor 0
[1.324248] [c00123c0] (show_stack) from [c0528f74]
(dump_stack+0x84/0xc4)
[1.331437] [c0528f74] (dump_stack) from [c00246ac]
(warn_slowpath_common+0x80/0xb0)
[1.339504] [c00246ac] (warn_slowpath_common) from [c0024778]
(warn_slowpath_null+0x1c/0x24)
[1.348270] [c0024778] (warn_slowpath_null) from [c029c898]
(drm_handle_vblank+0x2a0/0x308)
[1.356965] [c029c898] (drm_handle_vblank) from [c02b8c80]
(fimd_irq_handler+0x78/0xd0)
[1.365292] [c02b8c80] (fimd_irq_handler) from [c00608f8]
(handle_irq_event_percpu+0x78/0x134)
[1.374231] [c00608f8] (handle_irq_event_percpu) from [c00609f0]
(handle_irq_event+0x3c/0x5c)
[1.374244] [c00609f0] (handle_irq_event) from [c0063698]
(handle_level_irq+0xc4/0x13c)
[1.374256] [c0063698] (handle_level_irq) from [c005ff7c]
(generic_handle_irq+0x2c/0x3c)
[1.374269] [c005ff7c] (generic_handle_irq) from [c02214ec]
(combiner_handle_cascade_irq+0x94/0x100)
[1.374281] [c02214ec] (combiner_handle_cascade_irq) from
[c005ff7c] (generic_handle_irq+0x2c/0x3c)
[1.374290] [c005ff7c] (generic_handle_irq) from [c0060248]
(__handle_domain_irq+0x7c/0xec)
[1.374300] [c0060248] (__handle_domain_irq) from [c0009434]
(gic_handle_irq+0x30/0x68)


And below one page fault error when modetest is terminated,

# modetest -M exynos -v -s 31@29:720x1280
setting mode 720x1280-60Hz@XR24 on connectors 31, crtc 29
freq: 59.99Hz

[   34.831025] PAGE FAULT occurred at 0x2040 by 11e2.sysmmu(Page
table base: 0x6e324000)
[   34.838072]  Lv1 entry: 0x6e92dc01
[   34.841489] [ cut here ]
[   34.846058] kernel BUG at drivers/iommu/exynos-iommu.c:364!
[   34.851614] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[   34.857428] Modules linked in:
[   34.860472] CPU: 0 PID: 6 Comm: kworker/u8:0 Tainted: GW
  4.1.0-rc4-00574-gf8eb363-dirty #1412
[   34.870188] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   34.876273] Workqueue: events_unbound async_run_entry_fn
[   34.881560] task: ee879540 ti: ee8a2000 task.ti: ee8a2000
[   34.886946] PC is at exynos_sysmmu_irq+0x184/0x208
[   34.891716] LR is at exynos_sysmmu_irq+0xd4/0x208
[   34.896404] pc : [c02880d0]lr : [c0288020]psr: 6193
[   34.896404] sp : ee8a3c00  ip :   fp : eeacbc10
[   34.907860] r10: c07c27ef  r9 : 0204  r8 : 2040
[   34.913068] r7 : ee324000  r6 : ee9b3428  r5 : ee9b3410  r4 : 
[   34.919577] r3 : 6e92dc01  r2 : 6e92dc01  r1 : eea55810  r0 : eeb0a000
[   34.926089] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
Segment kernel
[   34.933466] Control: 10c5387d  Table: 6dd2c04a  DAC: 0015
[   34.939195] Process kworker/u8:0 (pid: 6, stack limit = 0xee8a2210)
[   34.945444] Stack: (0xee8a3c00 to 0xee8a4000)
[   34.949788] 3c00: ee8a3c0c c0049df8  6e324000 0003d4f3
ee9b13c0 ee84ad20 
[   34.957947] 3c20:  0026 ee84acc0 c00608f8 6093
eef84580 ee84acc0 ee84ad20
[   34.966106] 

Re: [PATCH v3 (alternative) 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()

2015-06-12 Thread Marek Szyprowski

Hello,

On 2015-06-12 14:10, Inki Dae wrote:

On 2015년 06월 12일 18:07, 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.

Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
Changelog:
v3 (alternative):
- araranged code by moving fimd_{enable,disable}_vblank functions before
   fimd_clear_channel to avoid forward declaration usage

Marek,

For the iommu and atomic feature test, I merged below patches in
addition and tested them.

[PATCH v2 1/3] drm/exynos: remove to call mixer_wait_for_vblank
[PATCH v2 2/3] drm/exynos: remove chained calls to enable
[PATCH v2 3/3] drm/exynos: initialize VIDCON0 when fimd is disabled


However, I see below one warning log,

[1.227115] [drm] Initialized drm 1.1.0 20060810
[1.235852] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
vidi_component_ops)
[1.253548] [ cut here ]
[1.256700] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/drm_irq.c:1718
drm_handle_vblank+0x2a0/0x308()
[1.265800] Modules linked in:
[1.268844] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.1.0-rc4-00574-gf8eb363-dirty #1412
[1.277085] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[1.283184] [c0015464] (unwind_backtrace) from [c00123c0]
(show_stack+0x10/0x14)
[1.288540] exynos-drm exynos-drm: bound 11c0.fimd (ops
fimd_component_ops)
[1.23] exynos-drm exynos-drm: bound 11c8.dsi (ops
exynos_dsi_component_ops)
[1.28] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[1.288891] [drm] No driver support for vblank timestamp query.
[1.288932] [drm] Initialized exynos 1.0.0 20110530 on minor 0
[1.324248] [c00123c0] (show_stack) from [c0528f74]
(dump_stack+0x84/0xc4)
[1.331437] [c0528f74] (dump_stack) from [c00246ac]
(warn_slowpath_common+0x80/0xb0)
[1.339504] [c00246ac] (warn_slowpath_common) from [c0024778]
(warn_slowpath_null+0x1c/0x24)
[1.348270] [c0024778] (warn_slowpath_null) from [c029c898]
(drm_handle_vblank+0x2a0/0x308)
[1.356965] [c029c898] (drm_handle_vblank) from [c02b8c80]
(fimd_irq_handler+0x78/0xd0)
[1.365292] [c02b8c80] (fimd_irq_handler) from [c00608f8]
(handle_irq_event_percpu+0x78/0x134)
[1.374231] [c00608f8] (handle_irq_event_percpu) from [c00609f0]
(handle_irq_event+0x3c/0x5c)
[1.374244] [c00609f0] (handle_irq_event) from [c0063698]
(handle_level_irq+0xc4/0x13c)
[1.374256] [c0063698] (handle_level_irq) from [c005ff7c]
(generic_handle_irq+0x2c/0x3c)
[1.374269] [c005ff7c] (generic_handle_irq) from [c02214ec]
(combiner_handle_cascade_irq+0x94/0x100)
[1.374281] [c02214ec] (combiner_handle_cascade_irq) from
[c005ff7c] (generic_handle_irq+0x2c/0x3c)
[1.374290] [c005ff7c] (generic_handle_irq) from [c0060248]
(__handle_domain_irq+0x7c/0xec)
[1.374300] [c0060248] (__handle_domain_irq) from [c0009434]
(gic_handle_irq+0x30/0x68)


And below one page fault error when modetest is terminated,

# modetest -M exynos -v -s 31@29:720x1280
setting mode 720x1280-60Hz@XR24 on connectors 31, crtc 29
freq: 59.99Hz

[   34.831025] PAGE FAULT occurred at 0x2040 by 11e2.sysmmu(Page
table base: 0x6e324000)
[   34.838072]  Lv1 entry: 0x6e92dc01
[   34.841489] [ cut here ]
[   34.846058] kernel BUG at drivers/iommu/exynos-iommu.c:364!
[   34.851614] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[   34.857428] Modules linked in:
[   34.860472] CPU: 0 PID: 6 Comm: kworker/u8:0 Tainted: GW
   4.1.0-rc4-00574-gf8eb363-dirty #1412
[   34.870188] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   34.876273] Workqueue: events_unbound async_run_entry_fn
[   34.881560] task: ee879540 ti: ee8a2000 task.ti: ee8a2000
[   34.886946] PC is at exynos_sysmmu_irq+0x184/0x208
[   34.891716] LR is at exynos_sysmmu_irq+0xd4/0x208
[   34.896404] pc : [c02880d0]lr : [c0288020]psr: 6193
[   34.896404] sp : ee8a3c00  ip :   fp : eeacbc10
[   34.907860] r10: c07c27ef  r9 : 0204  r8 : 2040
[   34.913068] r7 : ee324000  r6 : ee9b3428  r5 : ee9b3410  r4 : 
[   34.919577] r3 : 6e92dc01  r2 : 6e92dc01  r1 : eea55810  r0 : eeb0a000
[   34.926089] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
Segment kernel
[   34.933466] Control: 10c5387d  Table: 6dd2c04a  DAC: 0015
[   34.939195] Process kworker/u8:0 (pid: 6, stack limit = 0xee8a2210)
[   34.945444] Stack: (0xee8a3c00 to 0xee8a4000)
[   34.949788] 3c00: ee8a3c0c c0049df8  6e324000 0003d4f3
ee9b13c0 ee84ad20 
[   34.957947] 3c20:  0026 ee84acc0 c00608f8 6093
eef84580 

Re: [PATCH v3 (alternative) 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()

2015-06-12 Thread Inki Dae
On 2015년 06월 12일 21:10, Inki Dae wrote:
 On 2015년 06월 12일 18:07, 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.

 Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com
 Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 ---
 Changelog:
 v3 (alternative):
 - araranged code by moving fimd_{enable,disable}_vblank functions before
   fimd_clear_channel to avoid forward declaration usage
 
 Marek,
 
 For the iommu and atomic feature test, I merged below patches in
 addition and tested them.
 
 [PATCH v2 1/3] drm/exynos: remove to call mixer_wait_for_vblank
 [PATCH v2 2/3] drm/exynos: remove chained calls to enable
 [PATCH v2 3/3] drm/exynos: initialize VIDCON0 when fimd is disabled
 
 
 However, I see below one warning log,
 
 [1.227115] [drm] Initialized drm 1.1.0 20060810
 [1.235852] exynos-drm exynos-drm: bound exynos-drm-vidi (ops
 vidi_component_ops)
 [1.253548] [ cut here ]
 [1.256700] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/drm_irq.c:1718
 drm_handle_vblank+0x2a0/0x308()
 [1.265800] Modules linked in:
 [1.268844] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
 4.1.0-rc4-00574-gf8eb363-dirty #1412
 [1.277085] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
 [1.283184] [c0015464] (unwind_backtrace) from [c00123c0]
 (show_stack+0x10/0x14)
 [1.288540] exynos-drm exynos-drm: bound 11c0.fimd (ops
 fimd_component_ops)
 [1.23] exynos-drm exynos-drm: bound 11c8.dsi (ops
 exynos_dsi_component_ops)
 [1.28] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
 [1.288891] [drm] No driver support for vblank timestamp query.
 [1.288932] [drm] Initialized exynos 1.0.0 20110530 on minor 0
 [1.324248] [c00123c0] (show_stack) from [c0528f74]
 (dump_stack+0x84/0xc4)
 [1.331437] [c0528f74] (dump_stack) from [c00246ac]
 (warn_slowpath_common+0x80/0xb0)
 [1.339504] [c00246ac] (warn_slowpath_common) from [c0024778]
 (warn_slowpath_null+0x1c/0x24)
 [1.348270] [c0024778] (warn_slowpath_null) from [c029c898]
 (drm_handle_vblank+0x2a0/0x308)
 [1.356965] [c029c898] (drm_handle_vblank) from [c02b8c80]
 (fimd_irq_handler+0x78/0xd0)
 [1.365292] [c02b8c80] (fimd_irq_handler) from [c00608f8]
 (handle_irq_event_percpu+0x78/0x134)
 [1.374231] [c00608f8] (handle_irq_event_percpu) from [c00609f0]
 (handle_irq_event+0x3c/0x5c)
 [1.374244] [c00609f0] (handle_irq_event) from [c0063698]
 (handle_level_irq+0xc4/0x13c)
 [1.374256] [c0063698] (handle_level_irq) from [c005ff7c]
 (generic_handle_irq+0x2c/0x3c)
 [1.374269] [c005ff7c] (generic_handle_irq) from [c02214ec]
 (combiner_handle_cascade_irq+0x94/0x100)
 [1.374281] [c02214ec] (combiner_handle_cascade_irq) from
 [c005ff7c] (generic_handle_irq+0x2c/0x3c)
 [1.374290] [c005ff7c] (generic_handle_irq) from [c0060248]
 (__handle_domain_irq+0x7c/0xec)
 [1.374300] [c0060248] (__handle_domain_irq) from [c0009434]
 (gic_handle_irq+0x30/0x68)
 
 
 And below one page fault error when modetest is terminated,
 
 # modetest -M exynos -v -s 31@29:720x1280
 setting mode 720x1280-60Hz@XR24 on connectors 31, crtc 29
 freq: 59.99Hz
 
 [   34.831025] PAGE FAULT occurred at 0x2040 by 11e2.sysmmu(Page
 table base: 0x6e324000)
 [   34.838072]  Lv1 entry: 0x6e92dc01
 [   34.841489] [ cut here ]
 [   34.846058] kernel BUG at drivers/iommu/exynos-iommu.c:364!
 [   34.851614] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
 [   34.857428] Modules linked in:
 [   34.860472] CPU: 0 PID: 6 Comm: kworker/u8:0 Tainted: GW
   4.1.0-rc4-00574-gf8eb363-dirty #1412
 [   34.870188] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
 [   34.876273] Workqueue: events_unbound async_run_entry_fn
 [   34.881560] task: ee879540 ti: ee8a2000 task.ti: ee8a2000
 [   34.886946] PC is at exynos_sysmmu_irq+0x184/0x208
 [   34.891716] LR is at exynos_sysmmu_irq+0xd4/0x208
 [   34.896404] pc : [c02880d0]lr : [c0288020]psr: 6193
 [   34.896404] sp : ee8a3c00  ip :   fp : eeacbc10
 [   34.907860] r10: c07c27ef  r9 : 0204  r8 : 2040
 [   34.913068] r7 : ee324000  r6 : ee9b3428  r5 : ee9b3410  r4 : 
 [   34.919577] r3 : 6e92dc01  r2 : 6e92dc01  r1 : eea55810  r0 : eeb0a000
 [   34.926089] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
 Segment kernel
 [   34.933466] Control: 10c5387d  Table: 6dd2c04a  DAC: 0015
 [   34.939195] Process kworker/u8:0 (pid: 6, stack limit = 0xee8a2210)
 [   34.945444] Stack: (0xee8a3c00 to 0xee8a4000)
 [   34.949788] 3c00: ee8a3c0c c0049df8  6e324000 0003d4f3