File Index
Files and directories
Sign in
FILE

msm_disp_snapshot.h

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h C
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
  4 */
  5
  6#ifndef MSM_DISP_SNAPSHOT_H_
  7#define MSM_DISP_SNAPSHOT_H_
  8
  9#include <drm/drm_atomic_helper.h>
 10#include <drm/drm_device.h>
 11#include "../../../drm_crtc_internal.h"
 12#include <drm/drm_print.h>
 13#include <drm/drm_atomic.h>
 14#include <linux/debugfs.h>
 15#include <linux/list.h>
 16#include <linux/delay.h>
 17#include <linux/spinlock.h>
 18#include <linux/ktime.h>
 19#include <linux/uaccess.h>
 20#include <linux/dma-buf.h>
 21#include <linux/slab.h>
 22#include <linux/list_sort.h>
 23#include <linux/pm.h>
 24#include <linux/pm_runtime.h>
 25#include <linux/kthread.h>
 26#include <linux/devcoredump.h>
 27#include "msm_kms.h"
 28
 29#define MSM_DISP_SNAPSHOT_MAX_BLKS		10
 30
 31/* debug option to print the registers in logs */
 32#define MSM_DISP_SNAPSHOT_DUMP_IN_CONSOLE 0
 33
 34/* print debug ranges in groups of 4 u32s */
 35#define REG_DUMP_ALIGN		16
 36
 37/**
 38 * struct msm_disp_state - structure to store current dpu state
 39 * @dev: device pointer
 40 * @drm_dev: drm device pointer
 41 * @blocks: list head for hardware state blocks
 42 * @atomic_state: atomic state duplicated at the time of the error
 43 * @time: timestamp at which the coredump was captured
 44 */
 45struct msm_disp_state {
 46	struct device *dev;
 47	struct drm_device *drm_dev;
 48
 49	struct list_head blocks;
 50
 51	struct drm_atomic_state *atomic_state;
 52
 53	struct timespec64 time;
 54};
 55
 56/**
 57 * struct msm_disp_state_block - structure to store each hardware block state
 58 * @name: name of the block
 59 * @node: handle to the linked list head
 60 * @size: size of the register space of this hardware block
 61 * @state: array holding the register dump of this hardware block
 62 * @base_addr: starting address of this hardware block's register space
 63 */
 64struct msm_disp_state_block {
 65	char name[SZ_128];
 66	struct list_head node;
 67	unsigned int size;
 68	u32 *state;
 69	void __iomem *base_addr;
 70};
 71
 72/**
 73 * msm_disp_snapshot_init - initialize display snapshot
 74 * @drm_dev:	drm device handle
 75 *
 76 * Returns:		0 or -ERROR
 77 */
 78int msm_disp_snapshot_init(struct drm_device *drm_dev);
 79
 80/**
 81 * msm_disp_snapshot_destroy - destroy the display snapshot
 82 * @drm_dev:    drm device handle
 83 *
 84 * Returns:	none
 85 */
 86void msm_disp_snapshot_destroy(struct drm_device *drm_dev);
 87
 88/**
 89 * msm_disp_snapshot_state_sync - synchronously snapshot display state
 90 * @kms:  the kms object
 91 *
 92 * Returns: state or error
 93 *
 94 * Context:
 95 * Must be called with &kms->dump_mutex held
 96 */
 97struct msm_disp_state *msm_disp_snapshot_state_sync(struct msm_kms *kms);
 98
 99/**
100 * msm_disp_snapshot_state - trigger to dump the display snapshot
101 * @drm_dev:	handle to drm device
102 *
103 * Returns:	none
104 */
105void msm_disp_snapshot_state(struct drm_device *drm_dev);
106
107/**
108 * msm_disp_state_print - print out the current dpu state
109 * @disp_state:	    handle to drm device
110 * @p:	    handle to drm printer
111 *
112 * Returns:	none
113 */
114void msm_disp_state_print(struct msm_disp_state *disp_state, struct drm_printer *p);
115
116/**
117 * msm_disp_snapshot_capture_state - utility to capture atomic state and hw registers
118 * @disp_state:	    handle to msm_disp_state struct
119 *
120 * Returns:	none
121 */
122void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state);
123
124/**
125 * msm_disp_state_free - free the memory after the coredump has been read
126 * @data:	    handle to struct msm_disp_state
127 *
128 * Returns: none
129 */
130void msm_disp_state_free(void *data);
131
132/**
133 * msm_disp_snapshot_add_block - add a hardware block with its register dump
134 * @disp_state:	    handle to struct msm_disp_state
135 * @len:            size of the register space of the hardware block
136 * @base_addr:      starting address of the register space of the hardware block
137 * @fmt:            format in which the block names need to be printed
138 *
139 * Returns: none
140 */
141__printf(4, 5)
142void msm_disp_snapshot_add_block(struct msm_disp_state *disp_state, u32 len,
143		void __iomem *base_addr, const char *fmt, ...);
144
145#endif /* MSM_DISP_SNAPSHOT_H_ */
~/ Read-only file preview.