mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 09:50:04 +00:00
0881954965
Introduce a mutex to start locking the HW contexts independently of struct_mutex, with a view to reducing the coarse struct_mutex. The intel_context.pin_mutex is used to guard the transition to and from being pinned on the gpu, and so is required before starting to build any request. The intel_context will then remain pinned until the request completes, but the mutex can be released immediately unpin completion of pinning the context. A slight variant of the above is used by per-context sseu that wants to inspect the pinned status of the context, and requires that it remains stable (either !pinned or pinned) across its operation. By using the pin_mutex to serialise operations while pin_count==0, we can take that pin_mutex for stabilise the boolean pin status. v2: for Tvrtko! * Improved commit message. * Dropped _gpu suffix from gen8_modify_rpcs_gpu. v3: Repair the locking for sseu selftests Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190308132522.21573-7-chris@chris-wilson.co.uk
69 lines
1.4 KiB
C
69 lines
1.4 KiB
C
/*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Copyright © 2019 Intel Corporation
|
|
*/
|
|
|
|
#ifndef __INTEL_CONTEXT_TYPES__
|
|
#define __INTEL_CONTEXT_TYPES__
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/rbtree.h>
|
|
#include <linux/types.h>
|
|
|
|
#include "i915_active_types.h"
|
|
|
|
struct i915_gem_context;
|
|
struct i915_vma;
|
|
struct intel_context;
|
|
struct intel_ring;
|
|
|
|
struct intel_context_ops {
|
|
int (*pin)(struct intel_context *ce);
|
|
void (*unpin)(struct intel_context *ce);
|
|
void (*destroy)(struct intel_context *ce);
|
|
};
|
|
|
|
/*
|
|
* Powergating configuration for a particular (context,engine).
|
|
*/
|
|
struct intel_sseu {
|
|
u8 slice_mask;
|
|
u8 subslice_mask;
|
|
u8 min_eus_per_subslice;
|
|
u8 max_eus_per_subslice;
|
|
};
|
|
|
|
struct intel_context {
|
|
struct i915_gem_context *gem_context;
|
|
struct intel_engine_cs *engine;
|
|
struct intel_engine_cs *active;
|
|
|
|
struct list_head active_link;
|
|
struct list_head signal_link;
|
|
struct list_head signals;
|
|
|
|
struct i915_vma *state;
|
|
struct intel_ring *ring;
|
|
|
|
u32 *lrc_reg_state;
|
|
u64 lrc_desc;
|
|
|
|
atomic_t pin_count;
|
|
struct mutex pin_mutex; /* guards pinning and associated on-gpuing */
|
|
|
|
/**
|
|
* active_tracker: Active tracker for the external rq activity
|
|
* on this intel_context object.
|
|
*/
|
|
struct i915_active_request active_tracker;
|
|
|
|
const struct intel_context_ops *ops;
|
|
struct rb_node node;
|
|
|
|
/** sseu: Control eu/slice partitioning */
|
|
struct intel_sseu sseu;
|
|
};
|
|
|
|
#endif /* __INTEL_CONTEXT_TYPES__ */
|