ttm_bo_vm.c (269634) | ttm_bo_vm.c (280183) |
---|---|
1/************************************************************************** 2 * 3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including --- 22 unchanged lines hidden (view full) --- 31 * Copyright (c) 2013 The FreeBSD Foundation 32 * All rights reserved. 33 * 34 * Portions of this software were developed by Konstantin Belousov 35 * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation. 36 */ 37 38#include <sys/cdefs.h> | 1/************************************************************************** 2 * 3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including --- 22 unchanged lines hidden (view full) --- 31 * Copyright (c) 2013 The FreeBSD Foundation 32 * All rights reserved. 33 * 34 * Portions of this software were developed by Konstantin Belousov 35 * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation. 36 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/sys/dev/drm2/ttm/ttm_bo_vm.c 269634 2014-08-06 17:45:59Z royger $"); | 39__FBSDID("$FreeBSD: head/sys/dev/drm2/ttm/ttm_bo_vm.c 280183 2015-03-17 18:50:33Z dumbbell $"); |
40 41#include "opt_vm.h" 42 43#include <dev/drm2/drmP.h> 44#include <dev/drm2/ttm/ttm_module.h> 45#include <dev/drm2/ttm/ttm_bo_driver.h> 46#include <dev/drm2/ttm/ttm_placement.h> 47 --- 87 unchanged lines hidden (view full) --- 135 } 136 137 if (bdev->driver->fault_reserve_notify) { 138 ret = bdev->driver->fault_reserve_notify(bo); 139 switch (ret) { 140 case 0: 141 break; 142 case -EBUSY: | 40 41#include "opt_vm.h" 42 43#include <dev/drm2/drmP.h> 44#include <dev/drm2/ttm/ttm_module.h> 45#include <dev/drm2/ttm/ttm_bo_driver.h> 46#include <dev/drm2/ttm/ttm_placement.h> 47 --- 87 unchanged lines hidden (view full) --- 135 } 136 137 if (bdev->driver->fault_reserve_notify) { 138 ret = bdev->driver->fault_reserve_notify(bo); 139 switch (ret) { 140 case 0: 141 break; 142 case -EBUSY: |
143 case -ERESTART: | 143 case -ERESTARTSYS: |
144 case -EINTR: 145 kern_yield(0); 146 goto reserve; 147 default: 148 retval = VM_PAGER_ERROR; 149 goto out_unlock; 150 } 151 } --- 182 unchanged lines hidden (view full) --- 334 rw_wlock(&bdev->vm_lock); 335 bo = ttm_bo_vm_lookup_rb(bdev, OFF_TO_IDX(*offset), OFF_TO_IDX(size)); 336 if (likely(bo != NULL)) 337 refcount_acquire(&bo->kref); 338 rw_wunlock(&bdev->vm_lock); 339 340 if (unlikely(bo == NULL)) { 341 printf("[TTM] Could not find buffer object to map\n"); | 144 case -EINTR: 145 kern_yield(0); 146 goto reserve; 147 default: 148 retval = VM_PAGER_ERROR; 149 goto out_unlock; 150 } 151 } --- 182 unchanged lines hidden (view full) --- 334 rw_wlock(&bdev->vm_lock); 335 bo = ttm_bo_vm_lookup_rb(bdev, OFF_TO_IDX(*offset), OFF_TO_IDX(size)); 336 if (likely(bo != NULL)) 337 refcount_acquire(&bo->kref); 338 rw_wunlock(&bdev->vm_lock); 339 340 if (unlikely(bo == NULL)) { 341 printf("[TTM] Could not find buffer object to map\n"); |
342 return (EINVAL); | 342 return (-EINVAL); |
343 } 344 345 driver = bo->bdev->driver; 346 if (unlikely(!driver->verify_access)) { | 343 } 344 345 driver = bo->bdev->driver; 346 if (unlikely(!driver->verify_access)) { |
347 ret = EPERM; | 347 ret = -EPERM; |
348 goto out_unref; 349 } | 348 goto out_unref; 349 } |
350 ret = -driver->verify_access(bo); | 350 ret = driver->verify_access(bo); |
351 if (unlikely(ret != 0)) 352 goto out_unref; 353 354 vm_obj = cdev_pager_allocate(bo, OBJT_MGTDEVICE, &ttm_pager_ops, 355 size, nprot, 0, curthread->td_ucred); 356 if (vm_obj == NULL) { | 351 if (unlikely(ret != 0)) 352 goto out_unref; 353 354 vm_obj = cdev_pager_allocate(bo, OBJT_MGTDEVICE, &ttm_pager_ops, 355 size, nprot, 0, curthread->td_ucred); 356 if (vm_obj == NULL) { |
357 ret = EINVAL; | 357 ret = -EINVAL; |
358 goto out_unref; 359 } 360 /* 361 * Note: We're transferring the bo reference to vm_obj->handle here. 362 */ 363 *offset = 0; 364 *obj_res = vm_obj; 365 return 0; --- 201 unchanged lines hidden --- | 358 goto out_unref; 359 } 360 /* 361 * Note: We're transferring the bo reference to vm_obj->handle here. 362 */ 363 *offset = 0; 364 *obj_res = vm_obj; 365 return 0; --- 201 unchanged lines hidden --- |