Re: [PATCH 2/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc

2018-01-25 Thread Christian König
Unfortunately the patches are already comitted (with a better commit 
message IIRC).


But the variable name sounds just like a style nit pick to me we can fix 
in a separate patch as well.


Thanks,
Christian.

Am 25.01.2018 um 00:24 schrieb Sinclair Yeh:

Hi,

Sorry, I've been on a leave.  Catching up on emails.

In case this is still not yet merged, my comment is
be consist with the new variable name.  In some cases
it's "ttm_opt_ctx", in others it's "ctx".

I prefer ttm_opt_ctx because it's more descriptive.

And yes, some description on why this change is necessary in the
commit message is nice, too.

Sinclair

On Wed, Dec 20, 2017 at 02:33:37PM +0100, Christian König wrote:

Commit message needed! Something like:

Forward the operation context to ttm_mem_global_alloc as well.

Am 20.12.2017 um 11:34 schrieb Roger He:

Change-Id: I5279b5cd3560c4082b00f822219575a5f9c3808a
Signed-off-by: Roger He 

With the commit message fixed, patch is Reviewed-by: Christian König
.

I would like to get an rb or ab from Thomas and/or Sinclair as well, since
this is touching a lot of vmwgfx code.

Regards,
Christian.


---
   drivers/gpu/drm/ttm/ttm_bo.c|  2 +-
   drivers/gpu/drm/ttm/ttm_memory.c| 15 +--
   drivers/gpu/drm/ttm/ttm_object.c| 13 ++---
   drivers/gpu/drm/vmwgfx/vmwgfx_binding.c |  6 +-
   drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c  | 13 ++---
   drivers/gpu/drm/vmwgfx/vmwgfx_context.c |  6 +-
   drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c |  6 +-
   drivers/gpu/drm/vmwgfx/vmwgfx_fence.c   |  6 +-
   drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 18 +++---
   drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c |  6 +-
   drivers/gpu/drm/vmwgfx/vmwgfx_so.c  |  6 +-
   drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 12 ++--
   include/drm/ttm/ttm_memory.h|  3 ++-
   13 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index fa57aa8..c59f572 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1133,7 +1133,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
bool locked;
-   ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);
+   ret = ttm_mem_global_alloc(mem_glob, acc_size, ctx);
if (ret) {
pr_err("Out of kernel memory\n");
if (destroy)
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index 9130bdf..525d3b6 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -508,7 +508,7 @@ static int ttm_mem_global_reserve(struct ttm_mem_global 
*glob,
   static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
 struct ttm_mem_zone *single_zone,
 uint64_t memory,
-bool no_wait, bool interruptible)
+struct ttm_operation_ctx *ctx)
   {
int count = TTM_MEMORY_ALLOC_RETRIES;
@@ -516,7 +516,7 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global 
*glob,
   single_zone,
   memory, true)
!= 0)) {
-   if (no_wait)
+   if (ctx->no_wait_gpu)
return -ENOMEM;
if (unlikely(count-- == 0))
return -ENOMEM;
@@ -527,15 +527,14 @@ static int ttm_mem_global_alloc_zone(struct 
ttm_mem_global *glob,
   }
   int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
-bool no_wait, bool interruptible)
+struct ttm_operation_ctx *ctx)
   {
/**
 * Normal allocations of kernel memory are registered in
 * all zones.
 */
-   return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait,
-interruptible);
+   return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
   }
   EXPORT_SYMBOL(ttm_mem_global_alloc);
