Skip to content

Commit 41d1d0c

Browse files
committed
Merge tag 'drm-intel-gt-next-2021-04-06' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
Driver Changes: - Prepare for local/device memory support on DG1 by starting to use it for kernel internal allocations: context, ring and engine scratch (Matt A, CQ, Abdiel, Imre) - Sandybridge fix to avoid hard hang on ring resume (Chris) - Limit imported dma-buf size to int32 (Matt A) - Double check heartbeat timeout before resetting (Chris) - Use new tasklet API for execution list (Emil) - Fix SPDX checkpats warnings (Chris) - Fixes for various checkpatch warnings (Chris) - Selftest improvements (Chris) - Move the defer_request waiter active assertion to correct spot (Chris) - Make local-memory probing a GT operation (Matt, Tvrtko) - Protect against request freeing during cancellation on wedging (Chris) - Retire unexpected starting state error dumping (Chris) - Distinction of memory regions in debugging (Zbigniew) - Always flush the submission queue on checking for idle (Chris) - Consolidate 2big error check to helper (Matt) - Decrease number of subplatform bits (Tvrtko) - Remove unused internal request priority levels (Chris) - Document the unused internal header bits in buddy allocator (Matt) - Cleanup the region class/instance encoding (Matt) Signed-off-by: Dave Airlie <[email protected]> From: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 0c79971 + 2da21da commit 41d1d0c

File tree

115 files changed

+735
-844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+735
-844
lines changed

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11404,9 +11404,7 @@ int
1140411404
intel_prepare_plane_fb(struct drm_plane *_plane,
1140511405
struct drm_plane_state *_new_plane_state)
1140611406
{
11407-
struct i915_sched_attr attr = {
11408-
.priority = I915_USER_PRIORITY(I915_PRIORITY_DISPLAY),
11409-
};
11407+
struct i915_sched_attr attr = { .priority = I915_PRIORITY_DISPLAY };
1141011408
struct intel_plane *plane = to_intel_plane(_plane);
1141111409
struct intel_plane_state *new_plane_state =
1141211410
to_intel_plane_state(_new_plane_state);

drivers/gpu/drm/i915/gem/i915_gem_context.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ __create_context(struct drm_i915_private *i915)
649649

650650
kref_init(&ctx->ref);
651651
ctx->i915 = i915;
652-
ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_NORMAL);
652+
ctx->sched.priority = I915_PRIORITY_NORMAL;
653653
mutex_init(&ctx->mutex);
654654
INIT_LIST_HEAD(&ctx->link);
655655

@@ -1966,7 +1966,7 @@ static int set_priority(struct i915_gem_context *ctx,
19661966
!capable(CAP_SYS_NICE))
19671967
return -EPERM;
19681968

1969-
ctx->sched.priority = I915_USER_PRIORITY(priority);
1969+
ctx->sched.priority = priority;
19701970
context_apply_all(ctx, __apply_priority, ctx);
19711971

19721972
return 0;
@@ -2470,7 +2470,7 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
24702470

24712471
case I915_CONTEXT_PARAM_PRIORITY:
24722472
args->size = 0;
2473-
args->value = ctx->sched.priority >> I915_USER_PRIORITY_SHIFT;
2473+
args->value = ctx->sched.priority;
24742474
break;
24752475

24762476
case I915_CONTEXT_PARAM_SSEU:

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
250250
}
251251
}
252252

253+
if (i915_gem_object_size_2big(dma_buf->size))
254+
return ERR_PTR(-E2BIG);
255+
253256
/* need to attach */
254257
attach = dma_buf_attach(dma_buf, dev->dev);
255258
if (IS_ERR(attach))

drivers/gpu/drm/i915/gem/i915_gem_object.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,32 @@
1616
#include "i915_gem_gtt.h"
1717
#include "i915_vma_types.h"
1818

19+
/*
20+
* XXX: There is a prevalence of the assumption that we fit the
21+
* object's page count inside a 32bit _signed_ variable. Let's document
22+
* this and catch if we ever need to fix it. In the meantime, if you do
23+
* spot such a local variable, please consider fixing!
24+
*
25+
* Aside from our own locals (for which we have no excuse!):
26+
* - sg_table embeds unsigned int for num_pages
27+
* - get_user_pages*() mixed ints with longs
28+
*/
29+
#define GEM_CHECK_SIZE_OVERFLOW(sz) \
30+
GEM_WARN_ON((sz) >> PAGE_SHIFT > INT_MAX)
31+
32+
static inline bool i915_gem_object_size_2big(u64 size)
33+
{
34+
struct drm_i915_gem_object *obj;
35+
36+
if (GEM_CHECK_SIZE_OVERFLOW(size))
37+
return true;
38+
39+
if (overflows_type(size, obj->base.size))
40+
return true;
41+
42+
return false;
43+
}
44+
1945
void i915_gem_init__objects(struct drm_i915_private *i915);
2046

2147
struct drm_i915_gem_object *i915_gem_object_alloc(void);

