Re: [PATCH 4/7] drm/ttm: use an operation ctx for ttm_tt_populate in ttm_bo_driver

2017-12-20 Thread Christian König

Am 20.12.2017 um 11:34 schrieb Roger He:

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


Commit message! And please double check the coding style of 
ast_ttm_tt_populate.


With that fixed that patch is Reviewed-by: Christian König 
.


Regards,
Christian.


---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  |  7 ---
  drivers/gpu/drm/ast/ast_ttm.c|  5 +++--
  drivers/gpu/drm/cirrus/cirrus_ttm.c  |  5 +++--
  drivers/gpu/drm/nouveau/nouveau_bo.c |  8 
  drivers/gpu/drm/qxl/qxl_ttm.c|  5 +++--
  drivers/gpu/drm/radeon/radeon_ttm.c  |  9 +
  drivers/gpu/drm/ttm/ttm_agp_backend.c|  4 ++--
  drivers/gpu/drm/ttm/ttm_bo_util.c| 11 ---
  drivers/gpu/drm/ttm/ttm_bo_vm.c  |  7 ++-
  drivers/gpu/drm/ttm/ttm_page_alloc.c | 13 +
  drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 11 ---
  drivers/gpu/drm/ttm/ttm_tt.c |  6 +-
  drivers/gpu/drm/virtio/virtgpu_object.c  |  6 +-
  drivers/gpu/drm/virtio/virtgpu_ttm.c |  5 +++--
  drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c   | 13 +
  drivers/gpu/drm/vmwgfx/vmwgfx_mob.c  | 13 +++--
  include/drm/ttm/ttm_bo_driver.h  |  5 +++--
  include/drm/ttm/ttm_page_alloc.h | 11 +++
  18 files changed, 86 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index f1b7d98..52aab9d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -990,7 +990,8 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct 
ttm_bo_device *bdev,
return >ttm.ttm;
  }
  
-static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)

+static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm,
+   struct ttm_operation_ctx *ctx)
  {
struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
struct amdgpu_ttm_tt *gtt = (void *)ttm;
@@ -1018,11 +1019,11 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
  
  #ifdef CONFIG_SWIOTLB

if (swiotlb_nr_tbl()) {
-   return ttm_dma_populate(>ttm, adev->dev);
+   return ttm_dma_populate(>ttm, adev->dev, ctx);
}
  #endif
  
-	return ttm_populate_and_map_pages(adev->dev, >ttm);

+   return ttm_populate_and_map_pages(adev->dev, >ttm, ctx);
  }
  
  static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)

diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index 28da7c2..1413e94 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -216,9 +216,10 @@ static struct ttm_tt *ast_ttm_tt_create(struct 
ttm_bo_device *bdev,
return tt;
  }
  
-static int ast_ttm_tt_populate(struct ttm_tt *ttm)

+static int ast_ttm_tt_populate(struct ttm_tt *ttm,
+   struct ttm_operation_ctx *ctx)
  {
-   return ttm_pool_populate(ttm);
+   return ttm_pool_populate(ttm, ctx);
  }
  
  static void ast_ttm_tt_unpopulate(struct ttm_tt *ttm)

diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c 
b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 2a5b54d..95e2d40 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -216,9 +216,10 @@ static struct ttm_tt *cirrus_ttm_tt_create(struct 
ttm_bo_device *bdev,
return tt;
  }
  
-static int cirrus_ttm_tt_populate(struct ttm_tt *ttm)

+static int cirrus_ttm_tt_populate(struct ttm_tt *ttm,
+   struct ttm_operation_ctx *ctx)
  {
-   return ttm_pool_populate(ttm);
+   return ttm_pool_populate(ttm, ctx);
  }
  
  static void cirrus_ttm_tt_unpopulate(struct ttm_tt *ttm)

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 6b6fb20..b141c27 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1547,7 +1547,7 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object 
*bo)
  }
  
  static int

-nouveau_ttm_tt_populate(struct ttm_tt *ttm)
+nouveau_ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
  {
struct ttm_dma_tt *ttm_dma = (void *)ttm;
struct nouveau_drm *drm;
@@ -1572,17 +1572,17 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm)
  
  #if IS_ENABLED(CONFIG_AGP)

if (drm->agp.bridge) {
-   return ttm_agp_tt_populate(ttm);
+   return ttm_agp_tt_populate(ttm, ctx);
}
  #endif
  
  #if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)

if (swiotlb_nr_tbl()) {
-   return ttm_dma_populate((void *)ttm, dev);
+   return ttm_dma_populate((void *)ttm, dev, ctx);
}
  #endif
  
-	r = ttm_pool_populate(ttm);

+   r = ttm_pool_populate(ttm, ctx);
if (r) {
return r;
}
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c 