@@ -544,6 +543,10 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
   {
struct ttm_mem_zone *zone = NULL;
+   struct ttm_operation_ctx ctx = {
+   .interruptible = false,
+   .no_wait_gpu = false
+   };
/**
 * Page allocations may be registed in a single zone
@@ -557,7 +560,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
if (glob->zone_dma32 && page_to_pfn(page) > 0x0010UL)
zone = glob->zone_kernel;
   #endif
-   return ttm_mem_global_alloc_zone(glob, zone, size, false, false);
+   return 

Re: [PATCH 2/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc

2018-01-24 Thread Sinclair Yeh
Hi,

Sorry, I've been on a leave.  Catching up on emails.

In case this is still not yet merged, my comment is
be consist with the new variable name.  In some cases
it's "ttm_opt_ctx", in others it's "ctx".

I prefer ttm_opt_ctx because it's more descriptive.

And yes, some description on why this change is necessary in the
commit message is nice, too.

Sinclair

On Wed, Dec 20, 2017 at 02:33:37PM +0100, Christian König wrote:
> Commit message needed! Something like:
> 
> Forward the operation context to ttm_mem_global_alloc as well.
> 
> Am 20.12.2017 um 11:34 schrieb Roger He:
> > Change-Id: I5279b5cd3560c4082b00f822219575a5f9c3808a
> > Signed-off-by: Roger He 
> 
> With the commit message fixed, patch is Reviewed-by: Christian König
> .
> 
> I would like to get an rb or ab from Thomas and/or Sinclair as well, since
> this is touching a lot of vmwgfx code.
> 
> Regards,
> Christian.
> 
> > ---
> >   drivers/gpu/drm/ttm/ttm_bo.c|  2 +-
> >   drivers/gpu/drm/ttm/ttm_memory.c| 15 +--
> >   drivers/gpu/drm/ttm/ttm_object.c| 13 ++---
> >   drivers/gpu/drm/vmwgfx/vmwgfx_binding.c |  6 +-
> >   drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c  | 13 ++---
> >   drivers/gpu/drm/vmwgfx/vmwgfx_context.c |  6 +-
> >   drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c |  6 +-
> >   drivers/gpu/drm/vmwgfx/vmwgfx_fence.c   |  6 +-
> >   drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 18 +++---
> >   drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c |  6 +-
> >   drivers/gpu/drm/vmwgfx/vmwgfx_so.c  |  6 +-
> >   drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 12 ++--
> >   include/drm/ttm/ttm_memory.h|  3 ++-
> >   13 files changed, 87 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> > index fa57aa8..c59f572 100644
> > --- a/drivers/gpu/drm/ttm/ttm_bo.c
> > +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> > @@ -1133,7 +1133,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
> > struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
> > bool locked;
> > -   ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);
> > +   ret = ttm_mem_global_alloc(mem_glob, acc_size, ctx);
> > if (ret) {
> > pr_err("Out of kernel memory\n");
> > if (destroy)
> > diff --git a/drivers/gpu/drm/ttm/ttm_memory.c 
> > b/drivers/gpu/drm/ttm/ttm_memory.c
> > index 9130bdf..525d3b6 100644
> > --- a/drivers/gpu/drm/ttm/ttm_memory.c
> > +++ b/drivers/gpu/drm/ttm/ttm_memory.c
> > @@ -508,7 +508,7 @@ static int ttm_mem_global_reserve(struct ttm_mem_global 
> > *glob,
> >   static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
> >  struct ttm_mem_zone *single_zone,
> >  uint64_t memory,
> > -bool no_wait, bool interruptible)
> > +struct ttm_operation_ctx *ctx)
> >   {
> > int count = TTM_MEMORY_ALLOC_RETRIES;
> > @@ -516,7 +516,7 @@ static int ttm_mem_global_alloc_zone(struct 
> > ttm_mem_global *glob,
> >single_zone,
> >memory, true)
> > != 0)) {
> > -   if (no_wait)
> > +   if (ctx->no_wait_gpu)
> > return -ENOMEM;
> > if (unlikely(count-- == 0))
> > return -ENOMEM;
> > @@ -527,15 +527,14 @@ static int ttm_mem_global_alloc_zone(struct 
> > ttm_mem_global *glob,
> >   }
> >   int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
> > -bool no_wait, bool interruptible)
> > +struct ttm_operation_ctx *ctx)
> >   {
> > /**
> >  * Normal allocations of kernel memory are registered in
> >  * all zones.
> >  */
> > -   return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait,
> > -interruptible);
> > +   return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
> >   }
> >   EXPORT_SYMBOL(ttm_mem_global_alloc);
> > @@ -544,6 +543,10 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global 
> > *glob,
> >   {
> > struct ttm_mem_zone *zone = NULL;
> > +   struct ttm_operation_ctx ctx = {
> > +   .interruptible = false,
> > +   .no_wait_gpu = false
> > +   };
> > /**
> >  * Page allocations may be registed in a single zone
> > @@ -557,7 +560,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global 
> > *glob,
> > if (glob->zone_dma32 && page_to_pfn(page) > 0x0010UL)
> > zone = glob->zone_kernel;
> >   #endif
> > -   return ttm_mem_global_alloc_zone(glob, zone, size, false, false);
> > +   return ttm_mem_global_alloc_zone(glob, zone, size, );
> >   }
> >   void 

Re: [PATCH 2/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc

2017-12-21 Thread Thomas Hellstrom

With a suitable commit log, LGTM.

Reviewed-by: Thomas Hellstrom 


On 12/20/2017 11:34 AM, Roger He wrote:

Change-Id: I5279b5cd3560c4082b00f822219575a5f9c3808a
Signed-off-by: Roger He 
---
  drivers/gpu/drm/ttm/ttm_bo.c|  2 +-
  drivers/gpu/drm/ttm/ttm_memory.c| 15 +--
  drivers/gpu/drm/ttm/ttm_object.c| 13 ++---
  drivers/gpu/drm/vmwgfx/vmwgfx_binding.c |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c  | 13 ++---
  drivers/gpu/drm/vmwgfx/vmwgfx_context.c |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_fence.c   |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 18 +++---
  drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_so.c  |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 12 ++--
  include/drm/ttm/ttm_memory.h|  3 ++-
  13 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index fa57aa8..c59f572 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1133,7 +1133,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
bool locked;
  
-	ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);

+   ret = ttm_mem_global_alloc(mem_glob, acc_size, ctx);
if (ret) {
pr_err("Out of kernel memory\n");
if (destroy)
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index 9130bdf..525d3b6 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -508,7 +508,7 @@ static int ttm_mem_global_reserve(struct ttm_mem_global 
*glob,
  static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
 struct ttm_mem_zone *single_zone,
 uint64_t memory,
-bool no_wait, bool interruptible)
+struct ttm_operation_ctx *ctx)
  {
int count = TTM_MEMORY_ALLOC_RETRIES;
  
@@ -516,7 +516,7 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,

   single_zone,
   memory, true)
!= 0)) {
-   if (no_wait)
+   if (ctx->no_wait_gpu)
return -ENOMEM;
if (unlikely(count-- == 0))
return -ENOMEM;
@@ -527,15 +527,14 @@ static int ttm_mem_global_alloc_zone(struct 
ttm_mem_global *glob,
  }
  
  int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,

-bool no_wait, bool interruptible)
+struct ttm_operation_ctx *ctx)
  {
/**
 * Normal allocations of kernel memory are registered in
 * all zones.
 */
  
-	return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait,

-interruptible);
+   return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
  }
  EXPORT_SYMBOL(ttm_mem_global_alloc);
  
