diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.h')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 833b172a2c2a..9b7b4fcb047b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | |||
@@ -33,6 +33,67 @@ | |||
33 | 33 | ||
34 | #define AMDGPU_BO_INVALID_OFFSET LONG_MAX | 34 | #define AMDGPU_BO_INVALID_OFFSET LONG_MAX |
35 | 35 | ||
36 | struct amdgpu_bo_va_mapping { | ||
37 | struct list_head list; | ||
38 | struct rb_node rb; | ||
39 | uint64_t start; | ||
40 | uint64_t last; | ||
41 | uint64_t __subtree_last; | ||
42 | uint64_t offset; | ||
43 | uint64_t flags; | ||
44 | }; | ||
45 | |||
46 | /* bo virtual addresses in a specific vm */ | ||
47 | struct amdgpu_bo_va { | ||
48 | /* protected by bo being reserved */ | ||
49 | struct list_head bo_list; | ||
50 | struct dma_fence *last_pt_update; | ||
51 | unsigned ref_count; | ||
52 | |||
53 | /* protected by vm mutex and spinlock */ | ||
54 | struct list_head vm_status; | ||
55 | |||
56 | /* mappings for this bo_va */ | ||
57 | struct list_head invalids; | ||
58 | struct list_head valids; | ||
59 | |||
60 | /* constant after initialization */ | ||
61 | struct amdgpu_vm *vm; | ||
62 | struct amdgpu_bo *bo; | ||
63 | }; | ||
64 | |||
65 | |||
66 | struct amdgpu_bo { | ||
67 | /* Protected by tbo.reserved */ | ||
68 | u32 preferred_domains; | ||
69 | u32 allowed_domains; | ||
70 | struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX + 1]; | ||
71 | struct ttm_placement placement; | ||
72 | struct ttm_buffer_object tbo; | ||
73 | struct ttm_bo_kmap_obj kmap; | ||
74 | u64 flags; | ||
75 | unsigned pin_count; | ||
76 | u64 tiling_flags; | ||
77 | u64 metadata_flags; | ||
78 | void *metadata; | ||
79 | u32 metadata_size; | ||
80 | unsigned prime_shared_count; | ||
81 | /* list of all virtual address to which this bo is associated to */ | ||
82 | struct list_head va; | ||
83 | /* Constant after initialization */ | ||
84 | struct drm_gem_object gem_base; | ||
85 | struct amdgpu_bo *parent; | ||
86 | struct amdgpu_bo *shadow; | ||
87 | |||
88 | struct ttm_bo_kmap_obj dma_buf_vmap; | ||
89 | struct amdgpu_mn *mn; | ||
90 | |||
91 | union { | ||
92 | struct list_head mn_list; | ||
93 | struct list_head shadow_list; | ||
94 | }; | ||
95 | }; | ||
96 | |||
36 | /** | 97 | /** |
37 | * amdgpu_mem_type_to_domain - return domain corresponding to mem_type | 98 | * amdgpu_mem_type_to_domain - return domain corresponding to mem_type |
38 | * @mem_type: ttm memory type | 99 | * @mem_type: ttm memory type |
@@ -132,6 +193,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev, | |||
132 | bool kernel, u32 domain, u64 flags, | 193 | bool kernel, u32 domain, u64 flags, |
133 | struct sg_table *sg, | 194 | struct sg_table *sg, |
134 | struct reservation_object *resv, | 195 | struct reservation_object *resv, |
196 | uint64_t init_value, | ||
135 | struct amdgpu_bo **bo_ptr); | 197 | struct amdgpu_bo **bo_ptr); |
136 | int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | 198 | int amdgpu_bo_create_restricted(struct amdgpu_device *adev, |
137 | unsigned long size, int byte_align, | 199 | unsigned long size, int byte_align, |
@@ -139,7 +201,12 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | |||
139 | struct sg_table *sg, | 201 | struct sg_table *sg, |
140 | struct ttm_placement *placement, | 202 | struct ttm_placement *placement, |
141 | struct reservation_object *resv, | 203 | struct reservation_object *resv, |
204 | uint64_t init_value, | ||
142 | struct amdgpu_bo **bo_ptr); | 205 | struct amdgpu_bo **bo_ptr); |
206 | int amdgpu_bo_create_reserved(struct amdgpu_device *adev, | ||
207 | unsigned long size, int align, | ||
208 | u32 domain, struct amdgpu_bo **bo_ptr, | ||
209 | u64 *gpu_addr, void **cpu_addr); | ||
143 | int amdgpu_bo_create_kernel(struct amdgpu_device *adev, | 210 | int amdgpu_bo_create_kernel(struct amdgpu_device *adev, |
144 | unsigned long size, int align, | 211 | unsigned long size, int align, |
145 | u32 domain, struct amdgpu_bo **bo_ptr, | 212 | u32 domain, struct amdgpu_bo **bo_ptr, |
@@ -147,6 +214,7 @@ int amdgpu_bo_create_kernel(struct amdgpu_device *adev, | |||
147 | void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr, | 214 | void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr, |
148 | void **cpu_addr); | 215 | void **cpu_addr); |
149 | int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr); | 216 | int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr); |
217 | void *amdgpu_bo_kptr(struct amdgpu_bo *bo); | ||
150 | void amdgpu_bo_kunmap(struct amdgpu_bo *bo); | 218 | void amdgpu_bo_kunmap(struct amdgpu_bo *bo); |
151 | struct amdgpu_bo *amdgpu_bo_ref(struct amdgpu_bo *bo); | 219 | struct amdgpu_bo *amdgpu_bo_ref(struct amdgpu_bo *bo); |
152 | void amdgpu_bo_unref(struct amdgpu_bo **bo); | 220 | void amdgpu_bo_unref(struct amdgpu_bo **bo); |