| .. | .. |
|---|
| 25 | 25 | * |
|---|
| 26 | 26 | **************************************************************************/ |
|---|
| 27 | 27 | |
|---|
| 28 | +#include <linux/dmapool.h> |
|---|
| 29 | +#include <linux/pci.h> |
|---|
| 30 | + |
|---|
| 28 | 31 | #include <drm/ttm/ttm_bo_api.h> |
|---|
| 29 | 32 | |
|---|
| 30 | 33 | #include "vmwgfx_drv.h" |
|---|
| .. | .. |
|---|
| 393 | 396 | __vmw_cmdbuf_header_free(entry); |
|---|
| 394 | 397 | break; |
|---|
| 395 | 398 | case SVGA_CB_STATUS_COMMAND_ERROR: |
|---|
| 399 | + WARN_ONCE(true, "Command buffer error.\n"); |
|---|
| 396 | 400 | entry->cb_header->status = SVGA_CB_STATUS_NONE; |
|---|
| 397 | 401 | list_add_tail(&entry->list, &man->error); |
|---|
| 398 | 402 | schedule_work(&man->work); |
|---|
| .. | .. |
|---|
| 533 | 537 | global_block = true; |
|---|
| 534 | 538 | |
|---|
| 535 | 539 | if (!vmw_cmd_describe(header, &error_cmd_size, &cmd_name)) { |
|---|
| 536 | | - DRM_ERROR("Unknown command causing device error.\n"); |
|---|
| 537 | | - DRM_ERROR("Command buffer offset is %lu\n", |
|---|
| 538 | | - (unsigned long) cb_hdr->errorOffset); |
|---|
| 540 | + VMW_DEBUG_USER("Unknown command causing device error.\n"); |
|---|
| 541 | + VMW_DEBUG_USER("Command buffer offset is %lu\n", |
|---|
| 542 | + (unsigned long) cb_hdr->errorOffset); |
|---|
| 539 | 543 | __vmw_cmdbuf_header_free(entry); |
|---|
| 540 | 544 | send_fence = true; |
|---|
| 541 | 545 | continue; |
|---|
| 542 | 546 | } |
|---|
| 543 | 547 | |
|---|
| 544 | | - DRM_ERROR("Command \"%s\" causing device error.\n", cmd_name); |
|---|
| 545 | | - DRM_ERROR("Command buffer offset is %lu\n", |
|---|
| 546 | | - (unsigned long) cb_hdr->errorOffset); |
|---|
| 547 | | - DRM_ERROR("Command size is %lu\n", |
|---|
| 548 | | - (unsigned long) error_cmd_size); |
|---|
| 548 | + VMW_DEBUG_USER("Command \"%s\" causing device error.\n", |
|---|
| 549 | + cmd_name); |
|---|
| 550 | + VMW_DEBUG_USER("Command buffer offset is %lu\n", |
|---|
| 551 | + (unsigned long) cb_hdr->errorOffset); |
|---|
| 552 | + VMW_DEBUG_USER("Command size is %lu\n", |
|---|
| 553 | + (unsigned long) error_cmd_size); |
|---|
| 549 | 554 | |
|---|
| 550 | 555 | new_start_offset = cb_hdr->errorOffset + error_cmd_size; |
|---|
| 551 | 556 | |
|---|
| .. | .. |
|---|
| 656 | 661 | { |
|---|
| 657 | 662 | struct vmw_cmdbuf_header *cur = man->cur; |
|---|
| 658 | 663 | |
|---|
| 659 | | - WARN_ON(!mutex_is_locked(&man->cur_mutex)); |
|---|
| 664 | + lockdep_assert_held_once(&man->cur_mutex); |
|---|
| 660 | 665 | |
|---|
| 661 | 666 | if (!cur) |
|---|
| 662 | 667 | return; |
|---|
| .. | .. |
|---|
| 761 | 766 | |
|---|
| 762 | 767 | if (info->done) |
|---|
| 763 | 768 | return true; |
|---|
| 764 | | - |
|---|
| 769 | + |
|---|
| 765 | 770 | memset(info->node, 0, sizeof(*info->node)); |
|---|
| 766 | 771 | spin_lock(&man->lock); |
|---|
| 767 | 772 | ret = drm_mm_insert_node(&man->mm, info->node, info->page_size); |
|---|
| .. | .. |
|---|
| 1041 | 1046 | { |
|---|
| 1042 | 1047 | struct vmw_cmdbuf_header *cur = man->cur; |
|---|
| 1043 | 1048 | |
|---|
| 1044 | | - WARN_ON(!mutex_is_locked(&man->cur_mutex)); |
|---|
| 1049 | + lockdep_assert_held_once(&man->cur_mutex); |
|---|
| 1045 | 1050 | |
|---|
| 1046 | 1051 | WARN_ON(size > cur->reserved); |
|---|
| 1047 | 1052 | man->cur_pos += size; |
|---|
| .. | .. |
|---|
| 1236 | 1241 | * actually call into the already enabled manager, when |
|---|
| 1237 | 1242 | * binding the MOB. |
|---|
| 1238 | 1243 | */ |
|---|
| 1239 | | - if (!(dev_priv->capabilities & SVGA_CAP_DX)) |
|---|
| 1244 | + if (!(dev_priv->capabilities & SVGA_CAP_DX) || |
|---|
| 1245 | + !dev_priv->has_mob) |
|---|
| 1240 | 1246 | return -ENOMEM; |
|---|
| 1241 | 1247 | |
|---|
| 1242 | 1248 | ret = ttm_bo_create(&dev_priv->bdev, size, ttm_bo_type_device, |
|---|
| .. | .. |
|---|
| 1272 | 1278 | return 0; |
|---|
| 1273 | 1279 | |
|---|
| 1274 | 1280 | out_no_map: |
|---|
| 1275 | | - if (man->using_mob) |
|---|
| 1276 | | - ttm_bo_unref(&man->cmd_space); |
|---|
| 1281 | + if (man->using_mob) { |
|---|
| 1282 | + ttm_bo_put(man->cmd_space); |
|---|
| 1283 | + man->cmd_space = NULL; |
|---|
| 1284 | + } |
|---|
| 1277 | 1285 | |
|---|
| 1278 | 1286 | return ret; |
|---|
| 1279 | 1287 | } |
|---|
| .. | .. |
|---|
| 1376 | 1384 | (void) vmw_cmdbuf_idle(man, false, 10*HZ); |
|---|
| 1377 | 1385 | if (man->using_mob) { |
|---|
| 1378 | 1386 | (void) ttm_bo_kunmap(&man->map_obj); |
|---|
| 1379 | | - ttm_bo_unref(&man->cmd_space); |
|---|
| 1387 | + ttm_bo_put(man->cmd_space); |
|---|
| 1388 | + man->cmd_space = NULL; |
|---|
| 1380 | 1389 | } else { |
|---|
| 1381 | 1390 | dma_free_coherent(&man->dev_priv->dev->pdev->dev, |
|---|
| 1382 | 1391 | man->size, man->map, man->handle); |
|---|