@@ -544,6 +543,10 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,

  {
  
  	struct ttm_mem_zone *zone = NULL;

+   struct ttm_operation_ctx ctx = {
+   .interruptible = false,
+   .no_wait_gpu = false
+   };
  
  	/**

 * Page allocations may be registed in a single zone
@@ -557,7 +560,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
if (glob->zone_dma32 && page_to_pfn(page) > 0x0010UL)
zone = glob->zone_kernel;
  #endif
-   return ttm_mem_global_alloc_zone(glob, zone, size, false, false);
+   return ttm_mem_global_alloc_zone(glob, zone, size, );
  }
  
  void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page,

diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c
index 26a7ad0..1aa2baa 100644
--- a/drivers/gpu/drm/ttm/ttm_object.c
+++ b/drivers/gpu/drm/ttm/ttm_object.c
@@ -325,6 +325,10 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
struct ttm_ref_object *ref;
struct drm_hash_item *hash;
struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
+   struct ttm_operation_ctx ctx = {
+   .interruptible = false,
+   .no_wait_gpu = false
+   };
int ret = -EINVAL;
  
  	if (base->tfile != tfile && !base->shareable)

@@ -350,7 +354,7 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
return -EPERM;
  
  		ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref),

-  false, 

Re: [PATCH 2/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc

2017-12-20 Thread Christian König

Commit message needed! Something like:

Forward the operation context to ttm_mem_global_alloc as well.

Am 20.12.2017 um 11:34 schrieb Roger He:

Change-Id: I5279b5cd3560c4082b00f822219575a5f9c3808a
Signed-off-by: Roger He 


With the commit message fixed, patch is Reviewed-by: Christian König 
.


I would like to get an rb or ab from Thomas and/or Sinclair as well, 
since this is touching a lot of vmwgfx code.


Regards,
Christian.


---
  drivers/gpu/drm/ttm/ttm_bo.c|  2 +-
  drivers/gpu/drm/ttm/ttm_memory.c| 15 +--
  drivers/gpu/drm/ttm/ttm_object.c| 13 ++---
  drivers/gpu/drm/vmwgfx/vmwgfx_binding.c |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c  | 13 ++---
  drivers/gpu/drm/vmwgfx/vmwgfx_context.c |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_fence.c   |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 18 +++---
  drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_so.c  |  6 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 12 ++--
  include/drm/ttm/ttm_memory.h|  3 ++-
  13 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index fa57aa8..c59f572 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1133,7 +1133,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
bool locked;
  
-	ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);

+   ret = ttm_mem_global_alloc(mem_glob, acc_size, ctx);
if (ret) {
pr_err("Out of kernel memory\n");
if (destroy)
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index 9130bdf..525d3b6 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -508,7 +508,7 @@ static int ttm_mem_global_reserve(struct ttm_mem_global 
*glob,
  static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
 struct ttm_mem_zone *single_zone,
 uint64_t memory,
-bool no_wait, bool interruptible)
+struct ttm_operation_ctx *ctx)
  {
int count = TTM_MEMORY_ALLOC_RETRIES;
  
@@ -516,7 +516,7 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,

   single_zone,
   memory, true)
!= 0)) {
-   if (no_wait)
+   if (ctx->no_wait_gpu)
return -ENOMEM;
if (unlikely(count-- == 0))
return -ENOMEM;
@@ -527,15 +527,14 @@ static int ttm_mem_global_alloc_zone(struct 
ttm_mem_global *glob,
  }
  
  int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,

-bool no_wait, bool interruptible)
+struct ttm_operation_ctx *ctx)
  {
/**
 * Normal allocations of kernel memory are registered in
 * all zones.
 */
  
-	return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait,

-interruptible);
+   return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
  }
  EXPORT_SYMBOL(ttm_mem_global_alloc);
  
