mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
![Matthew Auld](/assets/img/avatar_default.png)
We use some of the lower bits of the retire function pointer for potential flags, which is quite thorny, since the caller needs to remember to give the function the correct alignment with __i915_active_call, otherwise we might incorrectly unpack the pointer and jump to some garbage address later. Instead of all this let's just pass the flags along as a separate parameter. Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Suggested-by: Daniel Vetter <daniel@ffwll.ch> References:ca419f407b
("drm/i915: Fix crash in auto_retire") References:d8e44e4dd2
("drm/i915/overlay: Fix active retire callback alignment") References:fd5f262db1
("drm/i915/selftests: Fix active retire callback alignment") Signed-off-by: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20210504164136.96456-1-matthew.auld@intel.com
49 lines
926 B
C
49 lines
926 B
C
/*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Copyright © 2019 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _I915_ACTIVE_TYPES_H_
|
|
#define _I915_ACTIVE_TYPES_H_
|
|
|
|
#include <linux/atomic.h>
|
|
#include <linux/dma-fence.h>
|
|
#include <linux/llist.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/rbtree.h>
|
|
#include <linux/rcupdate.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
#include "i915_utils.h"
|
|
|
|
struct i915_active_fence {
|
|
struct dma_fence __rcu *fence;
|
|
struct dma_fence_cb cb;
|
|
};
|
|
|
|
struct active_node;
|
|
|
|
struct i915_active {
|
|
atomic_t count;
|
|
struct mutex mutex;
|
|
|
|
spinlock_t tree_lock;
|
|
struct active_node *cache;
|
|
struct rb_root tree;
|
|
|
|
/* Preallocated "exclusive" node */
|
|
struct i915_active_fence excl;
|
|
|
|
unsigned long flags;
|
|
#define I915_ACTIVE_RETIRE_SLEEPS BIT(0)
|
|
|
|
int (*active)(struct i915_active *ref);
|
|
void (*retire)(struct i915_active *ref);
|
|
|
|
struct work_struct work;
|
|
|
|
struct llist_head preallocated_barriers;
|
|
};
|
|
|
|
#endif /* _I915_ACTIVE_TYPES_H_ */
|