aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2014-01-20 05:33:04 -0500
committerThomas Hellstrom <thellstrom@vmware.com>2014-01-21 07:22:18 -0500
commit3e894a6259964618e29809b844bffaaf9849067b (patch)
treee7698f18611a0e57836d768632d3addcba6ce855 /drivers/gpu
parentcfd72a4c2089aa3938f37281a34d6eb3306d5fd8 (diff)
drm/vmwgfx: Fix recently introduced sparse / smatch warnings and errors
Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrant <jakob@vmware.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_context.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c4
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_mob.c45
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_shader.c1
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_surface.c1
5 files changed, 25 insertions, 28 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index 97aa55159107..82c41daebc0e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -744,7 +744,7 @@ static void vmw_context_binding_transfer(struct vmw_ctx_binding_state *cbs,
744 * Emits FIFO commands to scrub a binding represented by @cb. 744 * Emits FIFO commands to scrub a binding represented by @cb.
745 * Then stops tracking the binding and re-initializes its storage. 745 * Then stops tracking the binding and re-initializes its storage.
746 */ 746 */
747void vmw_context_binding_kill(struct vmw_ctx_binding *cb) 747static void vmw_context_binding_kill(struct vmw_ctx_binding *cb)
748{ 748{
749 (void) vmw_scrub_funcs[cb->bi.bt](&cb->bi); 749 (void) vmw_scrub_funcs[cb->bi.bt](&cb->bi);
750 vmw_context_binding_drop(cb); 750 vmw_context_binding_drop(cb);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 078b9b0d2dfe..9893328f8fdc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -680,8 +680,10 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
680 dev_priv->prim_bb_mem = dev_priv->vram_size; 680 dev_priv->prim_bb_mem = dev_priv->vram_size;
681 681
682 ret = vmw_dma_masks(dev_priv); 682 ret = vmw_dma_masks(dev_priv);
683 if (unlikely(ret != 0)) 683 if (unlikely(ret != 0)) {
684 mutex_unlock(&dev_priv->hw_mutex);
684 goto out_err0; 685 goto out_err0;
686 }
685 687
686 if (unlikely(dev_priv->prim_bb_mem < dev_priv->vram_size)) 688 if (unlikely(dev_priv->prim_bb_mem < dev_priv->vram_size))
687 dev_priv->prim_bb_mem = dev_priv->vram_size; 689 dev_priv->prim_bb_mem = dev_priv->vram_size;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
index ad29651a4302..4910e7b81811 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
@@ -35,19 +35,11 @@
35 35
36#ifdef CONFIG_64BIT 36#ifdef CONFIG_64BIT
37#define VMW_PPN_SIZE 8 37#define VMW_PPN_SIZE 8
38#define vmw_cmd_set_otable_base SVGA3dCmdSetOTableBase64
39#define VMW_ID_SET_OTABLE_BASE SVGA_3D_CMD_SET_OTABLE_BASE64
40#define vmw_cmd_define_gb_mob SVGA3dCmdDefineGBMob64
41#define VMW_ID_DEFINE_GB_MOB SVGA_3D_CMD_DEFINE_GB_MOB64
42#define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PTDEPTH64_0 38#define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PTDEPTH64_0
43#define VMW_MOBFMT_PTDEPTH_1 SVGA3D_MOBFMT_PTDEPTH64_1 39#define VMW_MOBFMT_PTDEPTH_1 SVGA3D_MOBFMT_PTDEPTH64_1
44#define VMW_MOBFMT_PTDEPTH_2 SVGA3D_MOBFMT_PTDEPTH64_2 40#define VMW_MOBFMT_PTDEPTH_2 SVGA3D_MOBFMT_PTDEPTH64_2
45#else 41#else
46#define VMW_PPN_SIZE 4 42#define VMW_PPN_SIZE 4
47#define vmw_cmd_set_otable_base SVGA3dCmdSetOTableBase
48#define VMW_ID_SET_OTABLE_BASE SVGA_3D_CMD_SET_OTABLE_BASE
49#define vmw_cmd_define_gb_mob SVGA3dCmdDefineGBMob
50#define VMW_ID_DEFINE_GB_MOB SVGA_3D_CMD_DEFINE_GB_MOB
51#define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PTDEPTH_0 43#define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PTDEPTH_0
52#define VMW_MOBFMT_PTDEPTH_1 SVGA3D_MOBFMT_PTDEPTH_1 44#define VMW_MOBFMT_PTDEPTH_1 SVGA3D_MOBFMT_PTDEPTH_1
53#define VMW_MOBFMT_PTDEPTH_2 SVGA3D_MOBFMT_PTDEPTH_2 45#define VMW_MOBFMT_PTDEPTH_2 SVGA3D_MOBFMT_PTDEPTH_2
@@ -105,7 +97,7 @@ static int vmw_setup_otable_base(struct vmw_private *dev_priv,
105{ 97{
106 struct { 98 struct {
107 SVGA3dCmdHeader header; 99 SVGA3dCmdHeader header;
108 vmw_cmd_set_otable_base body; 100 SVGA3dCmdSetOTableBase64 body;
109 } *cmd; 101 } *cmd;
110 struct vmw_mob *mob; 102 struct vmw_mob *mob;
111 const struct vmw_sg_table *vsgt; 103 const struct vmw_sg_table *vsgt;
@@ -146,10 +138,10 @@ static int vmw_setup_otable_base(struct vmw_private *dev_priv,
146 } 138 }
147 139
148 memset(cmd, 0, sizeof(*cmd)); 140 memset(cmd, 0, sizeof(*cmd));
149 cmd->header.id = VMW_ID_SET_OTABLE_BASE; 141 cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE64;
150 cmd->header.size = sizeof(cmd->body); 142 cmd->header.size = sizeof(cmd->body);
151 cmd->body.type = type; 143 cmd->body.type = type;
152 cmd->body.baseAddress = mob->pt_root_page >> PAGE_SHIFT; 144 cmd->body.baseAddress = cpu_to_le64(mob->pt_root_page >> PAGE_SHIFT);
153 cmd->body.sizeInBytes = otable->size; 145 cmd->body.sizeInBytes = otable->size;
154 cmd->body.validSizeInBytes = 0; 146 cmd->body.validSizeInBytes = 0;
155 cmd->body.ptDepth = mob->pt_level; 147 cmd->body.ptDepth = mob->pt_level;
@@ -188,11 +180,12 @@ static void vmw_takedown_otable_base(struct vmw_private *dev_priv,
188 SVGA3dCmdHeader header; 180 SVGA3dCmdHeader header;
189 SVGA3dCmdSetOTableBase body; 181 SVGA3dCmdSetOTableBase body;
190 } *cmd; 182 } *cmd;
191 struct ttm_buffer_object *bo = otable->page_table->pt_bo; 183 struct ttm_buffer_object *bo;
192 184
193 if (otable->page_table == NULL) 185 if (otable->page_table == NULL)
194 return; 186 return;
195 187
188 bo = otable->page_table->pt_bo;
196 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); 189 cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd));
197 if (unlikely(cmd == NULL)) 190 if (unlikely(cmd == NULL))
198 DRM_ERROR("Failed reserving FIFO space for OTable setup.\n"); 191 DRM_ERROR("Failed reserving FIFO space for OTable setup.\n");
@@ -210,7 +203,7 @@ static void vmw_takedown_otable_base(struct vmw_private *dev_priv,
210 if (bo) { 203 if (bo) {
211 int ret; 204 int ret;
212 205
213 ret = ttm_bo_reserve(bo, false, true, false, false); 206 ret = ttm_bo_reserve(bo, false, true, false, NULL);
214 BUG_ON(ret != 0); 207 BUG_ON(ret != 0);
215 208
216 vmw_fence_single_bo(bo, NULL); 209 vmw_fence_single_bo(bo, NULL);
@@ -276,7 +269,7 @@ int vmw_otables_setup(struct vmw_private *dev_priv)
276 if (unlikely(ret != 0)) 269 if (unlikely(ret != 0))
277 goto out_no_bo; 270 goto out_no_bo;
278 271
279 ret = ttm_bo_reserve(dev_priv->otable_bo, false, true, false, false); 272 ret = ttm_bo_reserve(dev_priv->otable_bo, false, true, false, NULL);
280 BUG_ON(ret != 0); 273 BUG_ON(ret != 0);
281 ret = vmw_bo_driver.ttm_tt_populate(dev_priv->otable_bo->ttm); 274 ret = vmw_bo_driver.ttm_tt_populate(dev_priv->otable_bo->ttm);
282 if (unlikely(ret != 0)) 275 if (unlikely(ret != 0))
@@ -329,7 +322,7 @@ void vmw_otables_takedown(struct vmw_private *dev_priv)
329 vmw_takedown_otable_base(dev_priv, i, 322 vmw_takedown_otable_base(dev_priv, i,
330 &dev_priv->otables[i]); 323 &dev_priv->otables[i]);
331 324
332 ret = ttm_bo_reserve(bo, false, true, false, false); 325 ret = ttm_bo_reserve(bo, false, true, false, NULL);
333 BUG_ON(ret != 0); 326 BUG_ON(ret != 0);
334 327
335 vmw_fence_single_bo(bo, NULL); 328 vmw_fence_single_bo(bo, NULL);
@@ -402,7 +395,7 @@ static int vmw_mob_pt_populate(struct vmw_private *dev_priv,
402 if (unlikely(ret != 0)) 395 if (unlikely(ret != 0))
403 return ret; 396 return ret;
404 397
405 ret = ttm_bo_reserve(mob->pt_bo, false, true, false, false); 398 ret = ttm_bo_reserve(mob->pt_bo, false, true, false, NULL);
406 399
407 BUG_ON(ret != 0); 400 BUG_ON(ret != 0);
408 ret = vmw_bo_driver.ttm_tt_populate(mob->pt_bo->ttm); 401 ret = vmw_bo_driver.ttm_tt_populate(mob->pt_bo->ttm);
@@ -433,15 +426,15 @@ out_unreserve:
433 * *@addr according to the page table entry size. 426 * *@addr according to the page table entry size.
434 */ 427 */
435#if (VMW_PPN_SIZE == 8) 428#if (VMW_PPN_SIZE == 8)
436static void vmw_mob_assign_ppn(uint32_t **addr, dma_addr_t val) 429static void vmw_mob_assign_ppn(__le32 **addr, dma_addr_t val)
437{ 430{
438 *((uint64_t *) *addr) = val >> PAGE_SHIFT; 431 *((__le64 *) *addr) = cpu_to_le64(val >> PAGE_SHIFT);
439 *addr += 2; 432 *addr += 2;
440} 433}
441#else 434#else
442static void vmw_mob_assign_ppn(uint32_t **addr, dma_addr_t val) 435static void vmw_mob_assign_ppn(__le32 **addr, dma_addr_t val)
443{ 436{
444 *(*addr)++ = val >> PAGE_SHIFT; 437 *(*addr)++ = cpu_to_le32(val >> PAGE_SHIFT);
445} 438}
446#endif 439#endif
447 440
@@ -463,7 +456,7 @@ static unsigned long vmw_mob_build_pt(struct vmw_piter *data_iter,
463 unsigned long pt_size = num_data_pages * VMW_PPN_SIZE; 456 unsigned long pt_size = num_data_pages * VMW_PPN_SIZE;
464 unsigned long num_pt_pages = DIV_ROUND_UP(pt_size, PAGE_SIZE); 457 unsigned long num_pt_pages = DIV_ROUND_UP(pt_size, PAGE_SIZE);
465 unsigned long pt_page; 458 unsigned long pt_page;
466 uint32_t *addr, *save_addr; 459 __le32 *addr, *save_addr;
467 unsigned long i; 460 unsigned long i;
468 struct page *page; 461 struct page *page;
469 462
@@ -507,7 +500,7 @@ static void vmw_mob_pt_setup(struct vmw_mob *mob,
507 const struct vmw_sg_table *vsgt; 500 const struct vmw_sg_table *vsgt;
508 int ret; 501 int ret;
509 502
510 ret = ttm_bo_reserve(bo, false, true, false, 0); 503 ret = ttm_bo_reserve(bo, false, true, false, NULL);
511 BUG_ON(ret != 0); 504 BUG_ON(ret != 0);
512 505
513 vsgt = vmw_bo_sg_table(bo); 506 vsgt = vmw_bo_sg_table(bo);
@@ -557,7 +550,7 @@ void vmw_mob_unbind(struct vmw_private *dev_priv,
557 struct ttm_buffer_object *bo = mob->pt_bo; 550 struct ttm_buffer_object *bo = mob->pt_bo;
558 551
559 if (bo) { 552 if (bo) {
560 ret = ttm_bo_reserve(bo, false, true, false, 0); 553 ret = ttm_bo_reserve(bo, false, true, false, NULL);
561 /* 554 /*
562 * Noone else should be using this buffer. 555 * Noone else should be using this buffer.
563 */ 556 */
@@ -606,7 +599,7 @@ int vmw_mob_bind(struct vmw_private *dev_priv,
606 struct vmw_piter data_iter; 599 struct vmw_piter data_iter;
607 struct { 600 struct {
608 SVGA3dCmdHeader header; 601 SVGA3dCmdHeader header;
609 vmw_cmd_define_gb_mob body; 602 SVGA3dCmdDefineGBMob64 body;
610 } *cmd; 603 } *cmd;
611 604
612 mob->id = mob_id; 605 mob->id = mob_id;
@@ -639,11 +632,11 @@ int vmw_mob_bind(struct vmw_private *dev_priv,
639 goto out_no_cmd_space; 632 goto out_no_cmd_space;
640 } 633 }
641 634
642 cmd->header.id = VMW_ID_DEFINE_GB_MOB; 635 cmd->header.id = SVGA_3D_CMD_DEFINE_GB_MOB64;
643 cmd->header.size = sizeof(cmd->body); 636 cmd->header.size = sizeof(cmd->body);
644 cmd->body.mobid = mob_id; 637 cmd->body.mobid = mob_id;
645 cmd->body.ptDepth = mob->pt_level; 638 cmd->body.ptDepth = mob->pt_level;
646 cmd->body.base = mob->pt_root_page >> PAGE_SHIFT; 639 cmd->body.base = cpu_to_le64(mob->pt_root_page >> PAGE_SHIFT);
647 cmd->body.sizeInBytes = num_data_pages * PAGE_SIZE; 640 cmd->body.sizeInBytes = num_data_pages * PAGE_SIZE;
648 641
649 vmw_fifo_commit(dev_priv, sizeof(*cmd)); 642 vmw_fifo_commit(dev_priv, sizeof(*cmd));
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 813bd0a2abaf..1457ec4b7125 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -264,6 +264,7 @@ static int vmw_gb_shader_destroy(struct vmw_resource *res)
264 if (unlikely(cmd == NULL)) { 264 if (unlikely(cmd == NULL)) {
265 DRM_ERROR("Failed reserving FIFO space for shader " 265 DRM_ERROR("Failed reserving FIFO space for shader "
266 "destruction.\n"); 266 "destruction.\n");
267 mutex_unlock(&dev_priv->binding_mutex);
267 return -ENOMEM; 268 return -ENOMEM;
268 } 269 }
269 270
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 3bb3331acdaf..979da1c246a5 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -1117,6 +1117,7 @@ static int vmw_gb_surface_destroy(struct vmw_resource *res)
1117 if (unlikely(cmd == NULL)) { 1117 if (unlikely(cmd == NULL)) {
1118 DRM_ERROR("Failed reserving FIFO space for surface " 1118 DRM_ERROR("Failed reserving FIFO space for surface "
1119 "destruction.\n"); 1119 "destruction.\n");
1120 mutex_unlock(&dev_priv->binding_mutex);
1120 return -ENOMEM; 1121 return -ENOMEM;
1121 } 1122 }
1122 1123