Add devcoredump support for DPU
Subsystems (4)
v2 cover Add devcoredump support for DPU
This series adds support to use devcoredump for DPU driver. It introduces the dpu_dbg module which assists in the capturing of register dumps during error scenarios. When a display related error happens, the dpu_dbg module captures all the relevant register dumps along with the snapshot of the drm atomic state and triggers a devcoredump.
changes in v2:
- Fix kbot errors
- Rename drm_atomic_print_state function and add kernel doc for it
- Fix multiple dsi registration issue with dpu_dbg
Abhinav Kumar (4):
drm: allow drm_atomic_print_state() to accept any drm_printer drm/msm/dpu: add support to dump dpu registers drm/msm: register the base address with dpu_dbg module drm/msm/dpu: add dpu_dbg points across dpu driver
drivers/gpu/drm/drm_atomic.c | 29 +- drivers/gpu/drm/drm_atomic_uapi.c | 4 +- drivers/gpu/drm/drm_crtc_internal.h | 4 +- drivers/gpu/drm/msm/Makefile | 2 + drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c | 316 ++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.h | 273 +++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_dbg_util.c | 314 +++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 +- .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 5 +- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 5 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 6 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c | 7 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 5 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 6 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 7 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 +- drivers/gpu/drm/msm/dp/dp_catalog.c | 12 + drivers/gpu/drm/msm/dp/dp_catalog.h | 4 + drivers/gpu/drm/msm/dp/dp_display.c | 2 + drivers/gpu/drm/msm/dsi/dsi.c | 1 + drivers/gpu/drm/msm/dsi/dsi.h | 1 + drivers/gpu/drm/msm/dsi/dsi_host.c | 15 +- drivers/gpu/drm/msm/msm_drv.c | 30 +- drivers/gpu/drm/msm/msm_drv.h | 3 +- .../gpu/drm/selftests/test-drm_framebuffer.c | 1 + 28 files changed, 1066 insertions(+), 26 deletions(-) create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.h create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_dbg_util.c
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/4 drm: allow drm_atomic_print_state() to accept any drm_printer
Currently drm_atomic_print_state() internally allocates and uses a drm_info printer. Allow it to accept any drm_printer type so that the API can be leveraged even for taking drm snapshot.
Rename the drm_atomic_print_state() to drm_atomic_print_new_state() so that it reflects its functionality better.
changes in v2:
- Rename the function drm_atomic_print_state to drm_atomic_print_new_state and update the commit text
- Fix kbot errors
- Add kernel doc for the newly exported function
--- drivers/gpu/drm/drm_atomic.c | 29 +++++++++++++++---- drivers/gpu/drm/drm_atomic_uapi.c | 4 ++- drivers/gpu/drm/drm_crtc_internal.h | 4 ++- .../gpu/drm/selftests/test-drm_framebuffer.c | 1 + 4 files changed, 31 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_atomic.c +24 -5
@@ -1,6 +1,7 @@/* * Copyright (C) 2014 Red Hat * Copyright (C) 2014 Intel Corp. +* Copyright (c) 2020, The Linux Foundation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"),
@@ -1543,9 +1544,21 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, }EXPORT_SYMBOL (__drm_atomic_helper_set_config); -void drm_atomic_print_state (const struct drm_atomic_state *state) +/** +* drm_atomic_print_new_state - prints drm atomic state +* @state: atomic configuration to check +* @p: drm printer +* +* This functions prints the drm atomic state snapshot using the drm printer +* which is passed to it. This snapshot can be used for debugging purposes. +* +* Note that this function looks into the new state objects and hence its not +* safe to be used after the call to drm_atomic_helper_commit_hw_done(). +* +*/ +void drm_atomic_print_new_state (const struct drm_atomic_state *state, +struct drm_printer *p) { -struct drm_printer p =drm_info_printer (state->dev->dev);struct drm_plane *plane;struct drm_plane_state *plane_state;struct drm_crtc *crtc;
@@ -1554,17 +1567,23 @@ void drm_atomic_print_state(const struct drm_atomic_state *state)struct drm_connector_state *connector_state;int i; +if (!p) { +DRM_ERROR ("invalid drm printer\n" ); +return ; + } +DRM_DEBUG_ATOMIC ("checking %p\n" , state);for_each_new_plane_in_state (state, plane, plane_state, i) -drm_atomic_plane_print_state (&p, plane_state); +drm_atomic_plane_print_state (p, plane_state);for_each_new_crtc_in_state (state, crtc, crtc_state, i) -drm_atomic_crtc_print_state (&p, crtc_state); +drm_atomic_crtc_print_state (p, crtc_state);for_each_new_connector_in_state (state, connector, connector_state, i) -drm_atomic_connector_print_state (&p, connector_state); +drm_atomic_connector_print_state (p, connector_state); } +EXPORT_SYMBOL (drm_atomic_print_new_state);static void __drm_state_dump (struct drm_device *dev,struct drm_printer *p,bool take_locks)
drivers/gpu/drm/drm_atomic_uapi.c +3 -1
@@ -2,6 +2,7 @@* Copyright (C) 2014 Red Hat * Copyright (C) 2014 Intel Corp. * Copyright (C) 2018 Intel Corp. +* Copyright (c) 2020, The Linux Foundation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"),
@@ -1294,6 +1295,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,struct drm_out_fence_state *fence_state;int ret =0 ;unsigned int i, j, num_fences; +struct drm_printer p =drm_info_printer (dev->dev);/* disallow for drivers not supporting atomic: */ if (!drm_core_check_feature (dev,DRIVER_ATOMIC ))
@@ -1413,7 +1415,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, ret =drm_atomic_nonblocking_commit (state); }else {if (drm_debug_enabled (DRM_UT_STATE )) -drm_atomic_print_state (state); +drm_atomic_print_new_state (state, &p); ret =drm_atomic_commit (state); }
drivers/gpu/drm/drm_crtc_internal.h +3 -1
@@ -5,6 +5,7 @@* Jesse Barnes <[email protected]> * Copyright © 2014 Intel Corporation * Daniel Vetter <[email protected]> +* Copyright (c) 2020, The Linux Foundation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"),
@@ -233,7 +234,8 @@ int __drm_atomic_helper_disable_plane(struct drm_plane *plane,int __drm_atomic_helper_set_config (struct drm_mode_set *set,struct drm_atomic_state *state); -void drm_atomic_print_state (const struct drm_atomic_state *state); +void drm_atomic_print_new_state (const struct drm_atomic_state *state, +struct drm_printer *p);/* drm_atomic_uapi.c */ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
drivers/gpu/drm/selftests/test-drm_framebuffer.c +1 -0
@@ -8,6 +8,7 @@#include <drm/drm_device.h> #include <drm/drm_mode.h> #include <drm/drm_fourcc.h> +#include <drm/drm_print.h> #include "../drm_crtc_internal.h"
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/4 drm/msm/dpu: add support to dump dpu registers
In reply to Abhinav KumarAdd the dpu_dbg module which adds supports to dump dpu registers which can be used in case of error conditions.
changes in v2: Fix kbot errors
--- drivers/gpu/drm/msm/Makefile | 2 + drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c | 316 ++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.h | 273 +++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_dbg_util.c | 314 +++++++++++++++++ .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 +- drivers/gpu/drm/msm/msm_drv.c | 6 +- 6 files changed, 913 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.h create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_dbg_util.c
drivers/gpu/drm/msm/Makefile +2 -0
@@ -54,6 +54,8 @@ msm-y := \ disp/dpu1/dpu_core_irq.o \ disp/dpu1/dpu_core_perf.o \ disp/dpu1/dpu_crtc.o \ + disp/dpu1/dpu_dbg.o \ + disp/dpu1/dpu_dbg_util.o \ disp/dpu1/dpu_encoder.o \ disp/dpu1/dpu_encoder_phys_cmd.o \ disp/dpu1/dpu_encoder_phys_vid.o \
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c new file +316 -0
316 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.h new file +273 -0
273 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg_util.c new file +314 -0
314 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +3 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: GPL-2.0-only */ -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. */ #ifndef _DPU_HW_CATALOG_H
@@ -52,6 +52,8 @@#define DPU_HW_BLK_NAME_LEN 16 +/* default size of valid register space for MDSS_HW block (offset 0) */ +#define DEFAULT_MDSS_HW_BLOCK_SIZE 0x5C#define MAX_IMG_WIDTH 0x3fff#define MAX_IMG_HEIGHT 0x3fff
drivers/gpu/drm/msm/msm_drv.c +5 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2016-2018, 2020 The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark <[email protected]> */
@@ -17,6 +17,7 @@#include <drm/drm_prime.h> #include <drm/drm_of.h> #include <drm/drm_vblank.h> +#include "dpu_dbg.h" #include "msm_drv.h" #include "msm_debugfs.h"
@@ -268,6 +269,8 @@ static int msm_drm_uninit(struct device *dev)msm_fbdev_free (ddev);#endif +dpu_dbg_destroy (); +drm_mode_config_cleanup (ddev);pm_runtime_get_sync (dev);
@@ -1303,6 +1306,7 @@ static int msm_pdev_probe(struct platform_device *pdev) fail:of_platform_depopulate (&pdev->dev); +dpu_dbg_destroy ();return ret; }
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/4 drm/msm: register the base address with dpu_dbg module
In reply to Abhinav KumarRegister the base address of various dpu sub-modules with the dpu_dbg module so that it can be dumped out during error scenarios.
changes in v2:
- Fix an issue where the same dsi client was getting registered multiple times to the dpu_dbg module
--- drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c | 4 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 6 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c | 7 +++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 5 +++- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 6 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 7 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 +++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++- drivers/gpu/drm/msm/dp/dp_catalog.c | 12 +++++++++ drivers/gpu/drm/msm/dp/dp_catalog.h | 4 +++ drivers/gpu/drm/msm/dp/dp_display.c | 2 ++ drivers/gpu/drm/msm/dsi/dsi.c | 1 + drivers/gpu/drm/msm/dsi/dsi.h | 1 + drivers/gpu/drm/msm/dsi/dsi_host.c | 15 ++++++++++- drivers/gpu/drm/msm/msm_drv.c | 26 ++++++++++++++++++- drivers/gpu/drm/msm/msm_drv.h | 3 ++- 17 files changed, 108 insertions(+), 15 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c +2 -2
@@ -263,7 +263,7 @@ int dpu_dbg_reg_register_base(const char *name, void __iomem *base,/* Initialize list to make sure check for null list will be valid */ INIT_LIST_HEAD (®_base->sub_range_list); -pr_debug ("%s base: %pK max_offset 0x%zX\n" , reg_base->name, +pr_info ("%s base: %pK max_offset 0x%zX\n" , reg_base->name, reg_base->base, reg_base->max_offset);list_add (®_base->reg_base_head, &dbg_base->reg_base_list);
@@ -310,7 +310,7 @@ void dpu_dbg_reg_register_dump_range(const char *base_name, range->xin_id = xin_id;list_add_tail (&range->head, ®_base->sub_range_list); -pr_debug ("base %s, range %s, start 0x%X, end 0x%X\n" , +pr_info ("base_name %s, range_name %s, start 0x%X, end 0x%X\n" , base_name, range->range_name, range->offset.start, range->offset.end); }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +5 -1
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. */ #include <linux/delay.h>
@@ -7,6 +7,7 @@#include "dpu_hw_ctl.h" #include "dpu_kms.h" #include "dpu_trace.h" +#include "dpu_dbg.h" #define CTL_LAYER (lm) \ (((lm) == LM_5) ? (0x024) : (((lm) - LM_0) * 0x004))
@@ -588,6 +589,9 @@ struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx,dpu_hw_blk_init (&c->base,DPU_HW_BLK_CTL , idx, &dpu_hw_ops); +dpu_dbg_reg_register_dump_range (DPU_DBG_NAME , cfg->name, c->hw.blk_off, + c->hw.blk_off + c->hw.length, c->hw.xin_id); +return c; }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c +5 -2
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. */ #include "dpu_hwio.h"
@@ -7,7 +7,7 @@#include "dpu_hw_lm.h" #include "dpu_hw_dspp.h" #include "dpu_kms.h" - +#include "dpu_dbg.h" /* DSPP_PCC */ #define PCC_EN BIT(0)
@@ -115,6 +115,9 @@ struct dpu_hw_dspp *dpu_hw_dspp_init(enum dpu_dspp idx,dpu_hw_blk_init (&c->base,DPU_HW_BLK_DSPP , idx, &dpu_hw_ops); +dpu_dbg_reg_register_dump_range (DPU_DBG_NAME , cfg->name, c->hw.blk_off, + c->hw.blk_off + c->hw.length, c->hw.xin_id); +return c; }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +4 -1
@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. */ #include "dpu_hwio.h" #include "dpu_hw_catalog.h" #include "dpu_hw_intf.h" #include "dpu_kms.h" +#include "dpu_dbg.h" #define INTF_TIMING_ENGINE_EN 0x000#define INTF_CONFIG 0x004
@@ -319,6 +320,8 @@ struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx,dpu_hw_blk_init (&c->base,DPU_HW_BLK_INTF , idx, &dpu_hw_ops); +dpu_dbg_reg_register_dump_range (DPU_DBG_NAME , cfg->name, c->hw.blk_off, + c->hw.blk_off + c->hw.length, c->hw.xin_id);return c; }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +5 -1
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. */ #include <linux/iopoll.h>
@@ -10,6 +10,7 @@#include "dpu_hw_pingpong.h" #include "dpu_kms.h" #include "dpu_trace.h" +#include "dpu_dbg.h" #define PP_TEAR_CHECK_EN 0x000#define PP_SYNC_CONFIG_VSYNC 0x004
@@ -260,6 +261,9 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,dpu_hw_blk_init (&c->base,DPU_HW_BLK_PINGPONG , idx, &dpu_hw_ops); +dpu_dbg_reg_register_dump_range (DPU_DBG_NAME , cfg->name, c->hw.blk_off, + c->hw.blk_off + c->hw.length, c->hw.xin_id); +return c; }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +7 -1
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. */ #include "dpu_hwio.h"
@@ -7,6 +7,7 @@#include "dpu_hw_lm.h" #include "dpu_hw_sspp.h" #include "dpu_kms.h" +#include "dpu_dbg.h" #define DPU_FETCH_CONFIG_RESET_VALUE 0x00000087
@@ -736,6 +737,11 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,dpu_hw_blk_init (&hw_pipe->base,DPU_HW_BLK_SSPP , idx, &dpu_hw_ops); +dpu_dbg_reg_register_dump_range (DPU_DBG_NAME , cfg->name, + hw_pipe->hw.blk_off, + hw_pipe->hw.blk_off + hw_pipe->hw.length, + hw_pipe->hw.xin_id); +return hw_pipe; }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c +6 -1
@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. */ #include "dpu_hwio.h" #include "dpu_hw_catalog.h" #include "dpu_hw_top.h" #include "dpu_kms.h" +#include "dpu_dbg.h" #define SSPP_SPARE 0x28
@@ -326,6 +327,10 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,dpu_hw_blk_init (&mdp->base,DPU_HW_BLK_TOP , idx, &dpu_hw_ops); +dpu_dbg_reg_register_dump_range (DPU_DBG_NAME , cfg->name, + mdp->hw.blk_off, mdp->hw.blk_off + mdp->hw.length, + mdp->hw.xin_id); +return mdp; }
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +10 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2014-2018, 2020 The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark <[email protected]> */
@@ -27,6 +27,7 @@#include "dpu_encoder.h" #include "dpu_plane.h" #include "dpu_crtc.h" +#include "dpu_dbg.h" #define CREATE_TRACE_POINTS #include "dpu_trace.h"
@@ -908,7 +909,14 @@ static int dpu_kms_hw_init(struct msm_kms *kms) dpu_kms->mmio =NULL ; goto error; } -DRM_DEBUG ("mapped dpu address space @%pK\n" , dpu_kms->mmio); + + dpu_kms->mmio_len =msm_iomap_size (dpu_kms->pdev,"mdp" ); + +DRM_DEBUG ("mapped dpu address space @%pK len = 0x%lx\n" , + dpu_kms->mmio, dpu_kms->mmio_len); + +dpu_dbg_reg_register_base (DPU_DBG_NAME , + dpu_kms->mmio, dpu_kms->mmio_len); dpu_kms->vbif[VBIF_RT ] =msm_ioremap (dpu_kms->pdev,"vbif" ,"vbif" );if (IS_ERR (dpu_kms->vbif[VBIF_RT ])) {
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +3 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-only */ /* -* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark <[email protected]> */
@@ -103,6 +103,8 @@ struct dpu_kms {/* io/register spaces: */ void __iomem *mmio, *vbif[VBIF_MAX ], *reg_dma; +unsigned long mmio_len; +struct regulator *vdd;struct regulator *mmagic;struct regulator *venus;
drivers/gpu/drm/msm/dp/dp_catalog.c +12 -0
@@ -63,6 +63,18 @@ struct dp_catalog_private {u8 aux_lut_cfg_index[PHY_AUX_CFG_MAX ]; }; +void dp_catalog_register_dbg_base (struct dp_catalog *dp_catalog) +{ +char dbg_name[32 ]; +struct dp_catalog_private *catalog =container_of (dp_catalog, + struct dp_catalog_private, dp_catalog); + +snprintf (dbg_name,32 ,"dp_ctrl" ); + +dpu_dbg_reg_register_base (dbg_name, catalog->io->dp_controller.base, + catalog->io->dp_controller.len); +} +static inline u32 dp_read_aux (struct dp_catalog_private *catalog,u32 offset) { offset +=MSM_DP_CONTROLLER_AUX_OFFSET ;
drivers/gpu/drm/msm/dp/dp_catalog.h +4 -0
@@ -9,6 +9,7 @@#include <drm/drm_modes.h> #include "dp_parser.h" +#include "dpu_dbg.h" /* interrupts */ #define DP_INTR_HPD BIT(0)
@@ -71,6 +72,9 @@ struct dp_catalog {u32 audio_data; }; +/* Debug module */ +void dp_catalog_register_dbg_base (struct dp_catalog *dp_catalog); +/* AUX APIs */ u32 dp_catalog_aux_read_data (struct dp_catalog *dp_catalog);int dp_catalog_aux_write_data (struct dp_catalog *dp_catalog);
drivers/gpu/drm/msm/dp/dp_display.c +2 -0
@@ -230,6 +230,8 @@ static int dp_display_bind(struct device *dev, struct device *master,if (rc)DRM_ERROR ("Audio registration Dp failed\n" ); +dp_catalog_register_dbg_base (dp->catalog); + end:return rc; }
drivers/gpu/drm/msm/dsi/dsi.c +1 -0
@@ -119,6 +119,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) } priv->dsi[msm_dsi->id] = msm_dsi; +msm_dsi_dbg_register_base (msm_dsi->host);return 0 ; }
drivers/gpu/drm/msm/dsi/dsi.h +1 -0
@@ -175,6 +175,7 @@ void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,struct msm_dsi_phy_clk_request *clk_req, bool is_dual_dsi);void msm_dsi_host_destroy (struct mipi_dsi_host *host); +void msm_dsi_dbg_register_base (struct mipi_dsi_host *host);int msm_dsi_host_modeset_init (struct mipi_dsi_host *host,struct drm_device *dev);int msm_dsi_host_init (struct msm_dsi *msm_dsi);
drivers/gpu/drm/msm/dsi/dsi_host.c +14 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (c) 2015, The Linux Foundation. All rights reserved. +* Copyright (c) 2015, 2020 The Linux Foundation. All rights reserved. */ #include <linux/clk.h>
@@ -26,6 +26,8 @@#include "sfpb.xml.h" #include "dsi_cfg.h" #include "msm_kms.h" +#include "dpu_dbg.h" +#include "msm_drv.h" #define DSI_RESET_TOGGLE_DELAY_MS 20
@@ -1919,6 +1921,17 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)return ret; } +void msm_dsi_dbg_register_base (struct mipi_dsi_host *host) +{ +struct msm_dsi_host *msm_host =to_msm_dsi_host (host); +char dbg_name[32 ]; + +snprintf (dbg_name,32 ,"dsi%d_ctrl" , + msm_host->id); +dpu_dbg_reg_register_base (dbg_name, msm_host->ctrl_base, +msm_iomap_size (msm_host->pdev,"dsi_ctrl" )); +} +void msm_dsi_host_destroy (struct mipi_dsi_host *host) {struct msm_dsi_host *msm_host =to_msm_dsi_host (host);
drivers/gpu/drm/msm/msm_drv.c +25 -1
@@ -17,8 +17,8 @@#include <drm/drm_prime.h> #include <drm/drm_of.h> #include <drm/drm_vblank.h> -#include "dpu_dbg.h" +#include "dpu_dbg.h" #include "msm_drv.h" #include "msm_debugfs.h" #include "msm_fence.h"
@@ -166,6 +166,24 @@ void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,return _msm_ioremap (pdev, name, dbgname, true); } +unsigned long msm_iomap_size (struct platform_device *pdev,const char *name) +{ +struct resource *res; + +if (name) + res =platform_get_resource_byname (pdev,IORESOURCE_MEM , name); +else + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + +if (!res) { +dev_dbg (&pdev->dev,"failed to get memory resource: %s\n" , + name); +return 0 ; + } + +return resource_size (res); +} +void msm_writel (u32 data,void __iomem *addr) {if (reglog)
@@ -535,6 +553,8 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)if (ret) goto err_msm_uninit; +dpu_dbg_register_drm_dev (ddev); +drm_mode_config_reset (ddev);#ifdef CONFIG_DRM_FBDEV_EMULATION
@@ -1282,6 +1302,10 @@ static int msm_pdev_probe(struct platform_device *pdev)int ret;if (get_mdp_ver (pdev)) { + ret =dpu_dbg_init (&pdev->dev); +if (ret) +pr_err ("dpu_dbg_init failed ret = %d\n" , ret); + ret =add_display_components (&pdev->dev, &match);if (ret)return ret;
drivers/gpu/drm/msm/msm_drv.h +2 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-only */ /* -* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2016-2018, 2020 The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark <[email protected]> */
@@ -476,6 +476,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, const char *dbgname);void __iomem *msm_ioremap_quiet (struct platform_device *pdev,const char *name,const char *dbgname); +unsigned long msm_iomap_size (struct platform_device *pdev,const char *name);void msm_writel (u32 data,void __iomem *addr);u32 msm_readl (const void __iomem *addr);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 4/4 drm/msm/dpu: add dpu_dbg points across dpu driver
In reply to Abhinav KumarAdd dpu_dbg points across dpu driver to trigger dumps when critical errors are hit.
changes in v2: none
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 ++++++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 5 +++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 5 ++++- 3 files changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +10 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2014-2018, 2020 The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark <[email protected]> */
@@ -26,6 +26,7 @@#include "dpu_crtc.h" #include "dpu_trace.h" #include "dpu_core_irq.h" +#include "dpu_dbg.h" #define DPU_DEBUG_ENC (e, fmt, ...) DPU_DEBUG("enc%d " fmt,\ (e) ? (e)->base.base.id : -1, ##__VA_ARGS__)
@@ -1313,6 +1314,11 @@ static void dpu_encoder_underrun_callback(struct drm_encoder *drm_enc,DPU_ATRACE_BEGIN ("encoder_underrun_callback" );atomic_inc (&phy_enc->underrun_cnt); + +/* trigger dump only on the first underrun */ +if (atomic_read (&phy_enc->underrun_cnt) ==1 ) +DPU_DBG_DUMP ("all" ); +trace_dpu_enc_underrun_cb (DRMID (drm_enc),atomic_read (&phy_enc->underrun_cnt));DPU_ATRACE_END ("encoder_underrun_callback" );
@@ -1553,8 +1559,10 @@ static void dpu_encoder_helper_hw_reset(struct dpu_encoder_phys *phys_enc) ctl->idx); rc = ctl->ops.reset (ctl); -if (rc) +if (rc) {DPU_ERROR_ENC (dpu_enc,"ctl %d reset failure\n" , ctl->idx); +DPU_DBG_DUMP ("all" ); + } phys_enc->enable_state =DPU_ENC_ENABLED ; }
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +3 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. +* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. */ #define pr_fmt (fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
@@ -9,6 +9,7 @@#include "dpu_core_irq.h" #include "dpu_formats.h" #include "dpu_trace.h" +#include "dpu_dbg.h" #define DPU_DEBUG_CMDENC (e, fmt, ...) DPU_DEBUG("enc%d intf%d " fmt, \ (e) && (e)->base.parent ? \
@@ -213,7 +214,7 @@ static int _dpu_encoder_phys_cmd_handle_ppdone_timeout( phys_enc->hw_ctl->idx -CTL_0 , cmd_enc->pp_timeout_report_cnt, atomic_read(&phys_enc->pending_kickoff_cnt)); - +DPU_DBG_DUMP ("all" );dpu_encoder_helper_unregister_irq (phys_enc,INTR_IDX_RDPTR ); }
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +4 -1
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. */ #define pr_fmt (fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
@@ -8,6 +8,7 @@#include "dpu_core_irq.h" #include "dpu_formats.h" #include "dpu_trace.h" +#include "dpu_dbg.h" #define DPU_DEBUG_VIDENC (e, fmt, ...) DPU_DEBUG("enc%d intf%d " fmt, \ (e) && (e)->parent ? \
@@ -467,6 +468,7 @@ static void dpu_encoder_phys_vid_enable(struct dpu_encoder_phys *phys_enc)"update pending flush ctl %d flush_mask 0%x intf_mask 0x%x\n" , ctl->idx - CTL_0, flush_mask, intf_flush_mask); +atomic_set (&phys_enc->underrun_cnt,0 );/* ctl_flush & timing engine enable will be triggered by framework */ if (phys_enc->enable_state ==DPU_ENC_DISABLED )
@@ -549,6 +551,7 @@ static void dpu_encoder_phys_vid_prepare_for_kickoff(if (rc) {DPU_ERROR_VIDENC (phys_enc,"ctl %d reset failure: %d\n" , ctl->idx, rc); +DPU_DBG_DUMP ("all" );dpu_encoder_helper_unregister_irq (phys_enc,INTR_IDX_VSYNC ); } }
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/4] drm: allow drm_atomic_print_state() to accept any drm_printer
In reply to Abhinav KumarQuoted 40 lines · Abhinav Kumar
Currently
drm_atomic_print_state()internally allocates and uses adrm_infoprinter. Allow it to accept anydrm_printertype so that the API can be leveraged even for taking drm snapshot.Rename the
drm_atomic_print_state()todrm_atomic_print_new_state()so that it reflects its functionality better.changes in v2:
- Rename the functiondrm_atomic_print_statetodrm_atomic_print_new_stateand update the commit text
- Fix kbot errors
- Add kernel doc for the newly exported functionReported-by kernel test robot <[email protected]>Signed-off-by Abhinav Kumar <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 29 +++++++++++++++---- drivers/gpu/drm/drm_atomic_uapi.c | 4 ++- drivers/gpu/drm/drm_crtc_internal.h | 4 ++- .../gpu/drm/selftests/test-drm_framebuffer.c | 1 + 4 files changed, 31 insertions(+), 7 deletions(-)drivers/gpu/drm/drm_atomic.c +2
-1@@ -1,6 +1,7 @@/* * Copyright (C) 2014 Red Hat * Copyright (C) 2014 Intel Corp. +* Copyright (c) 2020, The Linux Foundation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1543,9 +1544,21 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, }EXPORT_SYMBOL (__drm_atomic_helper_set_config); -void drm_atomic_print_state (const struct drm_atomic_state *state) +/**
drivers/gpu/drm/drm_atomic.c int __drm_atomic_helper_set_config(struct drm_mode_set *set, · line 1557
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +10
-0+* drm_atomic_print_new_state - prints drm atomic state +* @state: atomic configuration to check +* @p: drm printer +* +* This functions prints the drm atomic state snapshot using the drm printer +* which is passed to it. This snapshot can be used for debugging purposes. +* +* Note that this function looks into the new state objects and hence its not +* safe to be used after the call to drm_atomic_helper_commit_hw_done(). +*
Empty line here in the docs. With that removed.
Quoted 102 lines
drivers/gpu/drm/drm_atomic.c +12
-4+*/ +void drm_atomic_print_new_state (const struct drm_atomic_state *state, +struct drm_printer *p) { -struct drm_printer p =drm_info_printer (state->dev->dev);struct drm_plane *plane;struct drm_plane_state *plane_state;struct drm_crtc *crtc;@@ -1554,17 +1567,23 @@ void drm_atomic_print_state(const struct drm_atomic_state *state)struct drm_connector_state *connector_state;int i; +if (!p) { +DRM_ERROR ("invalid drm printer\n" ); +return ; + } +DRM_DEBUG_ATOMIC ("checking %p\n" , state);for_each_new_plane_in_state (state, plane, plane_state, i) -drm_atomic_plane_print_state (&p, plane_state); +drm_atomic_plane_print_state (p, plane_state);for_each_new_crtc_in_state (state, crtc, crtc_state, i) -drm_atomic_crtc_print_state (&p, crtc_state); +drm_atomic_crtc_print_state (p, crtc_state);for_each_new_connector_in_state (state, connector, connector_state, i) -drm_atomic_connector_print_state (&p, connector_state); +drm_atomic_connector_print_state (p, connector_state); } +EXPORT_SYMBOL (drm_atomic_print_new_state);static void __drm_state_dump (struct drm_device *dev,struct drm_printer *p,bool take_locks)drivers/gpu/drm/drm_atomic_uapi.c +3
-1@@ -2,6 +2,7 @@* Copyright (C) 2014 Red Hat * Copyright (C) 2014 Intel Corp. * Copyright (C) 2018 Intel Corp. +* Copyright (c) 2020, The Linux Foundation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1294,6 +1295,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,struct drm_out_fence_state *fence_state;int ret =0 ;unsigned int i, j, num_fences; +struct drm_printer p =drm_info_printer (dev->dev);/* disallow for drivers not supporting atomic: */ if (!drm_core_check_feature (dev,DRIVER_ATOMIC ))@@ -1413,7 +1415,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, ret =drm_atomic_nonblocking_commit (state); }else {if (drm_debug_enabled (DRM_UT_STATE )) -drm_atomic_print_state (state); +drm_atomic_print_new_state (state, &p); ret =drm_atomic_commit (state); }drivers/gpu/drm/drm_crtc_internal.h +3
-1@@ -5,6 +5,7 @@* Jesse Barnes <[email protected]> * Copyright © 2014 Intel Corporation * Daniel Vetter <[email protected]> +* Copyright (c) 2020, The Linux Foundation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -233,7 +234,8 @@ int __drm_atomic_helper_disable_plane(struct drm_plane *plane,int __drm_atomic_helper_set_config (struct drm_mode_set *set,struct drm_atomic_state *state); -void drm_atomic_print_state (const struct drm_atomic_state *state); +void drm_atomic_print_new_state (const struct drm_atomic_state *state, +struct drm_printer *p);/* drm_atomic_uapi.c */ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,drivers/gpu/drm/selftests/test-drm_framebuffer.c +1
-0@@ -8,6 +8,7 @@#include <drm/drm_device.h> #include <drm/drm_mode.h> #include <drm/drm_fourcc.h> +#include <drm/drm_print.h> #include "../drm_crtc_internal.h" Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Freedreno] [PATCH v2 3/4] drm/msm: register the base address with dpu_dbg module
In reply to Abhinav KumarQuoted 29 lines · Abhinav Kumar
Register the base address of various dpu sub-modules with the
dpu_dbgmodule so that it can be dumped out during error scenarios.changes in v2:
- Fix an issue where the same dsi client was getting registered multiple times to thedpu_dbgmoduleSigned-off-by Abhinav Kumar <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c | 4 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 6 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c | 7 +++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 5 +++- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 6 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 7 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 +++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++- drivers/gpu/drm/msm/dp/dp_catalog.c | 12 +++++++++ drivers/gpu/drm/msm/dp/dp_catalog.h | 4 +++ drivers/gpu/drm/msm/dp/dp_display.c | 2 ++ drivers/gpu/drm/msm/dsi/dsi.c | 1 + drivers/gpu/drm/msm/dsi/dsi.h | 1 + drivers/gpu/drm/msm/dsi/dsi_host.c | 15 ++++++++++- drivers/gpu/drm/msm/msm_drv.c | 26 ++++++++++++++++++- drivers/gpu/drm/msm/msm_drv.h | 3 ++- 17 files changed, 108 insertions(+), 15 deletions(-)
[snip]
Quoted 49 lines
drivers/gpu/drm/msm/msm_drv.c +21
-1@@ -17,8 +17,8 @@#include <drm/drm_prime.h> #include <drm/drm_of.h> #include <drm/drm_vblank.h> -#include "dpu_dbg.h" +#include "dpu_dbg.h" #include "msm_drv.h" #include "msm_debugfs.h" #include "msm_fence.h" @@ -166,6 +166,24 @@ void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,return _msm_ioremap (pdev, name, dbgname, true); } +unsigned long msm_iomap_size (struct platform_device *pdev,const char *name) +{ +struct resource *res; + +if (name) + res =platform_get_resource_byname (pdev,IORESOURCE_MEM , name); +else + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + +if (!res) { +dev_dbg (&pdev->dev,"failed to get memory resource: %s\n" , + name); +return 0 ; + } + +return resource_size (res); +} +void msm_writel (u32 data,void __iomem *addr) {if (reglog)@@ -535,6 +553,8 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)if (ret) goto err_msm_uninit; +dpu_dbg_register_drm_dev (ddev); +drm_mode_config_reset (ddev);#ifdef CONFIG_DRM_FBDEV_EMULATION
drivers/gpu/drm/msm/msm_drv.c static int msm_pdev_probe(struct platform_device *pdev) · line 1311
Quoted 10 lines
drivers/gpu/drm/msm/msm_drv.c +4
-0@@ -1282,6 +1302,10 @@ static int msm_pdev_probe(struct platform_device *pdev)int ret;if (get_mdp_ver (pdev)) { + ret =dpu_dbg_init (&pdev->dev); +if (ret) +pr_err ("dpu_dbg_init failed ret = %d\n" , ret); + ret =add_display_components (&pdev->dev, &match);if (ret)return ret;
I'm a bit skeptical about where you are registering/initializing dpu dbg.. what happens on mdp4/mdp5 devices?
BR,
-R
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel