[PATCH 3/9] drm/panthor: capture GLB state for devcoredump

Chia-I Wu posted 9 patches 2 months, 2 weeks ago
[PATCH 3/9] drm/panthor: capture GLB state for devcoredump
Posted by Chia-I Wu 2 months, 2 weeks ago
Capture interesting panthor_fw_global_iface fields for devcoredump.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
---
 drivers/gpu/drm/panthor/panthor_coredump.c | 33 ++++++++++++++++++++++
 drivers/gpu/drm/panthor/panthor_coredump.h | 13 +++++++++
 2 files changed, 46 insertions(+)

diff --git a/drivers/gpu/drm/panthor/panthor_coredump.c b/drivers/gpu/drm/panthor/panthor_coredump.c
index a41d0bbcb4f1..44d711e2f310 100644
--- a/drivers/gpu/drm/panthor/panthor_coredump.c
+++ b/drivers/gpu/drm/panthor/panthor_coredump.c
@@ -13,6 +13,7 @@
 
 #include "panthor_coredump.h"
 #include "panthor_device.h"
+#include "panthor_fw.h"
 #include "panthor_regs.h"
 #include "panthor_sched.h"
 
@@ -22,6 +23,7 @@
 enum panthor_coredump_mask {
 	PANTHOR_COREDUMP_GROUP = BIT(0),
 	PANTHOR_COREDUMP_GPU = BIT(1),
+	PANTHOR_COREDUMP_GLB = BIT(2),
 };
 
 /**
@@ -50,6 +52,7 @@ struct panthor_coredump {
 
 	struct panthor_coredump_group_state group;
 	struct panthor_coredump_gpu_state gpu;
+	struct panthor_coredump_glb_state glb;
 
 	/* @data: Serialized coredump data. */
 	void *data;
@@ -82,6 +85,17 @@ static const char *reason_str(enum panthor_coredump_reason reason)
 	}
 }
 
+static void print_glb(struct drm_printer *p,
+		      const struct panthor_coredump_glb_state *glb)
+{
+	drm_puts(p, "glb:\n");
+	drm_printf(p, "  GLB_VERSION: 0x%x\n", glb->version);
+	drm_printf(p, "  GLB_FEATURES: 0x%x\n", glb->features);
+	drm_printf(p, "  GLB_GROUP_NUM: 0x%x\n", glb->group_num);
+	drm_printf(p, "  GLB_REQ: 0x%x\n", glb->req);
+	drm_printf(p, "  GLB_ACK: 0x%x\n", glb->ack);
+}
+
 static void print_gpu(struct drm_printer *p,
 		      const struct panthor_coredump_gpu_state *gpu,
 		      const struct drm_panthor_gpu_info *info)
@@ -176,6 +190,9 @@ static void print_cd(struct drm_printer *p, const struct panthor_coredump *cd)
 	/* many gpu states are static and are captured in drm_panthor_gpu_info */
 	print_gpu(p, cd->mask & PANTHOR_COREDUMP_GPU ? &cd->gpu : NULL,
 		  &cd->ptdev->gpu_info);
+
+	if (cd->mask & PANTHOR_COREDUMP_GLB)
+		print_glb(p, &cd->glb);
 }
 
 static void process_cd(struct panthor_device *ptdev,
@@ -202,6 +219,19 @@ static void process_cd(struct panthor_device *ptdev,
 	print_cd(&p, cd);
 }
 
+static void capture_glb(struct panthor_device *ptdev,
+			struct panthor_coredump_glb_state *glb)
+{
+	const struct panthor_fw_global_iface *glb_iface =
+		panthor_fw_get_glb_iface(ptdev);
+
+	glb->version = glb_iface->control->version;
+	glb->features = glb_iface->control->features;
+	glb->group_num = glb_iface->control->group_num;
+	glb->req = glb_iface->input->req;
+	glb->ack = glb_iface->output->ack;
+}
+
 static void capture_gpu(struct panthor_device *ptdev,
 			struct panthor_coredump_gpu_state *gpu)
 {
@@ -231,6 +261,9 @@ static void capture_cd(struct panthor_device *ptdev,
 
 	capture_gpu(ptdev, &cd->gpu);
 	cd->mask |= PANTHOR_COREDUMP_GPU;
+
+	capture_glb(ptdev, &cd->glb);
+	cd->mask |= PANTHOR_COREDUMP_GLB;
 }
 
 static void panthor_coredump_free(void *data)
diff --git a/drivers/gpu/drm/panthor/panthor_coredump.h b/drivers/gpu/drm/panthor/panthor_coredump.h
index 9e30c02ab962..e578298e9b57 100644
--- a/drivers/gpu/drm/panthor/panthor_coredump.h
+++ b/drivers/gpu/drm/panthor/panthor_coredump.h
@@ -56,6 +56,19 @@ struct panthor_coredump_gpu_state {
 	u32 mcu_features;
 };
 
+/**
+ * struct panthor_coredump_glb_state - Coredump GLB state
+ *
+ * Interesting panthor_fw_global_iface fields.
+ */
+struct panthor_coredump_glb_state {
+	u32 version;
+	u32 features;
+	u32 group_num;
+	u32 req;
+	u32 ack;
+};
+
 #ifdef CONFIG_DEV_COREDUMP
 
 struct panthor_coredump *
-- 
2.50.0.727.gbf7dc18ff4-goog
Re: [PATCH 3/9] drm/panthor: capture GLB state for devcoredump
Posted by kernel test robot 2 months, 2 weeks ago
Hi Chia-I,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on next-20250718]
[cannot apply to linus/master v6.16-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chia-I-Wu/drm-panthor-add-devcoredump-support/20250720-080312
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20250720000146.1405060-4-olvaffe%40gmail.com
patch subject: [PATCH 3/9] drm/panthor: capture GLB state for devcoredump
config: x86_64-buildonly-randconfig-004-20250720 (https://download.01.org/0day-ci/archive/20250720/202507201318.sVNbKtUN-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250720/202507201318.sVNbKtUN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507201318.sVNbKtUN-lkp@intel.com/

All warnings (new ones prefixed by >>):

   Warning: drivers/gpu/drm/panthor/panthor_coredump.c:26 Enum value 'PANTHOR_COREDUMP_GROUP' not described in enum 'panthor_coredump_mask'
   Warning: drivers/gpu/drm/panthor/panthor_coredump.c:26 Enum value 'PANTHOR_COREDUMP_GPU' not described in enum 'panthor_coredump_mask'
>> Warning: drivers/gpu/drm/panthor/panthor_coredump.c:26 Enum value 'PANTHOR_COREDUMP_GLB' not described in enum 'panthor_coredump_mask'
   Warning: drivers/gpu/drm/panthor/panthor_coredump.c:34 struct member 'reason' not described in 'panthor_coredump_header'
   Warning: drivers/gpu/drm/panthor/panthor_coredump.c:34 struct member 'timestamp' not described in 'panthor_coredump_header'
   Warning: drivers/gpu/drm/panthor/panthor_coredump.c:61 struct member 'group' not described in 'panthor_coredump'
   Warning: drivers/gpu/drm/panthor/panthor_coredump.c:61 struct member 'gpu' not described in 'panthor_coredump'
>> Warning: drivers/gpu/drm/panthor/panthor_coredump.c:61 struct member 'glb' not described in 'panthor_coredump'
   Warning: drivers/gpu/drm/panthor/panthor_coredump.c:61 struct member 'data' not described in 'panthor_coredump'
   Warning: drivers/gpu/drm/panthor/panthor_coredump.c:61 struct member 'size' not described in 'panthor_coredump'

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki