[PATCH] drm: mali-dp: Log internal errors v2

2018-02-23 Thread Alexandru Gheorghe
Status register contains a lot of bits for reporting internal errors
inside Mali DP. Currently, we just silently ignore all of the erorrs,
that doesn't help when we are investigating different bugs, especially
on the FPGA models which have a lot of constrains, so we could easily
end up in AXI or underrun errors.

Add a new KConfig option called CONFIG_DRM_MALI_DISPLAY_DEBUG, which
enables the logging of the errors present in the status register.

Errors will be reported in  /sys/kernel/debug/tracing/trace,
still not noisy enough, but better than silently ignoring them.

E.g:
-0 [000] d.h1  2387.240042: malidp_de_irq: error occurred at vblank 
596 DE_STATUS is 0x0001
-0 [000] d.h1  2387.256703: malidp_de_irq: error occurred at vblank 
597 DE_STATUS is 0x0001
-0 [000] d.h1  2387.273458: malidp_de_irq: error occurred at vblank 
598 DE_STATUS is 0x0001
-0 [000] d.h1  2387.290035: malidp_de_irq: error occurred at vblank 
599 DE_STATUS is 0x0001

In addition to that, I removed the setting of MALIDP550_SE_IRQ_AXI_ERR
bit in the irq_mask, since that bit doesn't exist.

v2: Consistently refer the hardware as Mali DP.

Acked-by: Liviu Dudau 
Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/arm/Kconfig   | 10 +
 drivers/gpu/drm/arm/malidp_hw.c   | 45 ---
 drivers/gpu/drm/arm/malidp_hw.h   |  1 +
 drivers/gpu/drm/arm/malidp_regs.h |  6 ++
 4 files changed, 54 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/arm/Kconfig b/drivers/gpu/drm/arm/Kconfig
index 9a18e1b..46e95b2 100644
--- a/drivers/gpu/drm/arm/Kconfig
+++ b/drivers/gpu/drm/arm/Kconfig
@@ -40,3 +40,13 @@ config DRM_MALI_DISPLAY
  of the hardware.
 
  If compiled as a module it will be called mali-dp.
+
+config DRM_MALI_DISPLAY_DEBUG
+   bool "Enable Mali DP debugging"
+   default n
+   depends on DRM_MALI_DISPLAY
+   select FTRACE
+   help
+ Enable this option to log internal errors that happened during
+ processing of a frame. Errors will be reported in
+ /sys/kernel/debug/tracing/trace.
diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
index 2bfb542..7d3b2e2 100644
--- a/drivers/gpu/drm/arm/malidp_hw.c
+++ b/drivers/gpu/drm/arm/malidp_hw.c
@@ -632,10 +632,16 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] 
= {
MALIDP500_DE_IRQ_VSYNC |
MALIDP500_DE_IRQ_GLOBAL,
.vsync_irq = MALIDP500_DE_IRQ_VSYNC,
+   .err_mask = MALIDP_DE_IRQ_UNDERRUN |
+   MALIDP500_DE_IRQ_AXI_ERR |
+   MALIDP500_DE_IRQ_SATURATION,
},
.se_irq_map = {
.irq_mask = MALIDP500_SE_IRQ_CONF_MODE,
.vsync_irq = 0,
+   .err_mask = MALIDP500_SE_IRQ_INIT_BUSY |
+   MALIDP500_SE_IRQ_AXI_ERROR |
+   MALIDP500_SE_IRQ_OVERRUN,
},
.dc_irq_map = {
.irq_mask = MALIDP500_DE_IRQ_CONF_VALID,
@@ -669,10 +675,15 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] 
= {
.irq_mask = MALIDP_DE_IRQ_UNDERRUN |
MALIDP550_DE_IRQ_VSYNC,
.vsync_irq = MALIDP550_DE_IRQ_VSYNC,
+   .err_mask = MALIDP_DE_IRQ_UNDERRUN |
+   MALIDP550_DE_IRQ_SATURATION |
+   MALIDP550_DE_IRQ_AXI_ERR,
},
.se_irq_map = {
-   .irq_mask = MALIDP550_SE_IRQ_EOW |
-   MALIDP550_SE_IRQ_AXI_ERR,
+   .irq_mask = MALIDP550_SE_IRQ_EOW,
+   .err_mask  = MALIDP550_SE_IRQ_AXI_ERR |
+MALIDP550_SE_IRQ_OVR |
+MALIDP550_SE_IRQ_IBSY,
},
.dc_irq_map = {
.irq_mask = MALIDP550_DC_IRQ_CONF_VALID,
@@ -707,10 +718,20 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] 
= {
MALIDP650_DE_IRQ_DRIFT |
MALIDP550_DE_IRQ_VSYNC,
.vsync_irq = MALIDP550_DE_IRQ_VSYNC,
+   .err_mask = MALIDP_DE_IRQ_UNDERRUN |
+   MALIDP650_DE_IRQ_DRIFT |
+   MALIDP550_DE_IRQ_SATURATION |
+   

Re: [PATCH] drm: mali-dp: Log internal errors

2018-02-22 Thread Liviu Dudau
Hi Alex,

Thanks for the patch, it is quite useful. I have some small changes to
suggest:

On Thu, Feb 22, 2018 at 04:02:37PM +, Alexandru Gheorghe wrote:
> From: Alexandru Gheorghe 
> 
> Status register contains a lot of bits for reporting internal errors
> inside mali-dp. Currently, we just silently ignore all of the erorrs,

mali-dp is the driver, I think you are actually talking about Mali DP
hardware here, so worth making it "inside Mali DP."

> that doesn't help when we are investigating different bugs, especially
> on the FPGA models which have a lot of constrains, so we could easily
> end up in AXI or underrun errors.
> 
> Add a new KConfig option called CONFIG_DRM_MALI_DISPLAY_DEBUG, which
> enables the logging of the errors present in the status register.
> 
> Errors will be reported in  /sys/kernel/debug/tracing/trace,
> still not noisy enough, but better than silently ignoring them.
> 
> E.g:
> -0 [000] d.h1  2387.240042: malidp_de_irq: error occurred at vblank 
> 596 DE_STATUS is 0x0001
> -0 [000] d.h1  2387.256703: malidp_de_irq: error occurred at vblank 
> 597 DE_STATUS is 0x0001
> -0 [000] d.h1  2387.273458: malidp_de_irq: error occurred at vblank 
> 598 DE_STATUS is 0x0001
> -0 [000] d.h1  2387.290035: malidp_de_irq: error occurred at vblank 
> 599 DE_STATUS is 0x0001
> 
> In addition to that, I removed the setting of MALIDP550_SE_IRQ_AXI_ERR
> bit in the irq_mask, since that bit doesn't exist.
> 
> Signed-off-by: Alexandru Gheorghe 
> ---
>  drivers/gpu/drm/arm/Kconfig   | 10 +
>  drivers/gpu/drm/arm/malidp_hw.c   | 45 
> ---
>  drivers/gpu/drm/arm/malidp_hw.h   |  1 +
>  drivers/gpu/drm/arm/malidp_regs.h |  6 ++
>  4 files changed, 54 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/Kconfig b/drivers/gpu/drm/arm/Kconfig
> index 9a18e1b..c1e6fc8 100644
> --- a/drivers/gpu/drm/arm/Kconfig
> +++ b/drivers/gpu/drm/arm/Kconfig
> @@ -40,3 +40,13 @@ config DRM_MALI_DISPLAY
> of the hardware.
>  
> If compiled as a module it will be called mali-dp.
> +
> +config DRM_MALI_DISPLAY_DEBUG
> + bool "Enable mali display debugging"

s/mali display/Mali DP/

> + default n
> + depends on DRM_MALI_DISPLAY
> + select FTRACE
> + help
> +   Enable this option to log internal errors that happened during
> +   processing of a frame. Errors will be reported in
> +   /sys/kernel/debug/tracing/trace.
> diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
> index 2bfb542..7d3b2e2 100644
> --- a/drivers/gpu/drm/arm/malidp_hw.c
> +++ b/drivers/gpu/drm/arm/malidp_hw.c
> @@ -632,10 +632,16 @@ const struct malidp_hw 
> malidp_device[MALIDP_MAX_DEVICES] = {
>   MALIDP500_DE_IRQ_VSYNC |
>   MALIDP500_DE_IRQ_GLOBAL,
>   .vsync_irq = MALIDP500_DE_IRQ_VSYNC,
> + .err_mask = MALIDP_DE_IRQ_UNDERRUN |
> + MALIDP500_DE_IRQ_AXI_ERR |
> + MALIDP500_DE_IRQ_SATURATION,
>   },
>   .se_irq_map = {
>   .irq_mask = MALIDP500_SE_IRQ_CONF_MODE,
>   .vsync_irq = 0,
> + .err_mask = MALIDP500_SE_IRQ_INIT_BUSY |
> + MALIDP500_SE_IRQ_AXI_ERROR |
> + MALIDP500_SE_IRQ_OVERRUN,
>   },
>   .dc_irq_map = {
>   .irq_mask = MALIDP500_DE_IRQ_CONF_VALID,
> @@ -669,10 +675,15 @@ const struct malidp_hw 
> malidp_device[MALIDP_MAX_DEVICES] = {
>   .irq_mask = MALIDP_DE_IRQ_UNDERRUN |
>   MALIDP550_DE_IRQ_VSYNC,
>   .vsync_irq = MALIDP550_DE_IRQ_VSYNC,
> + .err_mask = MALIDP_DE_IRQ_UNDERRUN |
> + MALIDP550_DE_IRQ_SATURATION |
> + MALIDP550_DE_IRQ_AXI_ERR,
>   },
>   .se_irq_map = {
> - .irq_mask = MALIDP550_SE_IRQ_EOW |
> - MALIDP550_SE_IRQ_AXI_ERR,
> + .irq_mask = MALIDP550_SE_IRQ_EOW,
> + .err_mask  = MALIDP550_SE_IRQ_AXI_ERR |
> +  MALIDP550_SE_IRQ_OVR |
> +  MALIDP550_SE_IRQ_IBSY,
>   },
>   .dc_irq_map = {
>   .irq_mask = MALIDP550_DC_IRQ_CONF_VALID,
> @@ -707,10 +718,20 @@ const struct malidp_hw 
> malidp_device[MALIDP_MAX_DEVICES] = {
>   MALIDP65

[PATCH] drm: mali-dp: Log internal errors

2018-02-22 Thread Alexandru Gheorghe
From: Alexandru Gheorghe 

Status register contains a lot of bits for reporting internal errors
inside mali-dp. Currently, we just silently ignore all of the erorrs,
that doesn't help when we are investigating different bugs, especially
on the FPGA models which have a lot of constrains, so we could easily
end up in AXI or underrun errors.

Add a new KConfig option called CONFIG_DRM_MALI_DISPLAY_DEBUG, which
enables the logging of the errors present in the status register.

Errors will be reported in  /sys/kernel/debug/tracing/trace,
still not noisy enough, but better than silently ignoring them.

E.g:
-0 [000] d.h1  2387.240042: malidp_de_irq: error occurred at vblank 
596 DE_STATUS is 0x0001
-0 [000] d.h1  2387.256703: malidp_de_irq: error occurred at vblank 
597 DE_STATUS is 0x0001
-0 [000] d.h1  2387.273458: malidp_de_irq: error occurred at vblank 
598 DE_STATUS is 0x0001
-0 [000] d.h1  2387.290035: malidp_de_irq: error occurred at vblank 
599 DE_STATUS is 0x0001

In addition to that, I removed the setting of MALIDP550_SE_IRQ_AXI_ERR
bit in the irq_mask, since that bit doesn't exist.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/arm/Kconfig   | 10 +
 drivers/gpu/drm/arm/malidp_hw.c   | 45 ---
 drivers/gpu/drm/arm/malidp_hw.h   |  1 +
 drivers/gpu/drm/arm/malidp_regs.h |  6 ++
 4 files changed, 54 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/arm/Kconfig b/drivers/gpu/drm/arm/Kconfig
index 9a18e1b..c1e6fc8 100644
--- a/drivers/gpu/drm/arm/Kconfig
+++ b/drivers/gpu/drm/arm/Kconfig
@@ -40,3 +40,13 @@ config DRM_MALI_DISPLAY
  of the hardware.
 
  If compiled as a module it will be called mali-dp.
+
+config DRM_MALI_DISPLAY_DEBUG
+   bool "Enable mali display debugging"
+   default n
+   depends on DRM_MALI_DISPLAY
+   select FTRACE
+   help
+ Enable this option to log internal errors that happened during
+ processing of a frame. Errors will be reported in
+ /sys/kernel/debug/tracing/trace.
diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
index 2bfb542..7d3b2e2 100644
--- a/drivers/gpu/drm/arm/malidp_hw.c
+++ b/drivers/gpu/drm/arm/malidp_hw.c
@@ -632,10 +632,16 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] 
= {
MALIDP500_DE_IRQ_VSYNC |
MALIDP500_DE_IRQ_GLOBAL,
.vsync_irq = MALIDP500_DE_IRQ_VSYNC,
+   .err_mask = MALIDP_DE_IRQ_UNDERRUN |
+   MALIDP500_DE_IRQ_AXI_ERR |
+   MALIDP500_DE_IRQ_SATURATION,
},
.se_irq_map = {
.irq_mask = MALIDP500_SE_IRQ_CONF_MODE,
.vsync_irq = 0,
+   .err_mask = MALIDP500_SE_IRQ_INIT_BUSY |
+   MALIDP500_SE_IRQ_AXI_ERROR |
+   MALIDP500_SE_IRQ_OVERRUN,
},
.dc_irq_map = {
.irq_mask = MALIDP500_DE_IRQ_CONF_VALID,
@@ -669,10 +675,15 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] 
= {
.irq_mask = MALIDP_DE_IRQ_UNDERRUN |
MALIDP550_DE_IRQ_VSYNC,
.vsync_irq = MALIDP550_DE_IRQ_VSYNC,
+   .err_mask = MALIDP_DE_IRQ_UNDERRUN |
+   MALIDP550_DE_IRQ_SATURATION |
+   MALIDP550_DE_IRQ_AXI_ERR,
},
.se_irq_map = {
-   .irq_mask = MALIDP550_SE_IRQ_EOW |
-   MALIDP550_SE_IRQ_AXI_ERR,
+   .irq_mask = MALIDP550_SE_IRQ_EOW,
+   .err_mask  = MALIDP550_SE_IRQ_AXI_ERR |
+MALIDP550_SE_IRQ_OVR |
+MALIDP550_SE_IRQ_IBSY,
},
.dc_irq_map = {
.irq_mask = MALIDP550_DC_IRQ_CONF_VALID,
@@ -707,10 +718,20 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] 
= {
MALIDP650_DE_IRQ_DRIFT |
MALIDP550_DE_IRQ_VSYNC,
.vsync_irq = MALIDP550_DE_IRQ_VSYNC,
+   .err_mask = MALIDP_DE_IRQ_UNDERRUN |
+   MALIDP650_DE_IRQ_DRIFT |
+   MALIDP550_DE_IRQ_SATURATION |
+   MALIDP55