drm/ttm: ttm_fault callback to allow driver to handle bo placement V6
[safe/jmp/linux-2.6] / include / drm / ttm / ttm_bo_api.h
index 4fd4985..3e273e0 100644 (file)
@@ -66,6 +66,26 @@ struct ttm_placement {
        const uint32_t  *busy_placement;
 };
 
+/**
+ * struct ttm_bus_placement
+ *
+ * @addr:              mapped virtual address
+ * @base:              bus base address
+ * @is_iomem:          is this io memory ?
+ * @size:              size in byte
+ * @offset:            offset from the base address
+ *
+ * Structure indicating the bus placement of an object.
+ */
+struct ttm_bus_placement {
+       void            *addr;
+       unsigned long   base;
+       unsigned long   size;
+       unsigned long   offset;
+       bool            is_iomem;
+       bool            io_reserved;
+};
+
 
 /**
  * struct ttm_mem_reg
@@ -75,6 +95,7 @@ struct ttm_placement {
  * @num_pages: Actual size of memory region in pages.
  * @page_alignment: Page alignment.
  * @placement: Placement flags.
+ * @bus: Placement on io bus accessible to the CPU
  *
  * Structure indicating the placement and space resources used by a
  * buffer object.
@@ -87,6 +108,7 @@ struct ttm_mem_reg {
        uint32_t page_alignment;
        uint32_t mem_type;
        uint32_t placement;
+       struct ttm_bus_placement bus;
 };
 
 /**
@@ -274,6 +296,7 @@ struct ttm_bo_kmap_obj {
                ttm_bo_map_kmap         = 3,
                ttm_bo_map_premapped    = 4 | TTM_BO_MAP_IOMEM_MASK,
        } bo_kmap_type;
+       struct ttm_buffer_object *bo;
 };
 
 /**
@@ -308,12 +331,13 @@ ttm_bo_reference(struct ttm_buffer_object *bo)
 extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
                       bool interruptible, bool no_wait);
 /**
- * ttm_buffer_object_validate
+ * ttm_bo_validate
  *
  * @bo: The buffer object.
  * @placement: Proposed placement for the buffer object.
  * @interruptible: Sleep interruptible if sleeping.
- * @no_wait: Return immediately if the buffer is busy.
+ * @no_wait_reserve: Return immediately if other buffers are busy.
+ * @no_wait_gpu: Return immediately if the GPU is busy.
  *
  * Changes placement and caching policy of the buffer object
  * according proposed placement.
@@ -323,9 +347,10 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
  * -EBUSY if no_wait is true and buffer busy.
  * -ERESTARTSYS if interrupted by a signal.
  */
-extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo,
-                                       struct ttm_placement *placement,
-                                       bool interruptible, bool no_wait);
+extern int ttm_bo_validate(struct ttm_buffer_object *bo,
+                               struct ttm_placement *placement,
+                               bool interruptible, bool no_wait_reserve,
+                               bool no_wait_gpu);
 
 /**
  * ttm_bo_unref
@@ -362,7 +387,7 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
 extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
 
 /**
- * ttm_buffer_object_init
+ * ttm_bo_init
  *
  * @bdev: Pointer to a ttm_bo_device struct.
  * @bo: Pointer to a ttm_buffer_object to be initialized.
@@ -393,17 +418,17 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
  * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources.
  */
 
-extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
-                                 struct ttm_buffer_object *bo,
-                                 unsigned long size,
-                                 enum ttm_bo_type type,
-                                 uint32_t flags,
-                                 uint32_t page_alignment,
-                                 unsigned long buffer_start,
-                                 bool interrubtible,
-                                 struct file *persistant_swap_storage,
-                                 size_t acc_size,
-                                 void (*destroy) (struct ttm_buffer_object *));
+extern int ttm_bo_init(struct ttm_bo_device *bdev,
+                       struct ttm_buffer_object *bo,
+                       unsigned long size,
+                       enum ttm_bo_type type,
+                       struct ttm_placement *placement,
+                       uint32_t page_alignment,
+                       unsigned long buffer_start,
+                       bool interrubtible,
+                       struct file *persistant_swap_storage,
+                       size_t acc_size,
+                       void (*destroy) (struct ttm_buffer_object *));
 /**
  * ttm_bo_synccpu_object_init
  *
@@ -424,40 +449,37 @@ extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
  * GEM user interface.
  * @p_bo: On successful completion *p_bo points to the created object.
  *
- * This function allocates a ttm_buffer_object, and then calls
- * ttm_buffer_object_init on that object.
- * The destroy function is set to kfree().
+ * This function allocates a ttm_buffer_object, and then calls ttm_bo_init
+ * on that object. The destroy function is set to kfree().
  * Returns
  * -ENOMEM: Out of memory.
  * -EINVAL: Invalid placement flags.
  * -ERESTARTSYS: Interrupted by signal while waiting for resources.
  */
 
-extern int ttm_buffer_object_create(struct ttm_bo_device *bdev,
-                                   unsigned long size,
-                                   enum ttm_bo_type type,
-                                   uint32_t flags,
-                                   uint32_t page_alignment,
-                                   unsigned long buffer_start,
-                                   bool interruptible,
-                                   struct file *persistant_swap_storage,
-                                   struct ttm_buffer_object **p_bo);
+extern int ttm_bo_create(struct ttm_bo_device *bdev,
+                               unsigned long size,
+                               enum ttm_bo_type type,
+                               struct ttm_placement *placement,
+                               uint32_t page_alignment,
+                               unsigned long buffer_start,
+                               bool interruptible,
+                               struct file *persistant_swap_storage,
+                               struct ttm_buffer_object **p_bo);
 
 /**
  * ttm_bo_check_placement
  *
- * @bo: the buffer object.
- * @set_flags: placement flags to set.
- * @clr_flags: placement flags to clear.
+ * @bo:                the buffer object.
+ * @placement: placements
  *
  * Performs minimal validity checking on an intended change of
  * placement flags.
  * Returns
  * -EINVAL: Intended change is invalid or not allowed.
  */
-
 extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
-                                 uint32_t set_flags, uint32_t clr_flags);
+                                       struct ttm_placement *placement);
 
 /**
  * ttm_bo_init_mm