Skip to content

Commit 80af1f5

Browse files
committed
Merge tag 'drm-xe-fixes-2024-03-26' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes
- Fix build on mips - Fix wrong bound checks - Fix use of msec rather than jiffies - Remove dead code Signed-off-by: Dave Airlie <[email protected]> From: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/a47jbz45nry4gjmtyresaraakwnasgngncltmrshbfkx25mhzu@bvay7j3ed7ir
2 parents 4cece76 + 0d8cf0c commit 80af1f5

File tree

7 files changed

+23
-85
lines changed

7 files changed

+23
-85
lines changed

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ static void try_add_system(struct xe_device *xe, struct xe_bo *bo,
144144
.mem_type = XE_PL_TT,
145145
};
146146
*c += 1;
147-
148-
if (bo->props.preferred_mem_type == XE_BO_PROPS_INVALID)
149-
bo->props.preferred_mem_type = XE_PL_TT;
150147
}
151148
}
152149

@@ -181,25 +178,15 @@ static void add_vram(struct xe_device *xe, struct xe_bo *bo,
181178
}
182179
places[*c] = place;
183180
*c += 1;
184-
185-
if (bo->props.preferred_mem_type == XE_BO_PROPS_INVALID)
186-
bo->props.preferred_mem_type = mem_type;
187181
}
188182

189183
static void try_add_vram(struct xe_device *xe, struct xe_bo *bo,
190184
u32 bo_flags, u32 *c)
191185
{
192-
if (bo->props.preferred_gt == XE_GT1) {
193-
if (bo_flags & XE_BO_CREATE_VRAM1_BIT)
194-
add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM1, c);
195-
if (bo_flags & XE_BO_CREATE_VRAM0_BIT)
196-
add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM0, c);
197-
} else {
198-
if (bo_flags & XE_BO_CREATE_VRAM0_BIT)
199-
add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM0, c);
200-
if (bo_flags & XE_BO_CREATE_VRAM1_BIT)
201-
add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM1, c);
202-
}
186+
if (bo_flags & XE_BO_CREATE_VRAM0_BIT)
187+
add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM0, c);
188+
if (bo_flags & XE_BO_CREATE_VRAM1_BIT)
189+
add_vram(xe, bo, bo->placements, bo_flags, XE_PL_VRAM1, c);
203190
}
204191

