diff options
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo_vm.c | 7 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 14 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 8 |
4 files changed, 23 insertions, 35 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 60d8179a8bcd..640fb265dd5a 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -125,7 +125,7 @@ int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, bool interruptible) | |||
125 | ret = wait_event_interruptible(bo->event_queue, | 125 | ret = wait_event_interruptible(bo->event_queue, |
126 | atomic_read(&bo->reserved) == 0); | 126 | atomic_read(&bo->reserved) == 0); |
127 | if (unlikely(ret != 0)) | 127 | if (unlikely(ret != 0)) |
128 | return -ERESTART; | 128 | return ret; |
129 | } else { | 129 | } else { |
130 | wait_event(bo->event_queue, atomic_read(&bo->reserved) == 0); | 130 | wait_event(bo->event_queue, atomic_read(&bo->reserved) == 0); |
131 | } | 131 | } |
@@ -571,7 +571,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, | |||
571 | spin_unlock(&bo->lock); | 571 | spin_unlock(&bo->lock); |
572 | 572 | ||
573 | if (unlikely(ret != 0)) { | 573 | if (unlikely(ret != 0)) { |
574 | if (ret != -ERESTART) { | 574 | if (ret != -ERESTARTSYS) { |
575 | printk(KERN_ERR TTM_PFX | 575 | printk(KERN_ERR TTM_PFX |
576 | "Failed to expire sync object before " | 576 | "Failed to expire sync object before " |
577 | "buffer eviction.\n"); | 577 | "buffer eviction.\n"); |
@@ -588,7 +588,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, | |||
588 | ret = ttm_bo_mem_space(bo, &placement, &evict_mem, interruptible, | 588 | ret = ttm_bo_mem_space(bo, &placement, &evict_mem, interruptible, |
589 | no_wait); | 589 | no_wait); |
590 | if (ret) { | 590 | if (ret) { |
591 | if (ret != -ERESTART) | 591 | if (ret != -ERESTARTSYS) |
592 | printk(KERN_ERR TTM_PFX | 592 | printk(KERN_ERR TTM_PFX |
593 | "Failed to find memory space for " | 593 | "Failed to find memory space for " |
594 | "buffer 0x%p eviction.\n", bo); | 594 | "buffer 0x%p eviction.\n", bo); |
@@ -598,7 +598,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, | |||
598 | ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible, | 598 | ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible, |
599 | no_wait); | 599 | no_wait); |
600 | if (ret) { | 600 | if (ret) { |
601 | if (ret != -ERESTART) | 601 | if (ret != -ERESTARTSYS) |
602 | printk(KERN_ERR TTM_PFX "Buffer eviction failed\n"); | 602 | printk(KERN_ERR TTM_PFX "Buffer eviction failed\n"); |
603 | spin_lock(&glob->lru_lock); | 603 | spin_lock(&glob->lru_lock); |
604 | if (evict_mem.mm_node) { | 604 | if (evict_mem.mm_node) { |
@@ -795,7 +795,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
795 | uint32_t cur_flags = 0; | 795 | uint32_t cur_flags = 0; |
796 | bool type_found = false; | 796 | bool type_found = false; |
797 | bool type_ok = false; | 797 | bool type_ok = false; |
798 | bool has_eagain = false; | 798 | bool has_erestartsys = false; |
799 | struct drm_mm_node *node = NULL; | 799 | struct drm_mm_node *node = NULL; |
800 | int i, ret; | 800 | int i, ret; |
801 | 801 | ||
@@ -882,28 +882,21 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
882 | mem->mm_node->private = bo; | 882 | mem->mm_node->private = bo; |
883 | return 0; | 883 | return 0; |
884 | } | 884 | } |
885 | if (ret == -ERESTART) | 885 | if (ret == -ERESTARTSYS) |
886 | has_eagain = true; | 886 | has_erestartsys = true; |
887 | } | 887 | } |
888 | ret = (has_eagain) ? -ERESTART : -ENOMEM; | 888 | ret = (has_erestartsys) ? -ERESTARTSYS : -ENOMEM; |
889 | return ret; | 889 | return ret; |
890 | } | 890 | } |
891 | EXPORT_SYMBOL(ttm_bo_mem_space); | 891 | EXPORT_SYMBOL(ttm_bo_mem_space); |
892 | 892 | ||
893 | int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait) | 893 | int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait) |
894 | { | 894 | { |
895 | int ret = 0; | ||
896 | |||
897 | if ((atomic_read(&bo->cpu_writers) > 0) && no_wait) | 895 | if ((atomic_read(&bo->cpu_writers) > 0) && no_wait) |
898 | return -EBUSY; | 896 | return -EBUSY; |
899 | 897 | ||
900 | ret = wait_event_interruptible(bo->event_queue, | 898 | return wait_event_interruptible(bo->event_queue, |
901 | atomic_read(&bo->cpu_writers) == 0); | 899 | atomic_read(&bo->cpu_writers) == 0); |
902 | |||
903 | if (ret == -ERESTARTSYS) | ||
904 | ret = -ERESTART; | ||
905 | |||
906 | return ret; | ||
907 | } | 900 | } |
908 | 901 | ||
909 | int ttm_bo_move_buffer(struct ttm_buffer_object *bo, | 902 | int ttm_bo_move_buffer(struct ttm_buffer_object *bo, |
@@ -1673,7 +1666,7 @@ int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible, | |||
1673 | ret = wait_event_interruptible | 1666 | ret = wait_event_interruptible |
1674 | (bo->event_queue, atomic_read(&bo->reserved) == 0); | 1667 | (bo->event_queue, atomic_read(&bo->reserved) == 0); |
1675 | if (unlikely(ret != 0)) | 1668 | if (unlikely(ret != 0)) |
1676 | return -ERESTART; | 1669 | return ret; |
1677 | } else { | 1670 | } else { |
1678 | wait_event(bo->event_queue, | 1671 | wait_event(bo->event_queue, |
1679 | atomic_read(&bo->reserved) == 0); | 1672 | atomic_read(&bo->reserved) == 0); |
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 1c040d040338..609a85a4d855 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c | |||
@@ -114,7 +114,7 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
114 | ret = ttm_bo_wait(bo, false, true, false); | 114 | ret = ttm_bo_wait(bo, false, true, false); |
115 | spin_unlock(&bo->lock); | 115 | spin_unlock(&bo->lock); |
116 | if (unlikely(ret != 0)) { | 116 | if (unlikely(ret != 0)) { |
117 | retval = (ret != -ERESTART) ? | 117 | retval = (ret != -ERESTARTSYS) ? |
118 | VM_FAULT_SIGBUS : VM_FAULT_NOPAGE; | 118 | VM_FAULT_SIGBUS : VM_FAULT_NOPAGE; |
119 | goto out_unlock; | 119 | goto out_unlock; |
120 | } | 120 | } |
@@ -349,9 +349,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, | |||
349 | switch (ret) { | 349 | switch (ret) { |
350 | case 0: | 350 | case 0: |
351 | break; | 351 | break; |
352 | case -ERESTART: | ||
353 | ret = -EINTR; | ||
354 | goto out_unref; | ||
355 | case -EBUSY: | 352 | case -EBUSY: |
356 | ret = -EAGAIN; | 353 | ret = -EAGAIN; |
357 | goto out_unref; | 354 | goto out_unref; |
@@ -421,8 +418,6 @@ ssize_t ttm_bo_fbdev_io(struct ttm_buffer_object *bo, const char __user *wbuf, | |||
421 | switch (ret) { | 418 | switch (ret) { |
422 | case 0: | 419 | case 0: |
423 | break; | 420 | break; |
424 | case -ERESTART: | ||
425 | return -EINTR; | ||
426 | case -EBUSY: | 421 | case -EBUSY: |
427 | return -EAGAIN; | 422 | return -EAGAIN; |
428 | default: | 423 | default: |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 2f7f56da2147..4fd498523ce3 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
@@ -303,7 +303,7 @@ ttm_bo_reference(struct ttm_buffer_object *bo) | |||
303 | * Note: It might be necessary to block validations before the | 303 | * Note: It might be necessary to block validations before the |
304 | * wait by reserving the buffer. | 304 | * wait by reserving the buffer. |
305 | * Returns -EBUSY if no_wait is true and the buffer is busy. | 305 | * Returns -EBUSY if no_wait is true and the buffer is busy. |
306 | * Returns -ERESTART if interrupted by a signal. | 306 | * Returns -ERESTARTSYS if interrupted by a signal. |
307 | */ | 307 | */ |
308 | extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, | 308 | extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, |
309 | bool interruptible, bool no_wait); | 309 | bool interruptible, bool no_wait); |
@@ -321,7 +321,7 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, | |||
321 | * -EINVAL on invalid proposed placement. | 321 | * -EINVAL on invalid proposed placement. |
322 | * -ENOMEM on out-of-memory condition. | 322 | * -ENOMEM on out-of-memory condition. |
323 | * -EBUSY if no_wait is true and buffer busy. | 323 | * -EBUSY if no_wait is true and buffer busy. |
324 | * -ERESTART if interrupted by a signal. | 324 | * -ERESTARTSYS if interrupted by a signal. |
325 | */ | 325 | */ |
326 | extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo, | 326 | extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo, |
327 | struct ttm_placement *placement, | 327 | struct ttm_placement *placement, |
@@ -347,7 +347,7 @@ extern void ttm_bo_unref(struct ttm_buffer_object **bo); | |||
347 | * waiting for buffer idle. This lock is recursive. | 347 | * waiting for buffer idle. This lock is recursive. |
348 | * Returns | 348 | * Returns |
349 | * -EBUSY if the buffer is busy and no_wait is true. | 349 | * -EBUSY if the buffer is busy and no_wait is true. |
350 | * -ERESTART if interrupted by a signal. | 350 | * -ERESTARTSYS if interrupted by a signal. |
351 | */ | 351 | */ |
352 | 352 | ||
353 | extern int | 353 | extern int |
@@ -390,7 +390,7 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); | |||
390 | * Returns | 390 | * Returns |
391 | * -ENOMEM: Out of memory. | 391 | * -ENOMEM: Out of memory. |
392 | * -EINVAL: Invalid placement flags. | 392 | * -EINVAL: Invalid placement flags. |
393 | * -ERESTART: Interrupted by signal while sleeping waiting for resources. | 393 | * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources. |
394 | */ | 394 | */ |
395 | 395 | ||
396 | extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, | 396 | extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, |
@@ -430,7 +430,7 @@ extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, | |||
430 | * Returns | 430 | * Returns |
431 | * -ENOMEM: Out of memory. | 431 | * -ENOMEM: Out of memory. |
432 | * -EINVAL: Invalid placement flags. | 432 | * -EINVAL: Invalid placement flags. |
433 | * -ERESTART: Interrupted by signal while waiting for resources. | 433 | * -ERESTARTSYS: Interrupted by signal while waiting for resources. |
434 | */ | 434 | */ |
435 | 435 | ||
436 | extern int ttm_buffer_object_create(struct ttm_bo_device *bdev, | 436 | extern int ttm_buffer_object_create(struct ttm_bo_device *bdev, |
@@ -521,7 +521,7 @@ extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type); | |||
521 | * | 521 | * |
522 | * Returns: | 522 | * Returns: |
523 | * -EINVAL: Invalid or uninitialized memory type. | 523 | * -EINVAL: Invalid or uninitialized memory type. |
524 | * -ERESTART: The call was interrupted by a signal while waiting to | 524 | * -ERESTARTSYS: The call was interrupted by a signal while waiting to |
525 | * evict a buffer. | 525 | * evict a buffer. |
526 | */ | 526 | */ |
527 | 527 | ||
@@ -624,7 +624,7 @@ extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, | |||
624 | * be called from the fops::read and fops::write method. | 624 | * be called from the fops::read and fops::write method. |
625 | * Returns: | 625 | * Returns: |
626 | * See man (2) write, man(2) read. In particular, | 626 | * See man (2) write, man(2) read. In particular, |
627 | * the function may return -EINTR if | 627 | * the function may return -ERESTARTSYS if |
628 | * interrupted by a signal. | 628 | * interrupted by a signal. |
629 | */ | 629 | */ |
630 | 630 | ||
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index fa5c9e51ee7e..ff7664e0c3cd 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -638,7 +638,7 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, | |||
638 | * -EBUSY: No space available (only if no_wait == 1). | 638 | * -EBUSY: No space available (only if no_wait == 1). |
639 | * -ENOMEM: Could not allocate memory for the buffer object, either due to | 639 | * -ENOMEM: Could not allocate memory for the buffer object, either due to |
640 | * fragmentation or concurrent allocators. | 640 | * fragmentation or concurrent allocators. |
641 | * -ERESTART: An interruptible sleep was interrupted by a signal. | 641 | * -ERESTARTSYS: An interruptible sleep was interrupted by a signal. |
642 | */ | 642 | */ |
643 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | 643 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, |
644 | struct ttm_placement *placement, | 644 | struct ttm_placement *placement, |
@@ -653,7 +653,7 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
653 | * Wait until a buffer object is no longer sync'ed for CPU access. | 653 | * Wait until a buffer object is no longer sync'ed for CPU access. |
654 | * Returns: | 654 | * Returns: |
655 | * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). | 655 | * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). |
656 | * -ERESTART: An interruptible sleep was interrupted by a signal. | 656 | * -ERESTARTSYS: An interruptible sleep was interrupted by a signal. |
657 | */ | 657 | */ |
658 | 658 | ||
659 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); | 659 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); |
@@ -757,7 +757,7 @@ extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo); | |||
757 | * -EAGAIN: The reservation may cause a deadlock. | 757 | * -EAGAIN: The reservation may cause a deadlock. |
758 | * Release all buffer reservations, wait for @bo to become unreserved and | 758 | * Release all buffer reservations, wait for @bo to become unreserved and |
759 | * try again. (only if use_sequence == 1). | 759 | * try again. (only if use_sequence == 1). |
760 | * -ERESTART: A wait for the buffer to become unreserved was interrupted by | 760 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by |
761 | * a signal. Release all buffer reservations and return to user-space. | 761 | * a signal. Release all buffer reservations and return to user-space. |
762 | */ | 762 | */ |
763 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | 763 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, |
@@ -798,7 +798,7 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, | |||
798 | * | 798 | * |
799 | * Returns: | 799 | * Returns: |
800 | * -EBUSY: If no_wait == 1 and the buffer is already reserved. | 800 | * -EBUSY: If no_wait == 1 and the buffer is already reserved. |
801 | * -ERESTART: If interruptible == 1 and the process received a signal | 801 | * -ERESTARTSYS: If interruptible == 1 and the process received a signal |
802 | * while sleeping. | 802 | * while sleeping. |
803 | */ | 803 | */ |
804 | extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo, | 804 | extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo, |