@@ -544,6 +543,10 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,

  {
  
  	struct ttm_mem_zone *zone = NULL;

+   struct ttm_operation_ctx ctx = {
+   .interruptible = false,
+   .no_wait_gpu = false
+   };
  
  	/**

 * Page allocations may be registed in a single zone
@@ -557,7 +560,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
if (glob->zone_dma32 && page_to_pfn(page) > 0x0010UL)
zone = glob->zone_kernel;
  #endif
-   return ttm_mem_global_alloc_zone(glob, zone, size, false, false);
+   return ttm_mem_global_alloc_zone(glob, zone, size, );
  }
  
  void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page,

diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c
index 26a7ad0..1aa2baa 100644
--- a/drivers/gpu/drm/ttm/ttm_object.c
+++ b/drivers/gpu/drm/ttm/ttm_object.c
@@ -325,6 +325,10 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
struct ttm_ref_object *ref;
struct drm_hash_item *hash;
struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
+   struct ttm_operation_ctx ctx = {
+   .interruptible = false,
+   .no_wait_gpu = false
+   };
int ret = -EINVAL;
  
  	if (base->tfile 

[PATCH 2/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc

2017-12-20 Thread Roger He
Change-Id: I5279b5cd3560c4082b00f822219575a5f9c3808a
Signed-off-by: Roger He 
---
 drivers/gpu/drm/ttm/ttm_bo.c|  2 +-
 drivers/gpu/drm/ttm/ttm_memory.c| 15 +--
 drivers/gpu/drm/ttm/ttm_object.c| 13 ++---
 drivers/gpu/drm/vmwgfx/vmwgfx_binding.c |  6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c  | 13 ++---
 drivers/gpu/drm/vmwgfx/vmwgfx_context.c |  6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c |  6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c   |  6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 18 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c |  6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_so.c  |  6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 12 ++--
 include/drm/ttm/ttm_memory.h|  3 ++-
 13 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index fa57aa8..c59f572 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1133,7 +1133,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
bool locked;
 
-   ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);
+   ret = ttm_mem_global_alloc(mem_glob, acc_size, ctx);
if (ret) {
pr_err("Out of kernel memory\n");
if (destroy)
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index 9130bdf..525d3b6 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -508,7 +508,7 @@ static int ttm_mem_global_reserve(struct ttm_mem_global 
*glob,
 static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
 struct ttm_mem_zone *single_zone,
 uint64_t memory,
-bool no_wait, bool interruptible)
+struct ttm_operation_ctx *ctx)
 {
int count = TTM_MEMORY_ALLOC_RETRIES;
 
@@ -516,7 +516,7 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global 
*glob,
   single_zone,
   memory, true)
!= 0)) {
-   if (no_wait)
+   if (ctx->no_wait_gpu)
return -ENOMEM;
if (unlikely(count-- == 0))
return -ENOMEM;
@@ -527,15 +527,14 @@ static int ttm_mem_global_alloc_zone(struct 
ttm_mem_global *glob,
 }
 
 int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
-bool no_wait, bool interruptible)
+struct ttm_operation_ctx *ctx)
 {
/**
 * Normal allocations of kernel memory are registered in
 * all zones.
 */
 
-   return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait,
-interruptible);
+   return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
 }
 EXPORT_SYMBOL(ttm_mem_global_alloc);
 
