aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 340dfb11959d..ce464579c485 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1119,35 +1119,9 @@ EXPORT_SYMBOL(ttm_bo_validate);
1119int ttm_bo_check_placement(struct ttm_buffer_object *bo, 1119int ttm_bo_check_placement(struct ttm_buffer_object *bo,
1120 struct ttm_placement *placement) 1120 struct ttm_placement *placement)
1121{ 1121{
1122 int i; 1122 BUG_ON((placement->fpfn || placement->lpfn) &&
1123 (bo->mem.num_pages > (placement->lpfn - placement->fpfn)));
1123 1124
1124 if (placement->fpfn || placement->lpfn) {
1125 if (bo->mem.num_pages > (placement->lpfn - placement->fpfn)) {
1126 printk(KERN_ERR TTM_PFX "Page number range to small "
1127 "Need %lu pages, range is [%u, %u]\n",
1128 bo->mem.num_pages, placement->fpfn,
1129 placement->lpfn);
1130 return -EINVAL;
1131 }
1132 }
1133 for (i = 0; i < placement->num_placement; i++) {
1134 if (!capable(CAP_SYS_ADMIN)) {
1135 if (placement->placement[i] & TTM_PL_FLAG_NO_EVICT) {
1136 printk(KERN_ERR TTM_PFX "Need to be root to "
1137 "modify NO_EVICT status.\n");
1138 return -EINVAL;
1139 }
1140 }
1141 }
1142 for (i = 0; i < placement->num_busy_placement; i++) {
1143 if (!capable(CAP_SYS_ADMIN)) {
1144 if (placement->busy_placement[i] & TTM_PL_FLAG_NO_EVICT) {
1145 printk(KERN_ERR TTM_PFX "Need to be root to "
1146 "modify NO_EVICT status.\n");
1147 return -EINVAL;
1148 }
1149 }
1150 }
1151 return 0; 1125 return 0;
1152} 1126}
1153 1127