1/* 2 * SPDX-License-Identifier: MIT 3 * 4 * Copyright © 2019 Intel Corporation 5 */ 6 7#ifndef __INTEL_CONTEXT_TYPES__ 8#define __INTEL_CONTEXT_TYPES__ 9 10#include <linux/kref.h> 11#include <linux/list.h> 12#include <linux/mutex.h> 13#include <linux/types.h> 14 15#include "i915_active_types.h" 16#include "intel_engine_types.h" 17#include "intel_sseu.h" 18 19struct i915_gem_context; 20struct i915_vma; 21struct intel_context; 22struct intel_ring; 23 24struct intel_context_ops { 25 int (*pin)(struct intel_context *ce); 26 void (*unpin)(struct intel_context *ce); 27 28 void (*enter)(struct intel_context *ce); 29 void (*exit)(struct intel_context *ce); 30 31 void (*reset)(struct intel_context *ce); 32 void (*destroy)(struct kref *kref); 33}; 34 35struct intel_context { 36 struct kref ref; 37 38 struct i915_gem_context *gem_context; 39 struct intel_engine_cs *engine; 40 struct intel_engine_cs *inflight; 41 42 struct list_head signal_link; 43 struct list_head signals; 44 45 struct i915_vma *state; 46 struct intel_ring *ring; 47 48 u32 *lrc_reg_state; 49 u64 lrc_desc; 50 51 unsigned int active_count; /* notionally protected by timeline->mutex */ 52 53 atomic_t pin_count; 54 struct mutex pin_mutex; /* guards pinning and associated on-gpuing */ 55 56 /** 57 * active: Active tracker for the rq activity (inc. external) on this 58 * intel_context object. 59 */ 60 struct i915_active active; 61 62 const struct intel_context_ops *ops; 63 64 /** sseu: Control eu/slice partitioning */ 65 struct intel_sseu sseu; 66}; 67 68#endif /* __INTEL_CONTEXT_TYPES__ */ 69