@@ -544,6 +543,10 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
 {
 
struct ttm_mem_zone *zone = NULL;
+   struct ttm_operation_ctx ctx = {
+   .interruptible = false,
+   .no_wait_gpu = false
+   };
 
/**
 * Page allocations may be registed in a single zone
@@ -557,7 +560,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
if (glob->zone_dma32 && page_to_pfn(page) > 0x0010UL)
zone = glob->zone_kernel;
 #endif
-   return ttm_mem_global_alloc_zone(glob, zone, size, false, false);
+   return ttm_mem_global_alloc_zone(glob, zone, size, );
 }
 
 void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page,
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c
index 26a7ad0..1aa2baa 100644
--- a/drivers/gpu/drm/ttm/ttm_object.c
+++ b/drivers/gpu/drm/ttm/ttm_object.c
@@ -325,6 +325,10 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
struct ttm_ref_object *ref;
struct drm_hash_item *hash;
struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
+   struct ttm_operation_ctx ctx = {
+   .interruptible = false,
+   .no_wait_gpu = false
+   };
int ret = -EINVAL;
 
if (base->tfile != tfile && !base->shareable)
@@ -350,7 +354,7 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
return -EPERM;
 
ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref),
-  false, false);
+  );
if (unlikely(ret != 0))
return ret;