Hi everyone,
This is a smallish series that tries to remove some build-time
configurability in komeda and replace it with a debugfs control. Later
patches in the series add some extra functionality which I found useful
during my debugging sessions, so I figured I'd bake it in.
I've preserved the default behaviour as if CONFIG_KOMEDA_ERROR_PRINT
were enabled, so production kernels can have some feedback from the
driver when things are going south.
1: Introduce the err_verbosity debugfs node for komeda; this keeps the
default of printing error events once per frame.
2: Drop CONFIG_KOMEDA_ERROR_PRINT since output can be disabled at
runtime
3: Add a drm state dump on event. It's quite chatty so I left it only
for error events; printing all that once per frame every vsync floods my
serial terminal, so no info + state combination.
4: Add lower-severity categories to the event printer
5: Normally these events fire only once per pageflip, but sometimes it's
useful to see them all as they come in.
These patches are overall quite tiny, and I was considering just
squashing them into one, but I opted to keep them separate for an easier
review experience; please let me know whether you prefer a single patch.
Thanks!
Mihail Atanassov (5):
drm/komeda: Add debugfs node to control error verbosity
drm/komeda: Remove CONFIG_KOMEDA_ERROR_PRINT
drm/komeda: Optionally dump DRM state on interrupts
drm/komeda: Add option to print WARN- and INFO-level IRQ events
drm/komeda: add rate limiting disable to err_verbosity
drivers/gpu/drm/arm/display/Kconfig | 6 ----
drivers/gpu/drm/arm/display/komeda/Makefile | 5 ++--
.../gpu/drm/arm/display/komeda/komeda_dev.c | 4 +++
.../gpu/drm/arm/display/komeda/komeda_dev.h | 30 +++++++++++++++----
.../gpu/drm/arm/display/komeda/komeda_event.c | 24 ++++++++++++---
.../gpu/drm/arm/display/komeda/komeda_kms.c | 2 +-
6 files changed, 52 insertions(+), 19 deletions(-)
--
2.23.0
Named 'err_verbosity', currently with only 1 active bit in that
replicates the existing level - print error events once per flip.
Signed-off-by: Mihail Atanassov <[email protected]>
---
drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 4 ++++
drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 14 ++++++++++++--
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 9 +++++++--
drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 2 +-
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index 937a6d4c4865..82230c0ddec3 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -58,6 +58,8 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)
mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
debugfs_create_file("register", 0444, mdev->debugfs_root,
mdev, &komeda_register_fops);
+ debugfs_create_x16("err_verbosity", 0664, mdev->debugfs_root,
+ &mdev->err_verbosity);
}
#endif
@@ -280,6 +282,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
goto err_cleanup;
}
+ mdev->err_verbosity = KOMEDA_DEV_PRINT_ERR_EVENTS;
+
#ifdef CONFIG_DEBUG_FS
komeda_debugfs_init(mdev);
#endif
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index 414200233b64..b5bd3d5898ee 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -202,6 +202,14 @@ struct komeda_dev {
/** @debugfs_root: root directory of komeda debugfs */
struct dentry *debugfs_root;
+ /**
+ * @err_verbosity: bitmask for how much extra info to print on error
+ *
+ * See KOMEDA_DEV_* macros for details.
+ */
+ u16 err_verbosity;
+ /* Print a single line per error per frame with error events. */
+#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
};
static inline bool
@@ -219,9 +227,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev);
struct komeda_dev *dev_to_mdev(struct device *dev);
#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
-void komeda_print_events(struct komeda_events *evts);
+void komeda_print_events(struct komeda_events *evts, struct drm_device *dev);
#else
-static inline void komeda_print_events(struct komeda_events *evts) {}
+static inline void komeda_print_events(struct komeda_events *evts,
+ struct drm_device *dev)
+{}
#endif
int komeda_dev_resume(struct komeda_dev *mdev);
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index a36fb86cc054..575ed4df74ed 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -107,10 +107,12 @@ static bool is_new_frame(struct komeda_events *a)
(KOMEDA_EVENT_FLIP | KOMEDA_EVENT_EOW);
}
-void komeda_print_events(struct komeda_events *evts)
+void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
{
- u64 print_evts = KOMEDA_ERR_EVENTS;
+ u64 print_evts = 0;
static bool en_print = true;
+ struct komeda_dev *mdev = dev->dev_private;
+ u16 const err_verbosity = mdev->err_verbosity;
/* reduce the same msg print, only print the first evt for one frame */
if (evts->global || is_new_frame(evts))
@@ -118,6 +120,9 @@ void komeda_print_events(struct komeda_events *evts)
if (!en_print)
return;
+ if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
+ print_evts |= KOMEDA_ERR_EVENTS;
+
if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) {
char msg[256];
struct komeda_str str;
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
index d49772de93e0..e30a5b43caa9 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
@@ -48,7 +48,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
memset(&evts, 0, sizeof(evts));
status = mdev->funcs->irq_handler(mdev, &evts);
- komeda_print_events(&evts);
+ komeda_print_events(&evts, drm);
/* Notify the crtc to handle the events */
for (i = 0; i < kms->n_crtcs; i++)
--
2.23.0
Now that there's a debugfs node to control the same, remove the
config option.
Signed-off-by: Mihail Atanassov <[email protected]>
---
drivers/gpu/drm/arm/display/Kconfig | 6 ------
drivers/gpu/drm/arm/display/komeda/Makefile | 5 ++---
drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 6 ------
3 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/arm/display/Kconfig b/drivers/gpu/drm/arm/display/Kconfig
index e87ff8623076..cec0639e3aa1 100644
--- a/drivers/gpu/drm/arm/display/Kconfig
+++ b/drivers/gpu/drm/arm/display/Kconfig
@@ -12,9 +12,3 @@ config DRM_KOMEDA
Processor driver. It supports the D71 variants of the hardware.
If compiled as a module it will be called komeda.
-
-config DRM_KOMEDA_ERROR_PRINT
- bool "Enable komeda error print"
- depends on DRM_KOMEDA
- help
- Choose this option to enable error printing.
diff --git a/drivers/gpu/drm/arm/display/komeda/Makefile b/drivers/gpu/drm/arm/display/komeda/Makefile
index f095a1c68ac7..1931a7fa1a14 100644
--- a/drivers/gpu/drm/arm/display/komeda/Makefile
+++ b/drivers/gpu/drm/arm/display/komeda/Makefile
@@ -16,12 +16,11 @@ komeda-y := \
komeda_crtc.o \
komeda_plane.o \
komeda_wb_connector.o \
- komeda_private_obj.o
+ komeda_private_obj.o \
+ komeda_event.o
komeda-y += \
d71/d71_dev.o \
d71/d71_component.o
-komeda-$(CONFIG_DRM_KOMEDA_ERROR_PRINT) += komeda_event.o
-
obj-$(CONFIG_DRM_KOMEDA) += komeda.o
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index b5bd3d5898ee..831c375180f8 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -226,13 +226,7 @@ void komeda_dev_destroy(struct komeda_dev *mdev);
struct komeda_dev *dev_to_mdev(struct device *dev);
-#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
void komeda_print_events(struct komeda_events *evts, struct drm_device *dev);
-#else
-static inline void komeda_print_events(struct komeda_events *evts,
- struct drm_device *dev)
-{}
-#endif
int komeda_dev_resume(struct komeda_dev *mdev);
int komeda_dev_suspend(struct komeda_dev *mdev);
--
2.23.0
Extra detail (normally off) almost never hurts.
Signed-off-by: Mihail Atanassov <[email protected]>
---
drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 11 +++++++++++
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index 4809000c1efb..d9fc9c48859a 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -51,6 +51,13 @@
#define KOMEDA_WARN_EVENTS KOMEDA_ERR_CSCE
+#define KOMEDA_INFO_EVENTS ({0 \
+ | KOMEDA_EVENT_VSYNC \
+ | KOMEDA_EVENT_FLIP \
+ | KOMEDA_EVENT_EOW \
+ | KOMEDA_EVENT_MODE \
+ })
+
/* malidp device id */
enum {
MALI_D71 = 0,
@@ -211,6 +218,10 @@ struct komeda_dev {
u16 err_verbosity;
/* Print a single line per error per frame with error events. */
#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
+ /* Print a single line per warning per frame with error events. */
+#define KOMEDA_DEV_PRINT_WARN_EVENTS BIT(1)
+ /* Print a single line per info event per frame with error events. */
+#define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
/* Dump DRM state on an error or warning event. */
#define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
};
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index 5da61e7d75d5..bf88463bb4d9 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -124,6 +124,10 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
print_evts |= KOMEDA_ERR_EVENTS;
+ if (err_verbosity & KOMEDA_DEV_PRINT_WARN_EVENTS)
+ print_evts |= KOMEDA_WARN_EVENTS;
+ if (err_verbosity & KOMEDA_DEV_PRINT_INFO_EVENTS)
+ print_evts |= KOMEDA_INFO_EVENTS;
if (evts_mask & print_evts) {
char msg[256];
--
2.23.0
It's potentially useful information when diagnosing error/warn IRQs, so
dump it to dmesg with a drm_info_printer. Hide this extra debug dumping
behind another komeda_dev->err_verbosity bit.
Note that there's not much sense in dumping it for INFO events,
since the VSYNC event will swamp the log.
Signed-off-by: Mihail Atanassov <[email protected]>
---
drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 5 ++++-
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 8 +++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index 831c375180f8..4809000c1efb 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -205,11 +205,14 @@ struct komeda_dev {
/**
* @err_verbosity: bitmask for how much extra info to print on error
*
- * See KOMEDA_DEV_* macros for details.
+ * See KOMEDA_DEV_* macros for details. Low byte contains the debug
+ * level categories, the high byte contains extra debug options.
*/
u16 err_verbosity;
/* Print a single line per error per frame with error events. */
#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
+ /* Dump DRM state on an error or warning event. */
+#define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
};
static inline bool
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index 575ed4df74ed..5da61e7d75d5 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -4,6 +4,7 @@
* Author: James.Qian.Wang <[email protected]>
*
*/
+#include <drm/drm_atomic.h>
#include <drm/drm_print.h>
#include "komeda_dev.h"
@@ -113,6 +114,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
static bool en_print = true;
struct komeda_dev *mdev = dev->dev_private;
u16 const err_verbosity = mdev->err_verbosity;
+ u64 evts_mask = evts->global | evts->pipes[0] | evts->pipes[1];
/* reduce the same msg print, only print the first evt for one frame */
if (evts->global || is_new_frame(evts))
@@ -123,9 +125,10 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
print_evts |= KOMEDA_ERR_EVENTS;
- if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) {
+ if (evts_mask & print_evts) {
char msg[256];
struct komeda_str str;
+ struct drm_printer p = drm_info_printer(dev->dev);
str.str = msg;
str.sz = sizeof(msg);
@@ -139,6 +142,9 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
evt_str(&str, evts->pipes[1]);
DRM_ERROR("err detect: %s\n", msg);
+ if ((err_verbosity & KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT)
+ && (evts_mask & (KOMEDA_ERR_EVENTS | KOMEDA_WARN_EVENTS)))
+ drm_state_dump(dev, &p);
en_print = false;
}
--
2.23.0
It's possible to get multiple events in a single frame/flip, so add an
option to print them all.
Signed-off-by: Mihail Atanassov <[email protected]>
---
drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 2 ++
drivers/gpu/drm/arm/display/komeda/komeda_event.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index d9fc9c48859a..15f52e304c08 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -224,6 +224,8 @@ struct komeda_dev {
#define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
/* Dump DRM state on an error or warning event. */
#define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
+ /* Disable rate limiting of event prints (normally one per commit) */
+#define KOMEDA_DEV_PRINT_DISABLE_RATELIMIT BIT(12)
};
static inline bool
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index bf88463bb4d9..86e33fed8a91 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -119,7 +119,8 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
/* reduce the same msg print, only print the first evt for one frame */
if (evts->global || is_new_frame(evts))
en_print = true;
- if (!en_print)
+ if (!(err_verbosity & KOMEDA_DEV_PRINT_DISABLE_RATELIMIT)
+ && !en_print)
return;
if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
--
2.23.0
On Mon, Oct 21, 2019 at 04:47:14PM +0000, Mihail Atanassov wrote:
> Named 'err_verbosity', currently with only 1 active bit in that
> replicates the existing level - print error events once per flip.
>
> Signed-off-by: Mihail Atanassov <[email protected]>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 4 ++++
> drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 14 ++++++++++++--
> drivers/gpu/drm/arm/display/komeda/komeda_event.c | 9 +++++++--
> drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 2 +-
> 4 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> index 937a6d4c4865..82230c0ddec3 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> @@ -58,6 +58,8 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)
> mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
> debugfs_create_file("register", 0444, mdev->debugfs_root,
> mdev, &komeda_register_fops);
> + debugfs_create_x16("err_verbosity", 0664, mdev->debugfs_root,
> + &mdev->err_verbosity);
> }
> #endif
>
> @@ -280,6 +282,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
> goto err_cleanup;
> }
>
> + mdev->err_verbosity = KOMEDA_DEV_PRINT_ERR_EVENTS;
> +
> #ifdef CONFIG_DEBUG_FS
> komeda_debugfs_init(mdev);
> #endif
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index 414200233b64..b5bd3d5898ee 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -202,6 +202,14 @@ struct komeda_dev {
>
> /** @debugfs_root: root directory of komeda debugfs */
> struct dentry *debugfs_root;
> + /**
> + * @err_verbosity: bitmask for how much extra info to print on error
> + *
> + * See KOMEDA_DEV_* macros for details.
> + */
> + u16 err_verbosity;
> + /* Print a single line per error per frame with error events. */
> +#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
> };
>
> static inline bool
> @@ -219,9 +227,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev);
> struct komeda_dev *dev_to_mdev(struct device *dev);
>
> #ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
> -void komeda_print_events(struct komeda_events *evts);
> +void komeda_print_events(struct komeda_events *evts, struct drm_device *dev);
> #else
> -static inline void komeda_print_events(struct komeda_events *evts) {}
> +static inline void komeda_print_events(struct komeda_events *evts,
> + struct drm_device *dev)
> +{}
> #endif
>
> int komeda_dev_resume(struct komeda_dev *mdev);
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> index a36fb86cc054..575ed4df74ed 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -107,10 +107,12 @@ static bool is_new_frame(struct komeda_events *a)
> (KOMEDA_EVENT_FLIP | KOMEDA_EVENT_EOW);
> }
>
> -void komeda_print_events(struct komeda_events *evts)
> +void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> {
> - u64 print_evts = KOMEDA_ERR_EVENTS;
> + u64 print_evts = 0;
> static bool en_print = true;
> + struct komeda_dev *mdev = dev->dev_private;
> + u16 const err_verbosity = mdev->err_verbosity;
>
> /* reduce the same msg print, only print the first evt for one frame */
> if (evts->global || is_new_frame(evts))
> @@ -118,6 +120,9 @@ void komeda_print_events(struct komeda_events *evts)
> if (!en_print)
> return;
>
> + if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> + print_evts |= KOMEDA_ERR_EVENTS;
> +
> if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) {
> char msg[256];
> struct komeda_str str;
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> index d49772de93e0..e30a5b43caa9 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> @@ -48,7 +48,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
> memset(&evts, 0, sizeof(evts));
> status = mdev->funcs->irq_handler(mdev, &evts);
>
> - komeda_print_events(&evts);
> + komeda_print_events(&evts, drm);
>
> /* Notify the crtc to handle the events */
> for (i = 0; i < kms->n_crtcs; i++)
thank you for the patch, looks good to me.
BTW: for you question:
| These patches are overall quite tiny, and I was considering just
| squashing them into one, but I opted to keep them separate for an easier
| review experience; please let me know whether you prefer a single patch.
I like the current single patch. :)
Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
On Mon, Oct 21, 2019 at 04:47:24PM +0000, Mihail Atanassov wrote:
> It's potentially useful information when diagnosing error/warn IRQs, so
> dump it to dmesg with a drm_info_printer. Hide this extra debug dumping
> behind another komeda_dev->err_verbosity bit.
>
> Note that there's not much sense in dumping it for INFO events,
> since the VSYNC event will swamp the log.
>
> Signed-off-by: Mihail Atanassov <[email protected]>
Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 5 ++++-
> drivers/gpu/drm/arm/display/komeda/komeda_event.c | 8 +++++++-
> 2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index 831c375180f8..4809000c1efb 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -205,11 +205,14 @@ struct komeda_dev {
> /**
> * @err_verbosity: bitmask for how much extra info to print on error
> *
> - * See KOMEDA_DEV_* macros for details.
> + * See KOMEDA_DEV_* macros for details. Low byte contains the debug
> + * level categories, the high byte contains extra debug options.
> */
> u16 err_verbosity;
> /* Print a single line per error per frame with error events. */
> #define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
> + /* Dump DRM state on an error or warning event. */
> +#define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
> };
>
> static inline bool
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> index 575ed4df74ed..5da61e7d75d5 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -4,6 +4,7 @@
> * Author: James.Qian.Wang <[email protected]>
> *
> */
> +#include <drm/drm_atomic.h>
> #include <drm/drm_print.h>
>
> #include "komeda_dev.h"
> @@ -113,6 +114,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> static bool en_print = true;
> struct komeda_dev *mdev = dev->dev_private;
> u16 const err_verbosity = mdev->err_verbosity;
> + u64 evts_mask = evts->global | evts->pipes[0] | evts->pipes[1];
>
> /* reduce the same msg print, only print the first evt for one frame */
> if (evts->global || is_new_frame(evts))
> @@ -123,9 +125,10 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> print_evts |= KOMEDA_ERR_EVENTS;
>
> - if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) {
> + if (evts_mask & print_evts) {
> char msg[256];
> struct komeda_str str;
> + struct drm_printer p = drm_info_printer(dev->dev);
>
> str.str = msg;
> str.sz = sizeof(msg);
> @@ -139,6 +142,9 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> evt_str(&str, evts->pipes[1]);
>
> DRM_ERROR("err detect: %s\n", msg);
> + if ((err_verbosity & KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT)
> + && (evts_mask & (KOMEDA_ERR_EVENTS | KOMEDA_WARN_EVENTS)))
> + drm_state_dump(dev, &p);
>
> en_print = false;
> }
On Mon, Oct 21, 2019 at 04:47:29PM +0000, Mihail Atanassov wrote:
> Extra detail (normally off) almost never hurts.
>
> Signed-off-by: Mihail Atanassov <[email protected]>
Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 11 +++++++++++
> drivers/gpu/drm/arm/display/komeda/komeda_event.c | 4 ++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index 4809000c1efb..d9fc9c48859a 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -51,6 +51,13 @@
>
> #define KOMEDA_WARN_EVENTS KOMEDA_ERR_CSCE
>
> +#define KOMEDA_INFO_EVENTS ({0 \
> + | KOMEDA_EVENT_VSYNC \
> + | KOMEDA_EVENT_FLIP \
> + | KOMEDA_EVENT_EOW \
> + | KOMEDA_EVENT_MODE \
> + })
> +
> /* malidp device id */
> enum {
> MALI_D71 = 0,
> @@ -211,6 +218,10 @@ struct komeda_dev {
> u16 err_verbosity;
> /* Print a single line per error per frame with error events. */
> #define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
> + /* Print a single line per warning per frame with error events. */
> +#define KOMEDA_DEV_PRINT_WARN_EVENTS BIT(1)
> + /* Print a single line per info event per frame with error events. */
> +#define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
> /* Dump DRM state on an error or warning event. */
> #define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
> };
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> index 5da61e7d75d5..bf88463bb4d9 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -124,6 +124,10 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
>
> if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
> print_evts |= KOMEDA_ERR_EVENTS;
> + if (err_verbosity & KOMEDA_DEV_PRINT_WARN_EVENTS)
> + print_evts |= KOMEDA_WARN_EVENTS;
> + if (err_verbosity & KOMEDA_DEV_PRINT_INFO_EVENTS)
> + print_evts |= KOMEDA_INFO_EVENTS;
>
> if (evts_mask & print_evts) {
> char msg[256];
On Mon, Oct 21, 2019 at 04:47:35PM +0000, Mihail Atanassov wrote:
> It's possible to get multiple events in a single frame/flip, so add an
> option to print them all.
>
> Signed-off-by: Mihail Atanassov <[email protected]>
Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 2 ++
> drivers/gpu/drm/arm/display/komeda/komeda_event.c | 3 ++-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index d9fc9c48859a..15f52e304c08 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -224,6 +224,8 @@ struct komeda_dev {
> #define KOMEDA_DEV_PRINT_INFO_EVENTS BIT(2)
> /* Dump DRM state on an error or warning event. */
> #define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8)
> + /* Disable rate limiting of event prints (normally one per commit) */
> +#define KOMEDA_DEV_PRINT_DISABLE_RATELIMIT BIT(12)
> };
>
> static inline bool
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> index bf88463bb4d9..86e33fed8a91 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -119,7 +119,8 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
> /* reduce the same msg print, only print the first evt for one frame */
> if (evts->global || is_new_frame(evts))
> en_print = true;
> - if (!en_print)
> + if (!(err_verbosity & KOMEDA_DEV_PRINT_DISABLE_RATELIMIT)
> + && !en_print)
> return;
>
> if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS)
On Mon, Oct 21, 2019 at 04:47:19PM +0000, Mihail Atanassov wrote:
> Now that there's a debugfs node to control the same, remove the
> config option.
>
> Signed-off-by: Mihail Atanassov <[email protected]>
> ---
> drivers/gpu/drm/arm/display/Kconfig | 6 ------
> drivers/gpu/drm/arm/display/komeda/Makefile | 5 ++---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 6 ------
> 3 files changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/display/Kconfig b/drivers/gpu/drm/arm/display/Kconfig
> index e87ff8623076..cec0639e3aa1 100644
> --- a/drivers/gpu/drm/arm/display/Kconfig
> +++ b/drivers/gpu/drm/arm/display/Kconfig
> @@ -12,9 +12,3 @@ config DRM_KOMEDA
> Processor driver. It supports the D71 variants of the hardware.
>
> If compiled as a module it will be called komeda.
> -
> -config DRM_KOMEDA_ERROR_PRINT
> - bool "Enable komeda error print"
> - depends on DRM_KOMEDA
> - help
> - Choose this option to enable error printing.
> diff --git a/drivers/gpu/drm/arm/display/komeda/Makefile b/drivers/gpu/drm/arm/display/komeda/Makefile
> index f095a1c68ac7..1931a7fa1a14 100644
> --- a/drivers/gpu/drm/arm/display/komeda/Makefile
> +++ b/drivers/gpu/drm/arm/display/komeda/Makefile
> @@ -16,12 +16,11 @@ komeda-y := \
> komeda_crtc.o \
> komeda_plane.o \
> komeda_wb_connector.o \
> - komeda_private_obj.o
> + komeda_private_obj.o \
> + komeda_event.o
>
> komeda-y += \
> d71/d71_dev.o \
> d71/d71_component.o
>
> -komeda-$(CONFIG_DRM_KOMEDA_ERROR_PRINT) += komeda_event.o
> -
> obj-$(CONFIG_DRM_KOMEDA) += komeda.o
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index b5bd3d5898ee..831c375180f8 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -226,13 +226,7 @@ void komeda_dev_destroy(struct komeda_dev *mdev);
>
> struct komeda_dev *dev_to_mdev(struct device *dev);
>
> -#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
> void komeda_print_events(struct komeda_events *evts, struct drm_device *dev);
> -#else
> -static inline void komeda_print_events(struct komeda_events *evts,
> - struct drm_device *dev)
> -{}
> -#endif
>
Reviewed-by: James Qian Wang (Arm Technology China) <[email protected]>
> int komeda_dev_resume(struct komeda_dev *mdev);
> int komeda_dev_suspend(struct komeda_dev *mdev);