mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-17 20:26:49 +00:00
drm/ttm: use an operation ctx for ttm_bo_init_reserved
Instead of specifying if sleeping should be interruptible. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> Tested-by: Michel Dänzer <michel.daenzer@amd.com> Acked-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
19be557010
commit
6fead44a4c
3 changed files with 9 additions and 11 deletions
|
|
@ -327,6 +327,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
|
||||||
uint64_t init_value,
|
uint64_t init_value,
|
||||||
struct amdgpu_bo **bo_ptr)
|
struct amdgpu_bo **bo_ptr)
|
||||||
{
|
{
|
||||||
|
struct ttm_operation_ctx ctx = { !kernel, false };
|
||||||
struct amdgpu_bo *bo;
|
struct amdgpu_bo *bo;
|
||||||
enum ttm_bo_type type;
|
enum ttm_bo_type type;
|
||||||
unsigned long page_align;
|
unsigned long page_align;
|
||||||
|
|
@ -408,7 +409,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
|
||||||
initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
|
initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
|
||||||
/* Kernel allocation are uninterruptible */
|
/* Kernel allocation are uninterruptible */
|
||||||
r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type,
|
r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type,
|
||||||
&bo->placement, page_align, !kernel, NULL,
|
&bo->placement, page_align, &ctx, NULL,
|
||||||
acc_size, sg, resv, &amdgpu_ttm_bo_destroy);
|
acc_size, sg, resv, &amdgpu_ttm_bo_destroy);
|
||||||
if (unlikely(r != 0))
|
if (unlikely(r != 0))
|
||||||
return r;
|
return r;
|
||||||
|
|
|
||||||
|
|
@ -1132,7 +1132,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
|
||||||
enum ttm_bo_type type,
|
enum ttm_bo_type type,
|
||||||
struct ttm_placement *placement,
|
struct ttm_placement *placement,
|
||||||
uint32_t page_alignment,
|
uint32_t page_alignment,
|
||||||
bool interruptible,
|
struct ttm_operation_ctx *ctx,
|
||||||
struct file *persistent_swap_storage,
|
struct file *persistent_swap_storage,
|
||||||
size_t acc_size,
|
size_t acc_size,
|
||||||
struct sg_table *sg,
|
struct sg_table *sg,
|
||||||
|
|
@ -1218,11 +1218,8 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
|
||||||
WARN_ON(!locked);
|
WARN_ON(!locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (likely(!ret)) {
|
if (likely(!ret))
|
||||||
struct ttm_operation_ctx ctx = { interruptible, false };
|
ret = ttm_bo_validate(bo, placement, ctx);
|
||||||
|
|
||||||
ret = ttm_bo_validate(bo, placement, &ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unlikely(ret)) {
|
if (unlikely(ret)) {
|
||||||
if (!resv)
|
if (!resv)
|
||||||
|
|
@ -1255,10 +1252,11 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
|
||||||
struct reservation_object *resv,
|
struct reservation_object *resv,
|
||||||
void (*destroy) (struct ttm_buffer_object *))
|
void (*destroy) (struct ttm_buffer_object *))
|
||||||
{
|
{
|
||||||
|
struct ttm_operation_ctx ctx = { interruptible, false };
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = ttm_bo_init_reserved(bdev, bo, size, type, placement,
|
ret = ttm_bo_init_reserved(bdev, bo, size, type, placement,
|
||||||
page_alignment, interruptible,
|
page_alignment, &ctx,
|
||||||
persistent_swap_storage, acc_size,
|
persistent_swap_storage, acc_size,
|
||||||
sg, resv, destroy);
|
sg, resv, destroy);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
||||||
|
|
@ -455,8 +455,7 @@ size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
|
||||||
* @type: Requested type of buffer object.
|
* @type: Requested type of buffer object.
|
||||||
* @flags: Initial placement flags.
|
* @flags: Initial placement flags.
|
||||||
* @page_alignment: Data alignment in pages.
|
* @page_alignment: Data alignment in pages.
|
||||||
* @interruptible: If needing to sleep to wait for GPU resources,
|
* @ctx: TTM operation context for memory allocation.
|
||||||
* sleep interruptible.
|
|
||||||
* @persistent_swap_storage: Usually the swap storage is deleted for buffers
|
* @persistent_swap_storage: Usually the swap storage is deleted for buffers
|
||||||
* pinned in physical memory. If this behaviour is not desired, this member
|
* pinned in physical memory. If this behaviour is not desired, this member
|
||||||
* holds a pointer to a persistent shmem object. Typically, this would
|
* holds a pointer to a persistent shmem object. Typically, this would
|
||||||
|
|
@ -493,7 +492,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
|
||||||
enum ttm_bo_type type,
|
enum ttm_bo_type type,
|
||||||
struct ttm_placement *placement,
|
struct ttm_placement *placement,
|
||||||
uint32_t page_alignment,
|
uint32_t page_alignment,
|
||||||
bool interrubtible,
|
struct ttm_operation_ctx *ctx,
|
||||||
struct file *persistent_swap_storage,
|
struct file *persistent_swap_storage,
|
||||||
size_t acc_size,
|
size_t acc_size,
|
||||||
struct sg_table *sg,
|
struct sg_table *sg,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue