xref: /linux/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h (revision 9ad0d033ed4be2370bfff6589fc52ab220e7c514)
1d38ceaf9SAlex Deucher /*
2d38ceaf9SAlex Deucher  * Copyright 2008 Advanced Micro Devices, Inc.
3d38ceaf9SAlex Deucher  * Copyright 2008 Red Hat Inc.
4d38ceaf9SAlex Deucher  * Copyright 2009 Jerome Glisse.
5d38ceaf9SAlex Deucher  *
6d38ceaf9SAlex Deucher  * Permission is hereby granted, free of charge, to any person obtaining a
7d38ceaf9SAlex Deucher  * copy of this software and associated documentation files (the "Software"),
8d38ceaf9SAlex Deucher  * to deal in the Software without restriction, including without limitation
9d38ceaf9SAlex Deucher  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10d38ceaf9SAlex Deucher  * and/or sell copies of the Software, and to permit persons to whom the
11d38ceaf9SAlex Deucher  * Software is furnished to do so, subject to the following conditions:
12d38ceaf9SAlex Deucher  *
13d38ceaf9SAlex Deucher  * The above copyright notice and this permission notice shall be included in
14d38ceaf9SAlex Deucher  * all copies or substantial portions of the Software.
15d38ceaf9SAlex Deucher  *
16d38ceaf9SAlex Deucher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17d38ceaf9SAlex Deucher  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18d38ceaf9SAlex Deucher  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19d38ceaf9SAlex Deucher  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20d38ceaf9SAlex Deucher  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21d38ceaf9SAlex Deucher  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22d38ceaf9SAlex Deucher  * OTHER DEALINGS IN THE SOFTWARE.
23d38ceaf9SAlex Deucher  *
24d38ceaf9SAlex Deucher  * Authors: Dave Airlie
25d38ceaf9SAlex Deucher  *          Alex Deucher
26d38ceaf9SAlex Deucher  *          Jerome Glisse
27d38ceaf9SAlex Deucher  */
28d38ceaf9SAlex Deucher #ifndef __AMDGPU_OBJECT_H__
29d38ceaf9SAlex Deucher #define __AMDGPU_OBJECT_H__
30d38ceaf9SAlex Deucher 
31d38ceaf9SAlex Deucher #include <drm/amdgpu_drm.h>
32d38ceaf9SAlex Deucher #include "amdgpu.h"
3362914a99SJason Gunthorpe #ifdef CONFIG_MMU_NOTIFIER
3462914a99SJason Gunthorpe #include <linux/mmu_notifier.h>
3562914a99SJason Gunthorpe #endif
36d38ceaf9SAlex Deucher 
379702d40dSChristian König #define AMDGPU_BO_INVALID_OFFSET	LONG_MAX
38bf314ca3SChristian König #define AMDGPU_BO_MAX_PLACEMENTS	3
399702d40dSChristian König 
40*9ad0d033SNirmoy Das #define to_amdgpu_bo_user(abo) container_of((abo), struct amdgpu_bo_user, bo)
41*9ad0d033SNirmoy Das 
42a906dbb1SChunming Zhou struct amdgpu_bo_param {
43a906dbb1SChunming Zhou 	unsigned long			size;
44a906dbb1SChunming Zhou 	int				byte_align;
459fd5543eSNirmoy Das 	u32				bo_ptr_size;
46a906dbb1SChunming Zhou 	u32				domain;
47aa2b2e28SChunming Zhou 	u32				preferred_domain;
48a906dbb1SChunming Zhou 	u64				flags;
49a906dbb1SChunming Zhou 	enum ttm_bo_type		type;
50061468c4SChristian König 	bool				no_wait_gpu;
5152791eeeSChristian König 	struct dma_resv	*resv;
52a906dbb1SChunming Zhou };
53a906dbb1SChunming Zhou 
54ec681545SChristian König /* bo virtual addresses in a vm */
559124a398SChristian König struct amdgpu_bo_va_mapping {
56aebc5e6fSChristian König 	struct amdgpu_bo_va		*bo_va;
579124a398SChristian König 	struct list_head		list;
589124a398SChristian König 	struct rb_node			rb;
599124a398SChristian König 	uint64_t			start;
609124a398SChristian König 	uint64_t			last;
619124a398SChristian König 	uint64_t			__subtree_last;
629124a398SChristian König 	uint64_t			offset;
639124a398SChristian König 	uint64_t			flags;
649124a398SChristian König };
659124a398SChristian König 
66ec681545SChristian König /* User space allocated BO in a VM */
679124a398SChristian König struct amdgpu_bo_va {
68ec681545SChristian König 	struct amdgpu_vm_bo_base	base;
69ec681545SChristian König 
709124a398SChristian König 	/* protected by bo being reserved */
719124a398SChristian König 	unsigned			ref_count;
729124a398SChristian König 
7300b5cc83SChristian König 	/* all other members protected by the VM PD being reserved */
7400b5cc83SChristian König 	struct dma_fence	        *last_pt_update;
7500b5cc83SChristian König 
769124a398SChristian König 	/* mappings for this bo_va */
779124a398SChristian König 	struct list_head		invalids;
789124a398SChristian König 	struct list_head		valids;
79cb7b6ec2SChristian König 
80cb7b6ec2SChristian König 	/* If the mappings are cleared or filled */
81cb7b6ec2SChristian König 	bool				cleared;
82df399b06Sshaoyunl 
83df399b06Sshaoyunl 	bool				is_xgmi;
849124a398SChristian König };
859124a398SChristian König 
869124a398SChristian König struct amdgpu_bo {
879124a398SChristian König 	/* Protected by tbo.reserved */
886d7d9c5aSKent Russell 	u32				preferred_domains;
899124a398SChristian König 	u32				allowed_domains;
90bf314ca3SChristian König 	struct ttm_place		placements[AMDGPU_BO_MAX_PLACEMENTS];
919124a398SChristian König 	struct ttm_placement		placement;
929124a398SChristian König 	struct ttm_buffer_object	tbo;
939124a398SChristian König 	struct ttm_bo_kmap_obj		kmap;
949124a398SChristian König 	u64				flags;
959124a398SChristian König 	u64				tiling_flags;
969124a398SChristian König 	u64				metadata_flags;
979124a398SChristian König 	void				*metadata;
989124a398SChristian König 	u32				metadata_size;
999124a398SChristian König 	unsigned			prime_shared_count;
100646b9025SChristian König 	/* per VM structure for page tables and with virtual addresses */
101646b9025SChristian König 	struct amdgpu_vm_bo_base	*vm_bo;
1029124a398SChristian König 	/* Constant after initialization */
1039124a398SChristian König 	struct amdgpu_bo		*parent;
1049124a398SChristian König 	struct amdgpu_bo		*shadow;
1059124a398SChristian König 
106ed5b89c6SChristian König 
10762914a99SJason Gunthorpe 
10862914a99SJason Gunthorpe #ifdef CONFIG_MMU_NOTIFIER
10962914a99SJason Gunthorpe 	struct mmu_interval_notifier	notifier;
11062914a99SJason Gunthorpe #endif
11162914a99SJason Gunthorpe 
1129124a398SChristian König 	struct list_head		shadow_list;
113a46a2cd1SFelix Kuehling 
114a46a2cd1SFelix Kuehling 	struct kgd_mem                  *kfd_bo;
115ed5b89c6SChristian König };
1169124a398SChristian König 
117*9ad0d033SNirmoy Das struct amdgpu_bo_user {
118*9ad0d033SNirmoy Das 	struct amdgpu_bo		bo;
119*9ad0d033SNirmoy Das 	u64				tiling_flags;
120*9ad0d033SNirmoy Das 	u64				metadata_flags;
121*9ad0d033SNirmoy Das 	void				*metadata;
122*9ad0d033SNirmoy Das 	u32				metadata_size;
123*9ad0d033SNirmoy Das 
124*9ad0d033SNirmoy Das };
125*9ad0d033SNirmoy Das 
126b82485fdSAndres Rodriguez static inline struct amdgpu_bo *ttm_to_amdgpu_bo(struct ttm_buffer_object *tbo)
127b82485fdSAndres Rodriguez {
128b82485fdSAndres Rodriguez 	return container_of(tbo, struct amdgpu_bo, tbo);
129b82485fdSAndres Rodriguez }
130b82485fdSAndres Rodriguez 
131d38ceaf9SAlex Deucher /**
132d38ceaf9SAlex Deucher  * amdgpu_mem_type_to_domain - return domain corresponding to mem_type
133d38ceaf9SAlex Deucher  * @mem_type:	ttm memory type
134d38ceaf9SAlex Deucher  *
135d38ceaf9SAlex Deucher  * Returns corresponding domain of the ttm mem_type
136d38ceaf9SAlex Deucher  */
137d38ceaf9SAlex Deucher static inline unsigned amdgpu_mem_type_to_domain(u32 mem_type)
138d38ceaf9SAlex Deucher {
139d38ceaf9SAlex Deucher 	switch (mem_type) {
140d38ceaf9SAlex Deucher 	case TTM_PL_VRAM:
141d38ceaf9SAlex Deucher 		return AMDGPU_GEM_DOMAIN_VRAM;
142d38ceaf9SAlex Deucher 	case TTM_PL_TT:
143d38ceaf9SAlex Deucher 		return AMDGPU_GEM_DOMAIN_GTT;
144d38ceaf9SAlex Deucher 	case TTM_PL_SYSTEM:
145d38ceaf9SAlex Deucher 		return AMDGPU_GEM_DOMAIN_CPU;
146d38ceaf9SAlex Deucher 	case AMDGPU_PL_GDS:
147d38ceaf9SAlex Deucher 		return AMDGPU_GEM_DOMAIN_GDS;
148d38ceaf9SAlex Deucher 	case AMDGPU_PL_GWS:
149d38ceaf9SAlex Deucher 		return AMDGPU_GEM_DOMAIN_GWS;
150d38ceaf9SAlex Deucher 	case AMDGPU_PL_OA:
151d38ceaf9SAlex Deucher 		return AMDGPU_GEM_DOMAIN_OA;
152d38ceaf9SAlex Deucher 	default:
153d38ceaf9SAlex Deucher 		break;
154d38ceaf9SAlex Deucher 	}
155d38ceaf9SAlex Deucher 	return 0;
156d38ceaf9SAlex Deucher }
157d38ceaf9SAlex Deucher 
158d38ceaf9SAlex Deucher /**
159d38ceaf9SAlex Deucher  * amdgpu_bo_reserve - reserve bo
160d38ceaf9SAlex Deucher  * @bo:		bo structure
161d38ceaf9SAlex Deucher  * @no_intr:	don't return -ERESTARTSYS on pending signal
162d38ceaf9SAlex Deucher  *
163d38ceaf9SAlex Deucher  * Returns:
164d38ceaf9SAlex Deucher  * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
165d38ceaf9SAlex Deucher  * a signal. Release all buffer reservations and return to user-space.
166d38ceaf9SAlex Deucher  */
167d38ceaf9SAlex Deucher static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
168d38ceaf9SAlex Deucher {
169a7d64de6SChristian König 	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
170d38ceaf9SAlex Deucher 	int r;
171d38ceaf9SAlex Deucher 
17246bca88bSDave Airlie 	r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
173d38ceaf9SAlex Deucher 	if (unlikely(r != 0)) {
174d38ceaf9SAlex Deucher 		if (r != -ERESTARTSYS)
175a7d64de6SChristian König 			dev_err(adev->dev, "%p reserve failed\n", bo);
176d38ceaf9SAlex Deucher 		return r;
177d38ceaf9SAlex Deucher 	}
178d38ceaf9SAlex Deucher 	return 0;
179d38ceaf9SAlex Deucher }
180d38ceaf9SAlex Deucher 
181d38ceaf9SAlex Deucher static inline void amdgpu_bo_unreserve(struct amdgpu_bo *bo)
182d38ceaf9SAlex Deucher {
183d38ceaf9SAlex Deucher 	ttm_bo_unreserve(&bo->tbo);
184d38ceaf9SAlex Deucher }
185d38ceaf9SAlex Deucher 
186d38ceaf9SAlex Deucher static inline unsigned long amdgpu_bo_size(struct amdgpu_bo *bo)
187d38ceaf9SAlex Deucher {
188e11bfb99SChristian König 	return bo->tbo.base.size;
189d38ceaf9SAlex Deucher }
190d38ceaf9SAlex Deucher 
191d38ceaf9SAlex Deucher static inline unsigned amdgpu_bo_ngpu_pages(struct amdgpu_bo *bo)
192d38ceaf9SAlex Deucher {
193e11bfb99SChristian König 	return bo->tbo.base.size / AMDGPU_GPU_PAGE_SIZE;
194d38ceaf9SAlex Deucher }
195d38ceaf9SAlex Deucher 
196d38ceaf9SAlex Deucher static inline unsigned amdgpu_bo_gpu_page_alignment(struct amdgpu_bo *bo)
197d38ceaf9SAlex Deucher {
198d38ceaf9SAlex Deucher 	return (bo->tbo.mem.page_alignment << PAGE_SHIFT) / AMDGPU_GPU_PAGE_SIZE;
199d38ceaf9SAlex Deucher }
200d38ceaf9SAlex Deucher 
201d38ceaf9SAlex Deucher /**
202d38ceaf9SAlex Deucher  * amdgpu_bo_mmap_offset - return mmap offset of bo
203d38ceaf9SAlex Deucher  * @bo:	amdgpu object for which we query the offset
204d38ceaf9SAlex Deucher  *
205d38ceaf9SAlex Deucher  * Returns mmap offset of the object.
206d38ceaf9SAlex Deucher  */
207d38ceaf9SAlex Deucher static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
208d38ceaf9SAlex Deucher {
209b96f3e7cSGerd Hoffmann 	return drm_vma_node_offset_addr(&bo->tbo.base.vma_node);
210d38ceaf9SAlex Deucher }
211d38ceaf9SAlex Deucher 
212b99f3103SNicolai Hähnle /**
2135422a28fSChristian König  * amdgpu_bo_in_cpu_visible_vram - check if BO is (partly) in visible VRAM
2145422a28fSChristian König  */
2155422a28fSChristian König static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
2165422a28fSChristian König {
2175422a28fSChristian König 	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
2185422a28fSChristian König 	unsigned fpfn = adev->gmc.visible_vram_size >> PAGE_SHIFT;
2195422a28fSChristian König 	struct drm_mm_node *node = bo->tbo.mem.mm_node;
2205422a28fSChristian König 	unsigned long pages_left;
2215422a28fSChristian König 
2225422a28fSChristian König 	if (bo->tbo.mem.mem_type != TTM_PL_VRAM)
2235422a28fSChristian König 		return false;
2245422a28fSChristian König 
2255422a28fSChristian König 	for (pages_left = bo->tbo.mem.num_pages; pages_left;
2265422a28fSChristian König 	     pages_left -= node->size, node++)
2275422a28fSChristian König 		if (node->start < fpfn)
2285422a28fSChristian König 			return true;
2295422a28fSChristian König 
2305422a28fSChristian König 	return false;
2315422a28fSChristian König }
2325422a28fSChristian König 
2335422a28fSChristian König /**
234177ae09bSAndres Rodriguez  * amdgpu_bo_explicit_sync - return whether the bo is explicitly synced
235177ae09bSAndres Rodriguez  */
236177ae09bSAndres Rodriguez static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo)
237177ae09bSAndres Rodriguez {
238177ae09bSAndres Rodriguez 	return bo->flags & AMDGPU_GEM_CREATE_EXPLICIT_SYNC;
239177ae09bSAndres Rodriguez }
240177ae09bSAndres Rodriguez 
2414cd24494SAlex Deucher /**
2424cd24494SAlex Deucher  * amdgpu_bo_encrypted - test if the BO is encrypted
2434cd24494SAlex Deucher  * @bo: pointer to a buffer object
2444cd24494SAlex Deucher  *
2454cd24494SAlex Deucher  * Return true if the buffer object is encrypted, false otherwise.
2464cd24494SAlex Deucher  */
2474cd24494SAlex Deucher static inline bool amdgpu_bo_encrypted(struct amdgpu_bo *bo)
2484cd24494SAlex Deucher {
2494cd24494SAlex Deucher 	return bo->flags & AMDGPU_GEM_CREATE_ENCRYPTED;
2504cd24494SAlex Deucher }
2514cd24494SAlex Deucher 
252c704ab18SChristian König bool amdgpu_bo_is_amdgpu_bo(struct ttm_buffer_object *bo);
253c704ab18SChristian König void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain);
254c704ab18SChristian König 
2553216c6b7SChunming Zhou int amdgpu_bo_create(struct amdgpu_device *adev,
2563216c6b7SChunming Zhou 		     struct amdgpu_bo_param *bp,
257d38ceaf9SAlex Deucher 		     struct amdgpu_bo **bo_ptr);
2589d903cbdSChristian König int amdgpu_bo_create_reserved(struct amdgpu_device *adev,
2599d903cbdSChristian König 			      unsigned long size, int align,
2609d903cbdSChristian König 			      u32 domain, struct amdgpu_bo **bo_ptr,
2619d903cbdSChristian König 			      u64 *gpu_addr, void **cpu_addr);
2627c204889SChristian König int amdgpu_bo_create_kernel(struct amdgpu_device *adev,
2637c204889SChristian König 			    unsigned long size, int align,
2647c204889SChristian König 			    u32 domain, struct amdgpu_bo **bo_ptr,
2657c204889SChristian König 			    u64 *gpu_addr, void **cpu_addr);
266de7b45baSChristian König int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
267de7b45baSChristian König 			       uint64_t offset, uint64_t size, uint32_t domain,
268de7b45baSChristian König 			       struct amdgpu_bo **bo_ptr, void **cpu_addr);
269*9ad0d033SNirmoy Das int amdgpu_bo_create_user(struct amdgpu_device *adev,
270*9ad0d033SNirmoy Das 			  struct amdgpu_bo_param *bp,
271*9ad0d033SNirmoy Das 			  struct amdgpu_bo_user **ubo_ptr);
272aa1d562eSJunwei Zhang void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr,
273aa1d562eSJunwei Zhang 			   void **cpu_addr);
274d38ceaf9SAlex Deucher int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr);
275f5e1c740SChristian König void *amdgpu_bo_kptr(struct amdgpu_bo *bo);
276d38ceaf9SAlex Deucher void amdgpu_bo_kunmap(struct amdgpu_bo *bo);
277d38ceaf9SAlex Deucher struct amdgpu_bo *amdgpu_bo_ref(struct amdgpu_bo *bo);
278d38ceaf9SAlex Deucher void amdgpu_bo_unref(struct amdgpu_bo **bo);
2797b7c6c81SJunwei Zhang int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain);
280d38ceaf9SAlex Deucher int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
2817b7c6c81SJunwei Zhang 			     u64 min_offset, u64 max_offset);
2824671078eSChristian König void amdgpu_bo_unpin(struct amdgpu_bo *bo);
283d38ceaf9SAlex Deucher int amdgpu_bo_evict_vram(struct amdgpu_device *adev);
284d38ceaf9SAlex Deucher int amdgpu_bo_init(struct amdgpu_device *adev);
285d38ceaf9SAlex Deucher void amdgpu_bo_fini(struct amdgpu_device *adev);
286d38ceaf9SAlex Deucher int amdgpu_bo_fbdev_mmap(struct amdgpu_bo *bo,
287d38ceaf9SAlex Deucher 				struct vm_area_struct *vma);
288d38ceaf9SAlex Deucher int amdgpu_bo_set_tiling_flags(struct amdgpu_bo *bo, u64 tiling_flags);
289d38ceaf9SAlex Deucher void amdgpu_bo_get_tiling_flags(struct amdgpu_bo *bo, u64 *tiling_flags);
290d38ceaf9SAlex Deucher int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
291d38ceaf9SAlex Deucher 			    uint32_t metadata_size, uint64_t flags);
292d38ceaf9SAlex Deucher int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
293d38ceaf9SAlex Deucher 			   size_t buffer_size, uint32_t *metadata_size,
294d38ceaf9SAlex Deucher 			   uint64_t *flags);
295d38ceaf9SAlex Deucher void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
29666257db7SNicolai Hähnle 			   bool evict,
2972966141aSDave Airlie 			   struct ttm_resource *new_mem);
298ab2f7a5cSFelix Kuehling void amdgpu_bo_release_notify(struct ttm_buffer_object *bo);
299d3ef581aSChristian König vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
300f54d1867SChris Wilson void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
301d38ceaf9SAlex Deucher 		     bool shared);
3029f3cc18dSChristian König int amdgpu_bo_sync_wait_resv(struct amdgpu_device *adev, struct dma_resv *resv,
3039f3cc18dSChristian König 			     enum amdgpu_sync_mode sync_mode, void *owner,
3049f3cc18dSChristian König 			     bool intr);
305e8e32426SFelix Kuehling int amdgpu_bo_sync_wait(struct amdgpu_bo *bo, void *owner, bool intr);
306cdb7e8f2SChristian König u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo);
307b1a8ef95SNirmoy Das u64 amdgpu_bo_gpu_offset_no_check(struct amdgpu_bo *bo);
30882521316SRoger.He int amdgpu_bo_validate(struct amdgpu_bo *bo);
309403009bfSChristian König int amdgpu_bo_restore_shadow(struct amdgpu_bo *shadow,
310403009bfSChristian König 			     struct dma_fence **fence);
31184b74608SDeepak Sharma uint32_t amdgpu_bo_get_preferred_pin_domain(struct amdgpu_device *adev,
31284b74608SDeepak Sharma 					    uint32_t domain);
313d38ceaf9SAlex Deucher 
314d38ceaf9SAlex Deucher /*
315d38ceaf9SAlex Deucher  * sub allocation
316d38ceaf9SAlex Deucher  */
317d38ceaf9SAlex Deucher 
318d38ceaf9SAlex Deucher static inline uint64_t amdgpu_sa_bo_gpu_addr(struct amdgpu_sa_bo *sa_bo)
319d38ceaf9SAlex Deucher {
320d38ceaf9SAlex Deucher 	return sa_bo->manager->gpu_addr + sa_bo->soffset;
321d38ceaf9SAlex Deucher }
322d38ceaf9SAlex Deucher 
323d38ceaf9SAlex Deucher static inline void * amdgpu_sa_bo_cpu_addr(struct amdgpu_sa_bo *sa_bo)
324d38ceaf9SAlex Deucher {
325d38ceaf9SAlex Deucher 	return sa_bo->manager->cpu_ptr + sa_bo->soffset;
326d38ceaf9SAlex Deucher }
327d38ceaf9SAlex Deucher 
328d38ceaf9SAlex Deucher int amdgpu_sa_bo_manager_init(struct amdgpu_device *adev,
329d38ceaf9SAlex Deucher 				     struct amdgpu_sa_manager *sa_manager,
330d38ceaf9SAlex Deucher 				     unsigned size, u32 align, u32 domain);
331d38ceaf9SAlex Deucher void amdgpu_sa_bo_manager_fini(struct amdgpu_device *adev,
332d38ceaf9SAlex Deucher 				      struct amdgpu_sa_manager *sa_manager);
333d38ceaf9SAlex Deucher int amdgpu_sa_bo_manager_start(struct amdgpu_device *adev,
334d38ceaf9SAlex Deucher 				      struct amdgpu_sa_manager *sa_manager);
335bbf0b345SJunwei Zhang int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
336d38ceaf9SAlex Deucher 		     struct amdgpu_sa_bo **sa_bo,
337d38ceaf9SAlex Deucher 		     unsigned size, unsigned align);
338d38ceaf9SAlex Deucher void amdgpu_sa_bo_free(struct amdgpu_device *adev,
339d38ceaf9SAlex Deucher 			      struct amdgpu_sa_bo **sa_bo,
340f54d1867SChris Wilson 			      struct dma_fence *fence);
341d38ceaf9SAlex Deucher #if defined(CONFIG_DEBUG_FS)
342d38ceaf9SAlex Deucher void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
343d38ceaf9SAlex Deucher 					 struct seq_file *m);
344ff72bc40SMihir Bhogilal Patel u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m);
345d38ceaf9SAlex Deucher #endif
34698d28ac2SNirmoy Das void amdgpu_debugfs_sa_init(struct amdgpu_device *adev);
347d38ceaf9SAlex Deucher 
3483d1b8ec7SAndrey Grodzovsky bool amdgpu_bo_support_uswc(u64 bo_flags);
3493d1b8ec7SAndrey Grodzovsky 
350d38ceaf9SAlex Deucher 
351d38ceaf9SAlex Deucher #endif
352