drivers/gpu/drm/i915/gem/i915_gem_region.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,7 @@ i915_gem_object_create_region(struct intel_memory_region *mem,
159159
GEM_BUG_ON(!size);
160160
GEM_BUG_ON(!IS_ALIGNED(size, I915_GTT_MIN_ALIGNMENT));
161161

162-
/*
163-
* XXX: There is a prevalence of the assumption that we fit the
164-
* object's page count inside a 32bit _signed_ variable. Let's document
165-
* this and catch if we ever need to fix it. In the meantime, if you do
166-
* spot such a local variable, please consider fixing!
167-
*/
168-
169-
if (size >> PAGE_SHIFT > INT_MAX)
170-
return ERR_PTR(-E2BIG);
171-
172-
if (overflows_type(size, obj->base.size))
162+
if (i915_gem_object_size_2big(size))
173163
return ERR_PTR(-E2BIG);
174164

175165
obj = i915_gem_object_alloc();

drivers/gpu/drm/i915/gem/i915_gem_stolen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ struct drm_i915_gem_object *
688688
i915_gem_object_create_stolen(struct drm_i915_private *i915,
689689
resource_size_t size)
690690
{
691-
return i915_gem_object_create_region(i915->mm.regions[INTEL_REGION_STOLEN],
691+
return i915_gem_object_create_region(i915->mm.regions[INTEL_REGION_STOLEN_SMEM],
692692
size, I915_BO_ALLOC_CONTIGUOUS);
693693
}
694694

@@ -728,7 +728,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_i915_private *i915,
728728
resource_size_t stolen_offset,
729729
resource_size_t size)
730730
{
731-
struct intel_memory_region *mem = i915->mm.regions[INTEL_REGION_STOLEN];
731+
struct intel_memory_region *mem = i915->mm.regions[INTEL_REGION_STOLEN_SMEM];
732732
struct drm_i915_gem_object *obj;
733733
struct drm_mm_node *stolen;
734734
int ret;

drivers/gpu/drm/i915/gem/i915_gem_userptr.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -508,21 +508,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev,
508508
I915_USERPTR_UNSYNCHRONIZED))
509509
return -EINVAL;
510510

511-
/*
512-
* XXX: There is a prevalence of the assumption that we fit the
513-
* object's page count inside a 32bit _signed_ variable. Let's document
514-
* this and catch if we ever need to fix it. In the meantime, if you do
515-
* spot such a local variable, please consider fixing!
516-
*
517-
* Aside from our own locals (for which we have no excuse!):
518-
* - sg_table embeds unsigned int for num_pages
519-
* - get_user_pages*() mixed ints with longs
520-
*/
521-
522-
if (args->user_size >> PAGE_SHIFT > INT_MAX)
523-
return -E2BIG;
524-
525-
if (overflows_type(args->user_size, obj->base.size))
511+
if (i915_gem_object_size_2big(args->user_size))
526512
return -E2BIG;
527513

528514
if (!args->user_size)

drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int igt_fill_blt_thread(void *arg)
220220
return PTR_ERR(ctx);
221221

222222
prio = i915_prandom_u32_max_state(I915_PRIORITY_MAX, prng);
223-
ctx->sched.priority = I915_USER_PRIORITY(prio);
223+
ctx->sched.priority = prio;
224224
}
225225

226226
ce = i915_gem_context_get_engine(ctx, 0);
@@ -338,7 +338,7 @@ static int igt_copy_blt_thread(void *arg)
338338
return PTR_ERR(ctx);
339339

340340
prio = i915_prandom_u32_max_state(I915_PRIORITY_MAX, prng);
341-
ctx->sched.priority = I915_USER_PRIORITY(prio);
341+
ctx->sched.priority = prio;
342342
}
343343

344344
ce = i915_gem_context_get_engine(ctx, 0);

drivers/gpu/drm/i915/gt/debugfs_gt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// SPDX-License-Identifier: MIT
2-
32
/*
43
* Copyright © 2019 Intel Corporation
54
*/
@@ -37,6 +36,7 @@ void intel_gt_debugfs_register_files(struct dentry *root,
3736
{
3837
while (count--) {
3938
umode_t mode = files->fops->write ? 0644 : 0444;
39+
4040
if (!files->eval || files->eval(data))
4141
debugfs_create_file(files->name,
4242
mode, root, data,

drivers/gpu/drm/i915/gt/gen6_ppgtt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ static inline struct gen6_ppgtt *to_gen6_ppgtt(struct i915_ppgtt *base)
5959
for (iter = gen6_pde_index(start); \
6060
length > 0 && iter < I915_PDES && \
6161
(pt = i915_pt_entry(pd, iter), true); \
62-
({ u32 temp = ALIGN(start+1, 1 << GEN6_PDE_SHIFT); \
62+
({ u32 temp = ALIGN(start + 1, 1 << GEN6_PDE_SHIFT); \
6363
temp = min(temp - start, length); \
64-
start += temp, length -= temp; }), ++iter)
64+
start += temp; length -= temp; }), ++iter)
6565

6666
#define gen6_for_all_pdes(pt, pd, iter) \
6767
for (iter = 0; \

0 commit comments

Comments
 (0)