[PATCH 4/7] drm/ttm: use an operation ctx for ttm_tt_populate in ttm_bo_driver

2017-12-20 Thread Roger He
Change-Id: I803ea52d11e5c06add0dffab836c3aecc00b56dd
Signed-off-by: Roger He 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  |  7 ---
 drivers/gpu/drm/ast/ast_ttm.c|  5 +++--
 drivers/gpu/drm/cirrus/cirrus_ttm.c  |  5 +++--
 drivers/gpu/drm/nouveau/nouveau_bo.c |  8 
 drivers/gpu/drm/qxl/qxl_ttm.c|  5 +++--
 drivers/gpu/drm/radeon/radeon_ttm.c  |  9 +
 drivers/gpu/drm/ttm/ttm_agp_backend.c|  4 ++--
 drivers/gpu/drm/ttm/ttm_bo_util.c| 11 ---
 drivers/gpu/drm/ttm/ttm_bo_vm.c  |  7 ++-
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 13 +
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 11 ---
 drivers/gpu/drm/ttm/ttm_tt.c |  6 +-
 drivers/gpu/drm/virtio/virtgpu_object.c  |  6 +-
 drivers/gpu/drm/virtio/virtgpu_ttm.c |  5 +++--
 drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c   | 13 +
 drivers/gpu/drm/vmwgfx/vmwgfx_mob.c  | 13 +++--
 include/drm/ttm/ttm_bo_driver.h  |  5 +++--
 include/drm/ttm/ttm_page_alloc.h | 11 +++
 18 files changed, 86 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index f1b7d98..52aab9d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -990,7 +990,8 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct 
ttm_bo_device *bdev,
return >ttm.ttm;
 }
 
-static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
+static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm,
+   struct ttm_operation_ctx *ctx)
 {
struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
struct amdgpu_ttm_tt *gtt = (void *)ttm;
@@ -1018,11 +1019,11 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 
 #ifdef CONFIG_SWIOTLB
if (swiotlb_nr_tbl()) {
-   return ttm_dma_populate(>ttm, adev->dev);
+   return ttm_dma_populate(>ttm, adev->dev, ctx);
}
 #endif
 
-   return ttm_populate_and_map_pages(adev->dev, >ttm);
+   return ttm_populate_and_map_pages(adev->dev, >ttm, ctx);
 }
 
 static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index 28da7c2..1413e94 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -216,9 +216,10 @@ static struct ttm_tt *ast_ttm_tt_create(struct 
ttm_bo_device *bdev,
return tt;
 }
 
-static int ast_ttm_tt_populate(struct ttm_tt *ttm)
+static int ast_ttm_tt_populate(struct ttm_tt *ttm,
+   struct ttm_operation_ctx *ctx)
 {
-   return ttm_pool_populate(ttm);
+   return ttm_pool_populate(ttm, ctx);
 }
 
 static void ast_ttm_tt_unpopulate(struct ttm_tt *ttm)
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c 
b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 2a5b54d..95e2d40 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -216,9 +216,10 @@ static struct ttm_tt *cirrus_ttm_tt_create(struct 
ttm_bo_device *bdev,
return tt;
 }
 
-static int cirrus_ttm_tt_populate(struct ttm_tt *ttm)
+static int cirrus_ttm_tt_populate(struct ttm_tt *ttm,
+   struct ttm_operation_ctx *ctx)
 {
-   return ttm_pool_populate(ttm);
+   return ttm_pool_populate(ttm, ctx);
 }
 
 static void cirrus_ttm_tt_unpopulate(struct ttm_tt *ttm)
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 6b6fb20..b141c27 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1547,7 +1547,7 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object 
*bo)
 }
 
 static int
-nouveau_ttm_tt_populate(struct ttm_tt *ttm)
+nouveau_ttm_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
 {
struct ttm_dma_tt *ttm_dma = (void *)ttm;
struct nouveau_drm *drm;
@@ -1572,17 +1572,17 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm)
 
 #if IS_ENABLED(CONFIG_AGP)
if (drm->agp.bridge) {
-   return ttm_agp_tt_populate(ttm);
+   return ttm_agp_tt_populate(ttm, ctx);
}
 #endif
 
 #if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
if (swiotlb_nr_tbl()) {
-   return ttm_dma_populate((void *)ttm, dev);
+   return ttm_dma_populate((void *)ttm, dev, ctx);
}
 #endif
 
-   r = ttm_pool_populate(ttm);
+   r = ttm_pool_populate(ttm, ctx);
if (r) {
return r;
}
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 78ce118..989645c 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -291,14 +291,15 @@ static struct ttm_backend_func qxl_backend_func = {
.destroy = _ttm_backend_destroy,
 };
 
-static int qxl_ttm_tt_populate(struct ttm_tt *ttm)
+static int