summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gem/i915_gem_vm_bind.h
blob: 642cdb559f17644bc5411d211b13db1bcd14e9b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2022 Intel Corporation
 */

#ifndef __I915_GEM_VM_BIND_H
#define __I915_GEM_VM_BIND_H

#include "i915_drv.h"

#define assert_vm_bind_held(vm)   lockdep_assert_held(&(vm)->vm_bind_lock)

static inline void i915_gem_vm_bind_lock(struct i915_address_space *vm)
{
	mutex_lock(&vm->vm_bind_lock);
}

static inline int
i915_gem_vm_bind_lock_interruptible(struct i915_address_space *vm)
{
	return mutex_lock_interruptible(&vm->vm_bind_lock);
}

static inline void i915_gem_vm_bind_unlock(struct i915_address_space *vm)
{
	mutex_unlock(&vm->vm_bind_lock);
}

struct i915_vma *
i915_gem_vm_bind_lookup_vma(struct i915_address_space *vm, u64 va);
void i915_gem_vm_bind_remove(struct i915_vma *vma, bool release_obj);
int i915_gem_vm_bind_obj(struct i915_address_space *vm,
			 struct drm_i915_gem_vm_bind *va,
			 struct drm_file *file);
int i915_gem_vm_unbind_obj(struct i915_address_space *vm,
			   struct drm_i915_gem_vm_unbind *va);

#endif /* __I915_GEM_VM_BIND_H */