205192
static void try_add_stolen(struct xe_device *xe, struct xe_bo *bo,
@@ -223,17 +210,8 @@ static int __xe_bo_placement_for_flags(struct xe_device *xe, struct xe_bo *bo,
223210
{
224211
u32 c = 0;
225212

226-
bo->props.preferred_mem_type = XE_BO_PROPS_INVALID;
227-
228-
/* The order of placements should indicate preferred location */
229-
230-
if (bo->props.preferred_mem_class == DRM_XE_MEM_REGION_CLASS_SYSMEM) {
231-
try_add_system(xe, bo, bo_flags, &c);
232-
try_add_vram(xe, bo, bo_flags, &c);
233-
} else {
234-
try_add_vram(xe, bo, bo_flags, &c);
235-
try_add_system(xe, bo, bo_flags, &c);
236-
}
213+
try_add_vram(xe, bo, bo_flags, &c);
214+
try_add_system(xe, bo, bo_flags, &c);
237215
try_add_stolen(xe, bo, bo_flags, &c);
238216

239217
if (!c)
@@ -1126,13 +1104,6 @@ static void xe_gem_object_close(struct drm_gem_object *obj,
11261104
}
11271105
}
11281106

1129-
static bool should_migrate_to_system(struct xe_bo *bo)
1130-
{
1131-
struct xe_device *xe = xe_bo_device(bo);
1132-
1133-
return xe_device_in_fault_mode(xe) && bo->props.cpu_atomic;
1134-
}
1135-
11361107
static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
11371108
{
11381109
struct ttm_buffer_object *tbo = vmf->vma->vm_private_data;
@@ -1141,7 +1112,7 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
11411112
struct xe_bo *bo = ttm_to_xe_bo(tbo);
11421113
bool needs_rpm = bo->flags & XE_BO_CREATE_VRAM_MASK;
11431114
vm_fault_t ret;
1144-
int idx, r = 0;
1115+
int idx;
11451116

11461117
if (needs_rpm)
11471118
xe_device_mem_access_get(xe);
@@ -1153,17 +1124,8 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
11531124
if (drm_dev_enter(ddev, &idx)) {
11541125
trace_xe_bo_cpu_fault(bo);
11551126

1156-
if (should_migrate_to_system(bo)) {
1157-
r = xe_bo_migrate(bo, XE_PL_TT);
1158-
if (r == -EBUSY || r == -ERESTARTSYS || r == -EINTR)
1159-
ret = VM_FAULT_NOPAGE;
1160-
else if (r)
1161-
ret = VM_FAULT_SIGBUS;
1162-
}
1163-
if (!ret)
1164-
ret = ttm_bo_vm_fault_reserved(vmf,
1165-
vmf->vma->vm_page_prot,
1166-
TTM_BO_VM_NUM_PREFAULT);
1127+
ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
1128+
TTM_BO_VM_NUM_PREFAULT);
11671129
drm_dev_exit(idx);
11681130
} else {
11691131
ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot);
@@ -1291,9 +1253,6 @@ struct xe_bo *___xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
12911253
bo->flags = flags;
12921254
bo->cpu_caching = cpu_caching;
12931255
bo->ttm.base.funcs = &xe_gem_object_funcs;
1294-
bo->props.preferred_mem_class = XE_BO_PROPS_INVALID;
1295-
bo->props.preferred_gt = XE_BO_PROPS_INVALID;
1296-
bo->props.preferred_mem_type = XE_BO_PROPS_INVALID;
12971256
bo->ttm.priority = XE_BO_PRIORITY_NORMAL;
12981257
INIT_LIST_HEAD(&bo->pinned_link);
12991258
#ifdef CONFIG_PROC_FS

drivers/gpu/drm/xe/xe_bo_types.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,6 @@ struct xe_bo {
5656
*/
5757
struct list_head client_link;
5858
#endif
59-
/** @props: BO user controlled properties */
60-
struct {
61-
/** @preferred_mem: preferred memory class for this BO */
62-
s16 preferred_mem_class;
63-
/** @prefered_gt: preferred GT for this BO */
64-
s16 preferred_gt;
65-
/** @preferred_mem_type: preferred memory type */
66-
s32 preferred_mem_type;
67-
/**
68-
* @cpu_atomic: the CPU expects to do atomics operations to
69-
* this BO
70-
*/
71-
bool cpu_atomic;
72-
/**
73-
* @device_atomic: the device expects to do atomics operations
74-
* to this BO
75-
*/
76-
bool device_atomic;
77-
} props;
7859
/** @freed: List node for delayed put. */
7960
struct llist_node freed;
8061
/** @created: Whether the bo has passed initial creation */

drivers/gpu/drm/xe/xe_device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static inline struct xe_tile *xe_device_get_root_tile(struct xe_device *xe)
5858

5959
static inline struct xe_gt *xe_tile_get_gt(struct xe_tile *tile, u8 gt_id)
6060
{
61-
if (drm_WARN_ON(&tile_to_xe(tile)->drm, gt_id > XE_MAX_GT_PER_TILE))
61+
if (drm_WARN_ON(&tile_to_xe(tile)->drm, gt_id >= XE_MAX_GT_PER_TILE))
6262
gt_id = 0;
6363

6464
return gt_id ? tile->media_gt : tile->primary_gt;
@@ -79,7 +79,7 @@ static inline struct xe_gt *xe_device_get_gt(struct xe_device *xe, u8 gt_id)
7979
if (MEDIA_VER(xe) >= 13) {
8080
gt = xe_tile_get_gt(root_tile, gt_id);
8181
} else {
82-
if (drm_WARN_ON(&xe->drm, gt_id > XE_MAX_TILES_PER_DEVICE))
82+
if (drm_WARN_ON(&xe->drm, gt_id >= XE_MAX_TILES_PER_DEVICE))
8383
gt_id = 0;
8484

8585
gt = xe->tiles[gt_id].primary_gt;

drivers/gpu/drm/xe/xe_exec_queue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ find_hw_engine(struct xe_device *xe,
448448
{
449449
u32 idx;
450450

451-
if (eci.engine_class > ARRAY_SIZE(user_to_xe_engine_class))
451+
if (eci.engine_class >= ARRAY_SIZE(user_to_xe_engine_class))
452452
return NULL;
453453

454454
if (eci.gt_id >= xe->info.gt_count)

drivers/gpu/drm/xe/xe_guc_submit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
12201220
init_waitqueue_head(&ge->suspend_wait);
12211221

12221222
timeout = (q->vm && xe_vm_in_lr_mode(q->vm)) ? MAX_SCHEDULE_TIMEOUT :
1223-
q->sched_props.job_timeout_ms;
1223+
msecs_to_jiffies(q->sched_props.job_timeout_ms);
12241224
err = xe_sched_init(&ge->sched, &drm_sched_ops, &xe_sched_ops,
12251225
get_submit_wq(guc),
12261226
q->lrc[0].ring.size / MAX_JOB_SIZE_BYTES, 64,

drivers/gpu/drm/xe/xe_lrc.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ static void set_offsets(u32 *regs,
9797
#define REG16(x) \
9898
(((x) >> 9) | BIT(7) | BUILD_BUG_ON_ZERO(x >= 0x10000)), \
9999
(((x) >> 2) & 0x7f)
100-
#define END 0
101100
{
102101
const u32 base = hwe->mmio_base;
103102

@@ -168,7 +167,7 @@ static const u8 gen12_xcs_offsets[] = {
168167
REG16(0x274),
169168
REG16(0x270),
170169

171-
END
170+
0
172171
};
173172

174173
static const u8 dg2_xcs_offsets[] = {
@@ -202,7 +201,7 @@ static const u8 dg2_xcs_offsets[] = {
202201
REG16(0x274),
203202
REG16(0x270),
204203

205-
END
204+
0
206205
};
207206

208207
static const u8 gen12_rcs_offsets[] = {
@@ -298,7 +297,7 @@ static const u8 gen12_rcs_offsets[] = {
298297
REG(0x084),
299298
NOP(1),
300299

301-
END
300+
0
302301
};
303302

304303
static const u8 xehp_rcs_offsets[] = {
@@ -339,7 +338,7 @@ static const u8 xehp_rcs_offsets[] = {
339338
LRI(1, 0),
340339
REG(0x0c8),
341340

342-
END
341+
0
343342
};
344343

345344
static const u8 dg2_rcs_offsets[] = {
@@ -382,7 +381,7 @@ static const u8 dg2_rcs_offsets[] = {
382381
LRI(1, 0),
383382
REG(0x0c8),
384383

385-
END
384+
0
386385
};
387386

388387
static const u8 mtl_rcs_offsets[] = {
@@ -425,7 +424,7 @@ static const u8 mtl_rcs_offsets[] = {
425424
LRI(1, 0),
426425
REG(0x0c8),
427426

428-
END
427+
0
429428
};
430429

431430
#define XE2_CTX_COMMON \
@@ -471,7 +470,7 @@ static const u8 xe2_rcs_offsets[] = {
471470
LRI(1, 0), /* [0x47] */
472471
REG(0x0c8), /* [0x48] R_PWR_CLK_STATE */
473472

474-
END
473+
0
475474
};
476475

477476
static const u8 xe2_bcs_offsets[] = {
@@ -482,16 +481,15 @@ static const u8 xe2_bcs_offsets[] = {
482481
REG16(0x200), /* [0x42] BCS_SWCTRL */
483482
REG16(0x204), /* [0x44] BLIT_CCTL */
484483

485-
END
484+
0
486485
};
487486

488487
static const u8 xe2_xcs_offsets[] = {
489488
XE2_CTX_COMMON,
490489

491-
END
490+
0
492491
};
493492

494-
#undef END
495493
#undef REG16
496494
#undef REG
497495
#undef LRI

drivers/gpu/drm/xe/xe_query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ query_engine_cycles(struct xe_device *xe,
132132
return -EINVAL;
133133

134134
eci = &resp.eci;
135-
if (eci->gt_id > XE_MAX_GT_PER_TILE)
135+
if (eci->gt_id >= XE_MAX_GT_PER_TILE)
136136
return -EINVAL;
137137

138138
gt = xe_device_get_gt(xe, eci->gt_id);

0 commit comments

Comments
 (0)