Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Remove I915_USER_PRIORITY_SHIFT

As we do not have any internal priority levels, the priority can be set
directed from the user values.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210120121439.17600-2-chris@chris-wilson.co.uk
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

authored by

Chris Wilson and committed by
Daniel Vetter
eb5c10cb 2867ff6c

+24 -48
+1 -3
drivers/gpu/drm/i915/display/intel_display.c
··· 11382 11382 intel_prepare_plane_fb(struct drm_plane *_plane, 11383 11383 struct drm_plane_state *_new_plane_state) 11384 11384 { 11385 - struct i915_sched_attr attr = { 11386 - .priority = I915_USER_PRIORITY(I915_PRIORITY_DISPLAY), 11387 - }; 11385 + struct i915_sched_attr attr = { .priority = I915_PRIORITY_DISPLAY }; 11388 11386 struct intel_plane *plane = to_intel_plane(_plane); 11389 11387 struct intel_plane_state *new_plane_state = 11390 11388 to_intel_plane_state(_new_plane_state);
+3 -3
drivers/gpu/drm/i915/gem/i915_gem_context.c
··· 679 679 680 680 kref_init(&ctx->ref); 681 681 ctx->i915 = i915; 682 - ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_NORMAL); 682 + ctx->sched.priority = I915_PRIORITY_NORMAL; 683 683 mutex_init(&ctx->mutex); 684 684 INIT_LIST_HEAD(&ctx->link); 685 685 ··· 1959 1959 !capable(CAP_SYS_NICE)) 1960 1960 return -EPERM; 1961 1961 1962 - ctx->sched.priority = I915_USER_PRIORITY(priority); 1962 + ctx->sched.priority = priority; 1963 1963 context_apply_all(ctx, __apply_priority, ctx); 1964 1964 1965 1965 return 0; ··· 2463 2463 2464 2464 case I915_CONTEXT_PARAM_PRIORITY: 2465 2465 args->size = 0; 2466 - args->value = ctx->sched.priority >> I915_USER_PRIORITY_SHIFT; 2466 + args->value = ctx->sched.priority; 2467 2467 break; 2468 2468 2469 2469 case I915_CONTEXT_PARAM_SSEU:
+2 -2
drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
··· 220 220 return PTR_ERR(ctx); 221 221 222 222 prio = i915_prandom_u32_max_state(I915_PRIORITY_MAX, prng); 223 - ctx->sched.priority = I915_USER_PRIORITY(prio); 223 + ctx->sched.priority = prio; 224 224 } 225 225 226 226 ce = i915_gem_context_get_engine(ctx, 0); ··· 338 338 return PTR_ERR(ctx); 339 339 340 340 prio = i915_prandom_u32_max_state(I915_PRIORITY_MAX, prng); 341 - ctx->sched.priority = I915_USER_PRIORITY(prio); 341 + ctx->sched.priority = prio; 342 342 } 343 343 344 344 ce = i915_gem_context_get_engine(ctx, 0);
+3 -7
drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
··· 81 81 82 82 static void heartbeat(struct work_struct *wrk) 83 83 { 84 - struct i915_sched_attr attr = { 85 - .priority = I915_USER_PRIORITY(I915_PRIORITY_MIN), 86 - }; 84 + struct i915_sched_attr attr = { .priority = I915_PRIORITY_MIN }; 87 85 struct intel_engine_cs *engine = 88 86 container_of(wrk, typeof(*engine), heartbeat.work.work); 89 87 struct intel_context *ce = engine->kernel_context; ··· 125 127 */ 126 128 attr.priority = 0; 127 129 if (rq->sched.attr.priority >= attr.priority) 128 - attr.priority |= I915_USER_PRIORITY(I915_PRIORITY_HEARTBEAT); 130 + attr.priority = I915_PRIORITY_HEARTBEAT; 129 131 if (rq->sched.attr.priority >= attr.priority) 130 132 attr.priority = I915_PRIORITY_BARRIER; 131 133 ··· 283 285 284 286 int intel_engine_flush_barriers(struct intel_engine_cs *engine) 285 287 { 286 - struct i915_sched_attr attr = { 287 - .priority = I915_USER_PRIORITY(I915_PRIORITY_MIN), 288 - }; 288 + struct i915_sched_attr attr = { .priority = I915_PRIORITY_MIN }; 289 289 struct intel_context *ce = engine->kernel_context; 290 290 struct i915_request *rq; 291 291 int err;
+15 -29
drivers/gpu/drm/i915/gt/selftest_execlists.c
··· 321 321 322 322 static int live_unlite_preempt(void *arg) 323 323 { 324 - return live_unlite_restore(arg, I915_USER_PRIORITY(I915_PRIORITY_MAX)); 324 + return live_unlite_restore(arg, I915_PRIORITY_MAX); 325 325 } 326 326 327 327 static int live_unlite_ring(void *arg) ··· 1311 1311 goto err_pin; 1312 1312 1313 1313 for_each_engine(engine, gt, id) { 1314 - struct i915_sched_attr attr = { 1315 - .priority = I915_USER_PRIORITY(I915_PRIORITY_MAX), 1316 - }; 1314 + struct i915_sched_attr attr = { .priority = I915_PRIORITY_MAX }; 1317 1315 struct i915_request *rq, *nop; 1318 1316 1319 1317 if (!intel_engine_has_preemption(engine)) ··· 1526 1528 ctx_hi = kernel_context(gt->i915); 1527 1529 if (!ctx_hi) 1528 1530 return -ENOMEM; 1529 - ctx_hi->sched.priority = 1530 - I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY); 1531 + ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY; 1531 1532 1532 1533 ctx_lo = kernel_context(gt->i915); 1533 1534 if (!ctx_lo) 1534 1535 goto err_ctx_hi; 1535 - ctx_lo->sched.priority = 1536 - I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY); 1536 + ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY; 1537 1537 1538 1538 obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE); 1539 1539 if (IS_ERR(obj)) { ··· 1728 1732 ctx_hi = kernel_context(gt->i915); 1729 1733 if (!ctx_hi) 1730 1734 goto err_spin_lo; 1731 - ctx_hi->sched.priority = 1732 - I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY); 1735 + ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY; 1733 1736 1734 1737 ctx_lo = kernel_context(gt->i915); 1735 1738 if (!ctx_lo) 1736 1739 goto err_ctx_hi; 1737 - ctx_lo->sched.priority = 1738 - I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY); 1740 + ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY; 1739 1741 1740 1742 for_each_engine(engine, gt, id) { 1741 1743 struct igt_live_test t; ··· 1826 1832 goto err_ctx_hi; 1827 1833 1828 1834 /* Make sure ctx_lo stays before ctx_hi until we trigger preemption. */ 1829 - ctx_lo->sched.priority = I915_USER_PRIORITY(1); 1835 + ctx_lo->sched.priority = 1; 1830 1836 1831 1837 for_each_engine(engine, gt, id) { 1832 1838 struct igt_live_test t; ··· 1867 1873 goto err_wedged; 1868 1874 } 1869 1875 1870 - attr.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX); 1876 + attr.priority = I915_PRIORITY_MAX; 1871 1877 engine->schedule(rq, &attr); 1872 1878 1873 1879 if (!igt_wait_for_spinner(&spin_hi, rq)) { ··· 1948 1954 return -ENOMEM; 1949 1955 if (preempt_client_init(gt, &b)) 1950 1956 goto err_client_a; 1951 - b.ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX); 1957 + b.ctx->sched.priority = I915_PRIORITY_MAX; 1952 1958 1953 1959 for_each_engine(engine, gt, id) { 1954 1960 struct i915_request *rq_a, *rq_b; ··· 2413 2419 2414 2420 static int live_suppress_self_preempt(void *arg) 2415 2421 { 2422 + struct i915_sched_attr attr = { .priority = I915_PRIORITY_MAX }; 2416 2423 struct intel_gt *gt = arg; 2417 2424 struct intel_engine_cs *engine; 2418 - struct i915_sched_attr attr = { 2419 - .priority = I915_USER_PRIORITY(I915_PRIORITY_MAX) 2420 - }; 2421 2425 struct preempt_client a, b; 2422 2426 enum intel_engine_id id; 2423 2427 int err = -ENOMEM; ··· 2546 2554 goto err_client_hi; 2547 2555 2548 2556 for_each_engine(engine, gt, id) { 2549 - struct i915_sched_attr attr = { 2550 - .priority = I915_USER_PRIORITY(I915_PRIORITY_MAX), 2551 - }; 2557 + struct i915_sched_attr attr = { .priority = I915_PRIORITY_MAX }; 2552 2558 struct igt_live_test t; 2553 2559 struct i915_request *rq; 2554 2560 int ring_size, count, i; ··· 2965 2975 return -EIO; 2966 2976 2967 2977 do { 2968 - struct i915_sched_attr attr = { 2969 - .priority = I915_USER_PRIORITY(prio++), 2970 - }; 2978 + struct i915_sched_attr attr = { .priority = prio++ }; 2971 2979 2972 2980 err = create_gang(engine, &rq); 2973 2981 if (err) ··· 3001 3013 drm_info_printer(engine->i915->drm.dev); 3002 3014 3003 3015 pr_err("Failed to flush chain of %d requests, at %d\n", 3004 - prio, rq_prio(rq) >> I915_USER_PRIORITY_SHIFT); 3016 + prio, rq_prio(rq)); 3005 3017 intel_engine_dump(engine, &p, 3006 3018 "%s\n", engine->name); 3007 3019 ··· 3371 3383 ctx_hi = kernel_context(gt->i915); 3372 3384 if (!ctx_hi) 3373 3385 goto err_spin_lo; 3374 - ctx_hi->sched.priority = 3375 - I915_USER_PRIORITY(I915_CONTEXT_MAX_USER_PRIORITY); 3386 + ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY; 3376 3387 3377 3388 ctx_lo = kernel_context(gt->i915); 3378 3389 if (!ctx_lo) 3379 3390 goto err_ctx_hi; 3380 - ctx_lo->sched.priority = 3381 - I915_USER_PRIORITY(I915_CONTEXT_MIN_USER_PRIORITY); 3391 + ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY; 3382 3392 3383 3393 for_each_engine(engine, gt, id) { 3384 3394 unsigned long saved_timeout;
-3
drivers/gpu/drm/i915/i915_priolist_types.h
··· 24 24 I915_PRIORITY_DISPLAY, 25 25 }; 26 26 27 - #define I915_USER_PRIORITY_SHIFT 0 28 - #define I915_USER_PRIORITY(x) ((x) << I915_USER_PRIORITY_SHIFT) 29 - 30 27 /* Smallest priority value that cannot be bumped. */ 31 28 #define I915_PRIORITY_INVALID (INT_MIN) 32 29
-1
drivers/gpu/drm/i915/i915_scheduler.c
··· 71 71 lockdep_assert_held(&engine->active.lock); 72 72 assert_priolists(execlists); 73 73 74 - prio >>= I915_USER_PRIORITY_SHIFT; 75 74 if (unlikely(execlists->no_priolist)) 76 75 prio = I915_PRIORITY_NORMAL; 77 76