mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	drm/i915: Start chopping up the GPU error capture
In the near future, we will want to start a GPU error capture from a new context, from inside the softirq region of a forced preemption. To do so requires us to break up the monolithic error capture to provide new entry points with finer control; in particular focusing on one engine/gt, and being able to compose an error state from little pieces of HW capture. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Andi Shyti <andi.shyti@intel.com> Acked-by: Andi Shyti <andi.shyti@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200110123059.1348712-1-chris@chris-wilson.co.uk
This commit is contained in:
		
							parent
							
								
									8ccfc20a7d
								
							
						
					
					
						commit
						742379c0c4
					
				
					 11 changed files with 905 additions and 701 deletions
				
			
		| 
						 | 
				
			
			@ -202,7 +202,7 @@ void intel_engine_set_hwsp_writemask(struct intel_engine_cs *engine, u32 mask);
 | 
			
		|||
u64 intel_engine_get_active_head(const struct intel_engine_cs *engine);
 | 
			
		||||
u64 intel_engine_get_last_batch_head(const struct intel_engine_cs *engine);
 | 
			
		||||
 | 
			
		||||
void intel_engine_get_instdone(struct intel_engine_cs *engine,
 | 
			
		||||
void intel_engine_get_instdone(const struct intel_engine_cs *engine,
 | 
			
		||||
			       struct intel_instdone *instdone);
 | 
			
		||||
 | 
			
		||||
void intel_engine_init_execlists(struct intel_engine_cs *engine);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -914,8 +914,8 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static u32
 | 
			
		||||
read_subslice_reg(struct intel_engine_cs *engine, int slice, int subslice,
 | 
			
		||||
		  i915_reg_t reg)
 | 
			
		||||
read_subslice_reg(const struct intel_engine_cs *engine,
 | 
			
		||||
		  int slice, int subslice, i915_reg_t reg)
 | 
			
		||||
{
 | 
			
		||||
	struct drm_i915_private *i915 = engine->i915;
 | 
			
		||||
	struct intel_uncore *uncore = engine->uncore;
 | 
			
		||||
| 
						 | 
				
			
			@ -959,7 +959,7 @@ read_subslice_reg(struct intel_engine_cs *engine, int slice, int subslice,
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* NB: please notice the memset */
 | 
			
		||||
void intel_engine_get_instdone(struct intel_engine_cs *engine,
 | 
			
		||||
void intel_engine_get_instdone(const struct intel_engine_cs *engine,
 | 
			
		||||
			       struct intel_instdone *instdone)
 | 
			
		||||
{
 | 
			
		||||
	struct drm_i915_private *i915 = engine->i915;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -495,6 +495,7 @@ static void cleanup_init_ggtt(struct i915_ggtt *ggtt)
 | 
			
		|||
	ggtt_release_guc_top(ggtt);
 | 
			
		||||
	if (drm_mm_node_allocated(&ggtt->error_capture))
 | 
			
		||||
		drm_mm_remove_node(&ggtt->error_capture);
 | 
			
		||||
	mutex_destroy(&ggtt->error_mutex);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int init_ggtt(struct i915_ggtt *ggtt)
 | 
			
		||||
| 
						 | 
				
			
			@ -526,6 +527,7 @@ static int init_ggtt(struct i915_ggtt *ggtt)
 | 
			
		|||
	if (ret)
 | 
			
		||||
		return ret;
 | 
			
		||||
 | 
			
		||||
	mutex_init(&ggtt->error_mutex);
 | 
			
		||||
	if (ggtt->mappable_end) {
 | 
			
		||||
		/* Reserve a mappable slot for our lockless error capture */
 | 
			
		||||
		ret = drm_mm_insert_node_in_range(&ggtt->vm.mm,
 | 
			
		||||
| 
						 | 
				
			
			@ -716,6 +718,7 @@ static void ggtt_cleanup_hw(struct i915_ggtt *ggtt)
 | 
			
		|||
 | 
			
		||||
	if (drm_mm_node_allocated(&ggtt->error_capture))
 | 
			
		||||
		drm_mm_remove_node(&ggtt->error_capture);
 | 
			
		||||
	mutex_destroy(&ggtt->error_mutex);
 | 
			
		||||
 | 
			
		||||
	ggtt_release_guc_top(ggtt);
 | 
			
		||||
	intel_vgt_deballoon(ggtt);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -345,6 +345,7 @@ struct i915_ggtt {
 | 
			
		|||
	/* Manual runtime pm autosuspend delay for user GGTT mmaps */
 | 
			
		||||
	struct intel_wakeref_auto userfault_wakeref;
 | 
			
		||||
 | 
			
		||||
	struct mutex error_mutex;
 | 
			
		||||
	struct drm_mm_node error_capture;
 | 
			
		||||
	struct drm_mm_node uc_fw;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1230,7 +1230,7 @@ void intel_gt_handle_error(struct intel_gt *gt,
 | 
			
		|||
	engine_mask &= INTEL_INFO(gt->i915)->engine_mask;
 | 
			
		||||
 | 
			
		||||
	if (flags & I915_ERROR_CAPTURE) {
 | 
			
		||||
		i915_capture_error_state(gt->i915, engine_mask, msg);
 | 
			
		||||
		i915_capture_error_state(gt->i915);
 | 
			
		||||
		intel_gt_clear_error_registers(gt, engine_mask);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1498,7 +1498,7 @@ static int igt_handle_error(void *arg)
 | 
			
		|||
	struct intel_engine_cs *engine = gt->engine[RCS0];
 | 
			
		||||
	struct hang h;
 | 
			
		||||
	struct i915_request *rq;
 | 
			
		||||
	struct i915_gpu_state *error;
 | 
			
		||||
	struct i915_gpu_coredump *error;
 | 
			
		||||
	int err;
 | 
			
		||||
 | 
			
		||||
	/* Check that we can issue a global GPU and engine reset */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -685,7 +685,7 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
 | 
			
		|||
static ssize_t gpu_state_read(struct file *file, char __user *ubuf,
 | 
			
		||||
			      size_t count, loff_t *pos)
 | 
			
		||||
{
 | 
			
		||||
	struct i915_gpu_state *error;
 | 
			
		||||
	struct i915_gpu_coredump *error;
 | 
			
		||||
	ssize_t ret;
 | 
			
		||||
	void *buf;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -698,7 +698,7 @@ static ssize_t gpu_state_read(struct file *file, char __user *ubuf,
 | 
			
		|||
	if (!buf)
 | 
			
		||||
		return -ENOMEM;
 | 
			
		||||
 | 
			
		||||
	ret = i915_gpu_state_copy_to_buffer(error, buf, *pos, count);
 | 
			
		||||
	ret = i915_gpu_coredump_copy_to_buffer(error, buf, *pos, count);
 | 
			
		||||
	if (ret <= 0)
 | 
			
		||||
		goto out;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -714,19 +714,19 @@ static ssize_t gpu_state_read(struct file *file, char __user *ubuf,
 | 
			
		|||
 | 
			
		||||
static int gpu_state_release(struct inode *inode, struct file *file)
 | 
			
		||||
{
 | 
			
		||||
	i915_gpu_state_put(file->private_data);
 | 
			
		||||
	i915_gpu_coredump_put(file->private_data);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int i915_gpu_info_open(struct inode *inode, struct file *file)
 | 
			
		||||
{
 | 
			
		||||
	struct drm_i915_private *i915 = inode->i_private;
 | 
			
		||||
	struct i915_gpu_state *gpu;
 | 
			
		||||
	struct i915_gpu_coredump *gpu;
 | 
			
		||||
	intel_wakeref_t wakeref;
 | 
			
		||||
 | 
			
		||||
	gpu = NULL;
 | 
			
		||||
	with_intel_runtime_pm(&i915->runtime_pm, wakeref)
 | 
			
		||||
		gpu = i915_capture_gpu_state(i915);
 | 
			
		||||
		gpu = i915_gpu_coredump(i915);
 | 
			
		||||
	if (IS_ERR(gpu))
 | 
			
		||||
		return PTR_ERR(gpu);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -748,7 +748,7 @@ i915_error_state_write(struct file *filp,
 | 
			
		|||
		       size_t cnt,
 | 
			
		||||
		       loff_t *ppos)
 | 
			
		||||
{
 | 
			
		||||
	struct i915_gpu_state *error = filp->private_data;
 | 
			
		||||
	struct i915_gpu_coredump *error = filp->private_data;
 | 
			
		||||
 | 
			
		||||
	if (!error)
 | 
			
		||||
		return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -761,7 +761,7 @@ i915_error_state_write(struct file *filp,
 | 
			
		|||
 | 
			
		||||
static int i915_error_state_open(struct inode *inode, struct file *file)
 | 
			
		||||
{
 | 
			
		||||
	struct i915_gpu_state *error;
 | 
			
		||||
	struct i915_gpu_coredump *error;
 | 
			
		||||
 | 
			
		||||
	error = i915_first_error_state(inode->i_private);
 | 
			
		||||
	if (IS_ERR(error))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1874,7 +1874,7 @@ static inline u32 i915_reset_count(struct i915_gpu_error *error)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static inline u32 i915_reset_engine_count(struct i915_gpu_error *error,
 | 
			
		||||
					  struct intel_engine_cs *engine)
 | 
			
		||||
					  const struct intel_engine_cs *engine)
 | 
			
		||||
{
 | 
			
		||||
	return atomic_read(&error->reset_engine_count[engine->uabi_class]);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -25,69 +25,41 @@
 | 
			
		|||
#include "i915_scheduler.h"
 | 
			
		||||
 | 
			
		||||
struct drm_i915_private;
 | 
			
		||||
struct i915_vma_compress;
 | 
			
		||||
struct intel_engine_capture_vma;
 | 
			
		||||
struct intel_overlay_error_state;
 | 
			
		||||
struct intel_display_error_state;
 | 
			
		||||
 | 
			
		||||
struct i915_gpu_state {
 | 
			
		||||
	struct kref ref;
 | 
			
		||||
	ktime_t time;
 | 
			
		||||
	ktime_t boottime;
 | 
			
		||||
	ktime_t uptime;
 | 
			
		||||
	unsigned long capture;
 | 
			
		||||
struct i915_vma_coredump {
 | 
			
		||||
	struct i915_vma_coredump *next;
 | 
			
		||||
 | 
			
		||||
	struct drm_i915_private *i915;
 | 
			
		||||
	char name[20];
 | 
			
		||||
 | 
			
		||||
	char error_msg[128];
 | 
			
		||||
	bool simulated;
 | 
			
		||||
	bool awake;
 | 
			
		||||
	bool wakelock;
 | 
			
		||||
	bool suspended;
 | 
			
		||||
	int iommu;
 | 
			
		||||
	u32 reset_count;
 | 
			
		||||
	u32 suspend_count;
 | 
			
		||||
	struct intel_device_info device_info;
 | 
			
		||||
	struct intel_runtime_info runtime_info;
 | 
			
		||||
	struct intel_driver_caps driver_caps;
 | 
			
		||||
	struct i915_params params;
 | 
			
		||||
	u64 gtt_offset;
 | 
			
		||||
	u64 gtt_size;
 | 
			
		||||
	u32 gtt_page_sizes;
 | 
			
		||||
 | 
			
		||||
	struct i915_error_uc {
 | 
			
		||||
		struct intel_uc_fw guc_fw;
 | 
			
		||||
		struct intel_uc_fw huc_fw;
 | 
			
		||||
		struct drm_i915_error_object *guc_log;
 | 
			
		||||
	} uc;
 | 
			
		||||
	int num_pages;
 | 
			
		||||
	int page_count;
 | 
			
		||||
	int unused;
 | 
			
		||||
	u32 *pages[0];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
	/* Generic register state */
 | 
			
		||||
	u32 eir;
 | 
			
		||||
	u32 pgtbl_er;
 | 
			
		||||
	u32 ier;
 | 
			
		||||
	u32 gtier[6], ngtier;
 | 
			
		||||
	u32 ccid;
 | 
			
		||||
	u32 derrmr;
 | 
			
		||||
	u32 forcewake;
 | 
			
		||||
	u32 error; /* gen6+ */
 | 
			
		||||
	u32 err_int; /* gen7 */
 | 
			
		||||
	u32 fault_data0; /* gen8, gen9 */
 | 
			
		||||
	u32 fault_data1; /* gen8, gen9 */
 | 
			
		||||
	u32 done_reg;
 | 
			
		||||
	u32 gac_eco;
 | 
			
		||||
	u32 gam_ecochk;
 | 
			
		||||
	u32 gab_ctl;
 | 
			
		||||
	u32 gfx_mode;
 | 
			
		||||
	u32 gtt_cache;
 | 
			
		||||
	u32 aux_err; /* gen12 */
 | 
			
		||||
	u32 sfc_done[GEN12_SFC_DONE_MAX]; /* gen12 */
 | 
			
		||||
	u32 gam_done; /* gen12 */
 | 
			
		||||
struct i915_request_coredump {
 | 
			
		||||
	unsigned long flags;
 | 
			
		||||
	pid_t pid;
 | 
			
		||||
	u32 context;
 | 
			
		||||
	u32 seqno;
 | 
			
		||||
	u32 start;
 | 
			
		||||
	u32 head;
 | 
			
		||||
	u32 tail;
 | 
			
		||||
	struct i915_sched_attr sched_attr;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
	u32 nfence;
 | 
			
		||||
	u64 fence[I915_MAX_NUM_FENCES];
 | 
			
		||||
	struct intel_overlay_error_state *overlay;
 | 
			
		||||
	struct intel_display_error_state *display;
 | 
			
		||||
 | 
			
		||||
	struct drm_i915_error_engine {
 | 
			
		||||
struct intel_engine_coredump {
 | 
			
		||||
	const struct intel_engine_cs *engine;
 | 
			
		||||
 | 
			
		||||
		/* Software tracked state */
 | 
			
		||||
		bool idle;
 | 
			
		||||
	bool simulated;
 | 
			
		||||
	int num_requests;
 | 
			
		||||
	u32 reset_count;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -99,6 +71,7 @@ struct i915_gpu_state {
 | 
			
		|||
	u32 cpu_ring_tail;
 | 
			
		||||
 | 
			
		||||
	/* Register state */
 | 
			
		||||
	u32 ccid;
 | 
			
		||||
	u32 start;
 | 
			
		||||
	u32 tail;
 | 
			
		||||
	u32 head;
 | 
			
		||||
| 
						 | 
				
			
			@ -117,7 +90,7 @@ struct i915_gpu_state {
 | 
			
		|||
	u32 rc_psmi; /* sleep state */
 | 
			
		||||
	struct intel_instdone instdone;
 | 
			
		||||
 | 
			
		||||
		struct drm_i915_error_context {
 | 
			
		||||
	struct i915_gem_context_coredump {
 | 
			
		||||
		char comm[TASK_COMM_LEN];
 | 
			
		||||
		pid_t pid;
 | 
			
		||||
		int active;
 | 
			
		||||
| 
						 | 
				
			
			@ -125,33 +98,9 @@ struct i915_gpu_state {
 | 
			
		|||
		struct i915_sched_attr sched_attr;
 | 
			
		||||
	} context;
 | 
			
		||||
 | 
			
		||||
		struct drm_i915_error_object {
 | 
			
		||||
			u64 gtt_offset;
 | 
			
		||||
			u64 gtt_size;
 | 
			
		||||
			u32 gtt_page_sizes;
 | 
			
		||||
			int num_pages;
 | 
			
		||||
			int page_count;
 | 
			
		||||
			int unused;
 | 
			
		||||
			u32 *pages[0];
 | 
			
		||||
		} *ringbuffer, *batchbuffer, *wa_batchbuffer, *ctx, *hws_page;
 | 
			
		||||
	struct i915_vma_coredump *vma;
 | 
			
		||||
 | 
			
		||||
		struct drm_i915_error_object **user_bo;
 | 
			
		||||
		long user_bo_count;
 | 
			
		||||
 | 
			
		||||
		struct drm_i915_error_object *wa_ctx;
 | 
			
		||||
		struct drm_i915_error_object *default_state;
 | 
			
		||||
 | 
			
		||||
		struct drm_i915_error_request {
 | 
			
		||||
			unsigned long flags;
 | 
			
		||||
			long jiffies;
 | 
			
		||||
			pid_t pid;
 | 
			
		||||
			u32 context;
 | 
			
		||||
			u32 seqno;
 | 
			
		||||
			u32 start;
 | 
			
		||||
			u32 head;
 | 
			
		||||
			u32 tail;
 | 
			
		||||
			struct i915_sched_attr sched_attr;
 | 
			
		||||
		} *requests, execlist[EXECLIST_MAX_PORTS];
 | 
			
		||||
	struct i915_request_coredump *requests, execlist[EXECLIST_MAX_PORTS];
 | 
			
		||||
	unsigned int num_ports;
 | 
			
		||||
 | 
			
		||||
	struct {
 | 
			
		||||
| 
						 | 
				
			
			@ -162,8 +111,75 @@ struct i915_gpu_state {
 | 
			
		|||
		};
 | 
			
		||||
	} vm_info;
 | 
			
		||||
 | 
			
		||||
		struct drm_i915_error_engine *next;
 | 
			
		||||
	} *engine;
 | 
			
		||||
	struct intel_engine_coredump *next;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct intel_gt_coredump {
 | 
			
		||||
	const struct intel_gt *_gt;
 | 
			
		||||
	bool awake;
 | 
			
		||||
	bool simulated;
 | 
			
		||||
 | 
			
		||||
	/* Generic register state */
 | 
			
		||||
	u32 eir;
 | 
			
		||||
	u32 pgtbl_er;
 | 
			
		||||
	u32 ier;
 | 
			
		||||
	u32 gtier[6], ngtier;
 | 
			
		||||
	u32 derrmr;
 | 
			
		||||
	u32 forcewake;
 | 
			
		||||
	u32 error; /* gen6+ */
 | 
			
		||||
	u32 err_int; /* gen7 */
 | 
			
		||||
	u32 fault_data0; /* gen8, gen9 */
 | 
			
		||||
	u32 fault_data1; /* gen8, gen9 */
 | 
			
		||||
	u32 done_reg;
 | 
			
		||||
	u32 gac_eco;
 | 
			
		||||
	u32 gam_ecochk;
 | 
			
		||||
	u32 gab_ctl;
 | 
			
		||||
	u32 gfx_mode;
 | 
			
		||||
	u32 gtt_cache;
 | 
			
		||||
	u32 aux_err; /* gen12 */
 | 
			
		||||
	u32 sfc_done[GEN12_SFC_DONE_MAX]; /* gen12 */
 | 
			
		||||
	u32 gam_done; /* gen12 */
 | 
			
		||||
 | 
			
		||||
	u32 nfence;
 | 
			
		||||
	u64 fence[I915_MAX_NUM_FENCES];
 | 
			
		||||
 | 
			
		||||
	struct intel_engine_coredump *engine;
 | 
			
		||||
 | 
			
		||||
	struct intel_uc_coredump {
 | 
			
		||||
		struct intel_uc_fw guc_fw;
 | 
			
		||||
		struct intel_uc_fw huc_fw;
 | 
			
		||||
		struct i915_vma_coredump *guc_log;
 | 
			
		||||
	} *uc;
 | 
			
		||||
 | 
			
		||||
	struct intel_gt_coredump *next;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct i915_gpu_coredump {
 | 
			
		||||
	struct kref ref;
 | 
			
		||||
	ktime_t time;
 | 
			
		||||
	ktime_t boottime;
 | 
			
		||||
	ktime_t uptime;
 | 
			
		||||
	unsigned long capture;
 | 
			
		||||
 | 
			
		||||
	struct drm_i915_private *i915;
 | 
			
		||||
 | 
			
		||||
	struct intel_gt_coredump *gt;
 | 
			
		||||
 | 
			
		||||
	char error_msg[128];
 | 
			
		||||
	bool simulated;
 | 
			
		||||
	bool wakelock;
 | 
			
		||||
	bool suspended;
 | 
			
		||||
	int iommu;
 | 
			
		||||
	u32 reset_count;
 | 
			
		||||
	u32 suspend_count;
 | 
			
		||||
 | 
			
		||||
	struct intel_device_info device_info;
 | 
			
		||||
	struct intel_runtime_info runtime_info;
 | 
			
		||||
	struct intel_driver_caps driver_caps;
 | 
			
		||||
	struct i915_params params;
 | 
			
		||||
 | 
			
		||||
	struct intel_overlay_error_state *overlay;
 | 
			
		||||
	struct intel_display_error_state *display;
 | 
			
		||||
 | 
			
		||||
	struct scatterlist *sgl, *fit;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -172,7 +188,7 @@ struct i915_gpu_error {
 | 
			
		|||
	/* For reset and error_state handling. */
 | 
			
		||||
	spinlock_t lock;
 | 
			
		||||
	/* Protected by the above dev->gpu_error.lock. */
 | 
			
		||||
	struct i915_gpu_state *first_error;
 | 
			
		||||
	struct i915_gpu_coredump *first_error;
 | 
			
		||||
 | 
			
		||||
	atomic_t pending_fb_pin;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -200,29 +216,54 @@ struct drm_i915_error_state_buf {
 | 
			
		|||
__printf(2, 3)
 | 
			
		||||
void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...);
 | 
			
		||||
 | 
			
		||||
struct i915_gpu_state *i915_capture_gpu_state(struct drm_i915_private *i915);
 | 
			
		||||
void i915_capture_error_state(struct drm_i915_private *dev_priv,
 | 
			
		||||
			      intel_engine_mask_t engine_mask,
 | 
			
		||||
			      const char *error_msg);
 | 
			
		||||
struct i915_gpu_coredump *i915_gpu_coredump(struct drm_i915_private *i915);
 | 
			
		||||
void i915_capture_error_state(struct drm_i915_private *dev_priv);
 | 
			
		||||
 | 
			
		||||
static inline struct i915_gpu_state *
 | 
			
		||||
i915_gpu_state_get(struct i915_gpu_state *gpu)
 | 
			
		||||
struct i915_gpu_coredump *
 | 
			
		||||
i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp);
 | 
			
		||||
 | 
			
		||||
struct intel_gt_coredump *
 | 
			
		||||
intel_gt_coredump_alloc(struct intel_gt *gt, gfp_t gfp);
 | 
			
		||||
 | 
			
		||||
struct intel_engine_coredump *
 | 
			
		||||
intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp);
 | 
			
		||||
 | 
			
		||||
struct intel_engine_capture_vma *
 | 
			
		||||
intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
 | 
			
		||||
				  struct i915_request *rq,
 | 
			
		||||
				  gfp_t gfp);
 | 
			
		||||
 | 
			
		||||
void intel_engine_coredump_add_vma(struct intel_engine_coredump *ee,
 | 
			
		||||
				   struct intel_engine_capture_vma *capture,
 | 
			
		||||
				   struct i915_vma_compress *compress);
 | 
			
		||||
 | 
			
		||||
struct i915_vma_compress *
 | 
			
		||||
i915_vma_capture_prepare(struct intel_gt_coredump *gt);
 | 
			
		||||
 | 
			
		||||
void i915_vma_capture_finish(struct intel_gt_coredump *gt,
 | 
			
		||||
			     struct i915_vma_compress *compress);
 | 
			
		||||
 | 
			
		||||
void i915_error_state_store(struct i915_gpu_coredump *error);
 | 
			
		||||
 | 
			
		||||
static inline struct i915_gpu_coredump *
 | 
			
		||||
i915_gpu_coredump_get(struct i915_gpu_coredump *gpu)
 | 
			
		||||
{
 | 
			
		||||
	kref_get(&gpu->ref);
 | 
			
		||||
	return gpu;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ssize_t i915_gpu_state_copy_to_buffer(struct i915_gpu_state *error,
 | 
			
		||||
ssize_t
 | 
			
		||||
i915_gpu_coredump_copy_to_buffer(struct i915_gpu_coredump *error,
 | 
			
		||||
				 char *buf, loff_t offset, size_t count);
 | 
			
		||||
 | 
			
		||||
void __i915_gpu_state_free(struct kref *kref);
 | 
			
		||||
static inline void i915_gpu_state_put(struct i915_gpu_state *gpu)
 | 
			
		||||
void __i915_gpu_coredump_free(struct kref *kref);
 | 
			
		||||
static inline void i915_gpu_coredump_put(struct i915_gpu_coredump *gpu)
 | 
			
		||||
{
 | 
			
		||||
	if (gpu)
 | 
			
		||||
		kref_put(&gpu->ref, __i915_gpu_state_free);
 | 
			
		||||
		kref_put(&gpu->ref, __i915_gpu_coredump_free);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct i915_gpu_state *i915_first_error_state(struct drm_i915_private *i915);
 | 
			
		||||
struct i915_gpu_coredump *i915_first_error_state(struct drm_i915_private *i915);
 | 
			
		||||
void i915_reset_error_state(struct drm_i915_private *i915);
 | 
			
		||||
void i915_disable_error_state(struct drm_i915_private *i915, int err);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -234,7 +275,56 @@ static inline void i915_capture_error_state(struct drm_i915_private *dev_priv,
 | 
			
		|||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline struct i915_gpu_state *
 | 
			
		||||
static inline struct i915_gpu_coredump *
 | 
			
		||||
i915_gpu_coredump_alloc(struct drm_i915_private *i915, gfp_t gfp)
 | 
			
		||||
{
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline struct intel_gt_coredump *
 | 
			
		||||
intel_gt_coredump_alloc(struct intel_gt *gt, gfp_t gfp)
 | 
			
		||||
{
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline struct intel_engine_coredump *
 | 
			
		||||
intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp)
 | 
			
		||||
{
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline struct intel_engine_capture_vma *
 | 
			
		||||
intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
 | 
			
		||||
				  struct i915_request *rq,
 | 
			
		||||
				  gfp_t gfp)
 | 
			
		||||
{
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
intel_engine_coredump_add_vma(struct intel_engine_coredump *ee,
 | 
			
		||||
			      struct intel_engine_capture_vma *capture,
 | 
			
		||||
			      struct i915_vma_compress *compress)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline struct i915_vma_compress *
 | 
			
		||||
i915_vma_compress_prepare(struct intel_gt_coredump *gt)
 | 
			
		||||
{
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void i915_vma_compress_prepare(struct i915_vma_compress *compress)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
i915_error_state_store(struct drm_i915_private *i915,
 | 
			
		||||
		       struct i915_gpu_coredump *error)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline struct i915_gpu_coredump *
 | 
			
		||||
i915_first_error_state(struct drm_i915_private *i915)
 | 
			
		||||
{
 | 
			
		||||
	return ERR_PTR(-ENODEV);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -498,15 +498,15 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
 | 
			
		|||
 | 
			
		||||
	struct device *kdev = kobj_to_dev(kobj);
 | 
			
		||||
	struct drm_i915_private *i915 = kdev_minor_to_i915(kdev);
 | 
			
		||||
	struct i915_gpu_state *gpu;
 | 
			
		||||
	struct i915_gpu_coredump *gpu;
 | 
			
		||||
	ssize_t ret;
 | 
			
		||||
 | 
			
		||||
	gpu = i915_first_error_state(i915);
 | 
			
		||||
	if (IS_ERR(gpu)) {
 | 
			
		||||
		ret = PTR_ERR(gpu);
 | 
			
		||||
	} else if (gpu) {
 | 
			
		||||
		ret = i915_gpu_state_copy_to_buffer(gpu, buf, off, count);
 | 
			
		||||
		i915_gpu_state_put(gpu);
 | 
			
		||||
		ret = i915_gpu_coredump_copy_to_buffer(gpu, buf, off, count);
 | 
			
		||||
		i915_gpu_coredump_put(gpu);
 | 
			
		||||
	} else {
 | 
			
		||||
		const char *str = "No error state collected\n";
 | 
			
		||||
		size_t len = strlen(str);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue