aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/ttm/ttm_bo_driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/ttm/ttm_bo_driver.h')
-rw-r--r--include/drm/ttm/ttm_bo_driver.h57
1 files changed, 33 insertions, 24 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 6b9db917e717..0ea602da43e7 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -176,8 +176,6 @@ struct ttm_tt {
176 176
177#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 177#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
178#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ 178#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
179#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
180 before kernel access. */
181#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ 179#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
182 180
183/** 181/**
@@ -189,13 +187,6 @@ struct ttm_tt {
189 * managed by this memory type. 187 * managed by this memory type.
190 * @gpu_offset: If used, the GPU offset of the first managed page of 188 * @gpu_offset: If used, the GPU offset of the first managed page of
191 * fixed memory or the first managed location in an aperture. 189 * fixed memory or the first managed location in an aperture.
192 * @io_offset: The io_offset of the first managed page of IO memory or
193 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
194 * memory, this should be set to NULL.
195 * @io_size: The size of a managed IO region (fixed memory or aperture).
196 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
197 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
198 * @io_addr should be set to NULL.
199 * @size: Size of the managed region. 190 * @size: Size of the managed region.
200 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, 191 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
201 * as defined in ttm_placement_common.h 192 * as defined in ttm_placement_common.h
@@ -221,9 +212,6 @@ struct ttm_mem_type_manager {
221 bool use_type; 212 bool use_type;
222 uint32_t flags; 213 uint32_t flags;
223 unsigned long gpu_offset; 214 unsigned long gpu_offset;
224 unsigned long io_offset;
225 unsigned long io_size;
226 void *io_addr;
227 uint64_t size; 215 uint64_t size;
228 uint32_t available_caching; 216 uint32_t available_caching;
229 uint32_t default_caching; 217 uint32_t default_caching;
@@ -311,7 +299,8 @@ struct ttm_bo_driver {
311 */ 299 */
312 int (*move) (struct ttm_buffer_object *bo, 300 int (*move) (struct ttm_buffer_object *bo,
313 bool evict, bool interruptible, 301 bool evict, bool interruptible,
314 bool no_wait, struct ttm_mem_reg *new_mem); 302 bool no_wait_reserve, bool no_wait_gpu,
303 struct ttm_mem_reg *new_mem);
315 304
316 /** 305 /**
317 * struct ttm_bo_driver_member verify_access 306 * struct ttm_bo_driver_member verify_access
@@ -351,12 +340,21 @@ struct ttm_bo_driver {
351 struct ttm_mem_reg *new_mem); 340 struct ttm_mem_reg *new_mem);
352 /* notify the driver we are taking a fault on this BO 341 /* notify the driver we are taking a fault on this BO
353 * and have reserved it */ 342 * and have reserved it */
354 void (*fault_reserve_notify)(struct ttm_buffer_object *bo); 343 int (*fault_reserve_notify)(struct ttm_buffer_object *bo);
355 344
356 /** 345 /**
357 * notify the driver that we're about to swap out this bo 346 * notify the driver that we're about to swap out this bo
358 */ 347 */
359 void (*swap_notify) (struct ttm_buffer_object *bo); 348 void (*swap_notify) (struct ttm_buffer_object *bo);
349
350 /**
351 * Driver callback on when mapping io memory (for bo_move_memcpy
352 * for instance). TTM will take care to call io_mem_free whenever
353 * the mapping is not use anymore. io_mem_reserve & io_mem_free
354 * are balanced.
355 */
356 int (*io_mem_reserve)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
357 void (*io_mem_free)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
360}; 358};
361 359
362/** 360/**
@@ -633,7 +631,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
633 * @proposed_placement: Proposed new placement for the buffer object. 631 * @proposed_placement: Proposed new placement for the buffer object.
634 * @mem: A struct ttm_mem_reg. 632 * @mem: A struct ttm_mem_reg.
635 * @interruptible: Sleep interruptible when sliping. 633 * @interruptible: Sleep interruptible when sliping.
636 * @no_wait: Don't sleep waiting for space to become available. 634 * @no_wait_reserve: Return immediately if other buffers are busy.
635 * @no_wait_gpu: Return immediately if the GPU is busy.
637 * 636 *
638 * Allocate memory space for the buffer object pointed to by @bo, using 637 * Allocate memory space for the buffer object pointed to by @bo, using
639 * the placement flags in @mem, potentially evicting other idle buffer objects. 638 * the placement flags in @mem, potentially evicting other idle buffer objects.
@@ -647,7 +646,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
647extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, 646extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
648 struct ttm_placement *placement, 647 struct ttm_placement *placement,
649 struct ttm_mem_reg *mem, 648 struct ttm_mem_reg *mem,
650 bool interruptible, bool no_wait); 649 bool interruptible,
650 bool no_wait_reserve, bool no_wait_gpu);
651/** 651/**
652 * ttm_bo_wait_for_cpu 652 * ttm_bo_wait_for_cpu
653 * 653 *
@@ -682,6 +682,11 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
682 unsigned long *bus_offset, 682 unsigned long *bus_offset,
683 unsigned long *bus_size); 683 unsigned long *bus_size);
684 684
685extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
686 struct ttm_mem_reg *mem);
687extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
688 struct ttm_mem_reg *mem);
689
685extern void ttm_bo_global_release(struct ttm_global_reference *ref); 690extern void ttm_bo_global_release(struct ttm_global_reference *ref);
686extern int ttm_bo_global_init(struct ttm_global_reference *ref); 691extern int ttm_bo_global_init(struct ttm_global_reference *ref);
687 692
@@ -798,7 +803,8 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
798 * 803 *
799 * @bo: A pointer to a struct ttm_buffer_object. 804 * @bo: A pointer to a struct ttm_buffer_object.
800 * @evict: 1: This is an eviction. Don't try to pipeline. 805 * @evict: 1: This is an eviction. Don't try to pipeline.
801 * @no_wait: Never sleep, but rather return with -EBUSY. 806 * @no_wait_reserve: Return immediately if other buffers are busy.
807 * @no_wait_gpu: Return immediately if the GPU is busy.
802 * @new_mem: struct ttm_mem_reg indicating where to move. 808 * @new_mem: struct ttm_mem_reg indicating where to move.
803 * 809 *
804 * Optimized move function for a buffer object with both old and 810 * Optimized move function for a buffer object with both old and
@@ -812,15 +818,16 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
812 */ 818 */
813 819
814extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 820extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
815 bool evict, bool no_wait, 821 bool evict, bool no_wait_reserve,
816 struct ttm_mem_reg *new_mem); 822 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
817 823
818/** 824/**
819 * ttm_bo_move_memcpy 825 * ttm_bo_move_memcpy
820 * 826 *
821 * @bo: A pointer to a struct ttm_buffer_object. 827 * @bo: A pointer to a struct ttm_buffer_object.
822 * @evict: 1: This is an eviction. Don't try to pipeline. 828 * @evict: 1: This is an eviction. Don't try to pipeline.
823 * @no_wait: Never sleep, but rather return with -EBUSY. 829 * @no_wait_reserve: Return immediately if other buffers are busy.
830 * @no_wait_gpu: Return immediately if the GPU is busy.
824 * @new_mem: struct ttm_mem_reg indicating where to move. 831 * @new_mem: struct ttm_mem_reg indicating where to move.
825 * 832 *
826 * Fallback move function for a mappable buffer object in mappable memory. 833 * Fallback move function for a mappable buffer object in mappable memory.
@@ -834,8 +841,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
834 */ 841 */
835 842
836extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 843extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
837 bool evict, 844 bool evict, bool no_wait_reserve,
838 bool no_wait, struct ttm_mem_reg *new_mem); 845 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
839 846
840/** 847/**
841 * ttm_bo_free_old_node 848 * ttm_bo_free_old_node
@@ -854,7 +861,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
854 * @sync_obj_arg: An argument to pass to the sync object idle / wait 861 * @sync_obj_arg: An argument to pass to the sync object idle / wait
855 * functions. 862 * functions.
856 * @evict: This is an evict move. Don't return until the buffer is idle. 863 * @evict: This is an evict move. Don't return until the buffer is idle.
857 * @no_wait: Never sleep, but rather return with -EBUSY. 864 * @no_wait_reserve: Return immediately if other buffers are busy.
865 * @no_wait_gpu: Return immediately if the GPU is busy.
858 * @new_mem: struct ttm_mem_reg indicating where to move. 866 * @new_mem: struct ttm_mem_reg indicating where to move.
859 * 867 *
860 * Accelerated move function to be called when an accelerated move 868 * Accelerated move function to be called when an accelerated move
@@ -868,7 +876,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
868extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, 876extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
869 void *sync_obj, 877 void *sync_obj,
870 void *sync_obj_arg, 878 void *sync_obj_arg,
871 bool evict, bool no_wait, 879 bool evict, bool no_wait_reserve,
880 bool no_wait_gpu,
872 struct ttm_mem_reg *new_mem); 881 struct ttm_mem_reg *new_mem);
873/** 882/**
874 * ttm_io_prot 883 * ttm_io_prot