Skip to content

Commit 83f0007

Browse files
committed
Merge tag 'drm-xe-fixes-2024-10-17' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes
Driver Changes: - New workaround to Xe2 (Aradhya) - Fix unbalanced rpm put (Matthew Auld) - Remove fragile lock optimization (Matthew Brost) - Fix job release, delegating it to the drm scheduler (Matthew Brost) - Fix timestamp bit width for Xe2 (Lucas) - Fix external BO's dma-resv usag (Matthew Brost) - Fix returning success for timeout in wait_token (Nirmoy) - Initialize fence to avoid it being detected as signaled (Matthew Auld) - Improve cache flush for BMG (Matthew Auld) - Don't allow hflip for tile4 framebuffer on Xe2 (Juha-Pekka) Signed-off-by: Dave Airlie <[email protected]> From: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/jkldrex5733ldxrla75b4ayvhujjhw2kccmasl5rotoufoacj4@pkvlrrv4orc7
2 parents 49ff3e7 + ffafd12 commit 83f0007

16 files changed

+63
-44
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,19 @@ bool intel_fb_needs_64k_phys(u64 modifier)
438438
INTEL_PLANE_CAP_NEED64K_PHYS);
439439
}
440440

441+
/**
442+
* intel_fb_is_tile4_modifier: Check if a modifier is a tile4 modifier type
443+
* @modifier: Modifier to check
444+
*
445+
* Returns:
446+
* Returns %true if @modifier is a tile4 modifier.
447+
*/
448+
bool intel_fb_is_tile4_modifier(u64 modifier)
449+
{
450+
return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
451+
INTEL_PLANE_CAP_TILING_4);
452+
}
453+
441454
static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
442455
u8 display_ver_from, u8 display_ver_until)
443456
{

drivers/gpu/drm/i915/display/intel_fb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ bool intel_fb_is_ccs_modifier(u64 modifier);
3535
bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
3636
bool intel_fb_is_mc_ccs_modifier(u64 modifier);
3737
bool intel_fb_needs_64k_phys(u64 modifier);
38+
bool intel_fb_is_tile4_modifier(u64 modifier);
3839

3940
bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
4041
int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,17 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
15911591
return -EINVAL;
15921592
}
15931593

1594+
/*
1595+
* Display20 onward tile4 hflip is not supported
1596+
*/
1597+
if (rotation & DRM_MODE_REFLECT_X &&
1598+
intel_fb_is_tile4_modifier(fb->modifier) &&
1599+
DISPLAY_VER(dev_priv) >= 20) {
1600+
drm_dbg_kms(&dev_priv->drm,
1601+
"horizontal flip is not supported with tile4 surface formats\n");
1602+
return -EINVAL;
1603+
}
1604+
15941605
if (drm_rotation_90_or_270(rotation)) {
15951606
if (!intel_fb_supports_90_270_rotation(to_intel_framebuffer(fb))) {
15961607
drm_dbg_kms(&dev_priv->drm,

drivers/gpu/drm/xe/regs/xe_gt_regs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@
393393

394394
#define XE2_GLOBAL_INVAL XE_REG(0xb404)
395395

396-
#define SCRATCH1LPFC XE_REG(0xb474)
397-
#define EN_L3_RW_CCS_CACHE_FLUSH REG_BIT(0)
398-
399396
#define XE2LPM_L3SQCREG2 XE_REG_MCR(0xb604)
400397

401398
#define XE2LPM_L3SQCREG3 XE_REG_MCR(0xb608)

drivers/gpu/drm/xe/xe_device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,13 +980,13 @@ void xe_device_declare_wedged(struct xe_device *xe)
980980
return;
981981
}
982982

983+
xe_pm_runtime_get_noresume(xe);
984+
983985
if (drmm_add_action_or_reset(&xe->drm, xe_device_wedged_fini, xe)) {
984986
drm_err(&xe->drm, "Failed to register xe_device_wedged_fini clean-up. Although device is wedged.\n");
985987
return;
986988
}
987989

988-
xe_pm_runtime_get_noresume(xe);
989-
990990
if (!atomic_xchg(&xe->wedged.flag, 1)) {
991991
xe->needs_flr_on_fini = true;
992992
drm_err(&xe->drm,

drivers/gpu/drm/xe/xe_exec.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@
4141
* user knows an exec writes to a BO and reads from the BO in the next exec, it
4242
* is the user's responsibility to pass in / out fence between the two execs).
4343
*
44-
* Implicit dependencies for external BOs are handled by using the dma-buf
45-
* implicit dependency uAPI (TODO: add link). To make this works each exec must
46-
* install the job's fence into the DMA_RESV_USAGE_WRITE slot of every external
47-
* BO mapped in the VM.
48-
*
4944
* We do not allow a user to trigger a bind at exec time rather we have a VM
5045
* bind IOCTL which uses the same in / out fence interface as exec. In that
5146
* sense, a VM bind is basically the same operation as an exec from the user
@@ -59,8 +54,8 @@
5954
* behind any pending kernel operations on any external BOs in VM or any BOs
6055
* private to the VM. This is accomplished by the rebinds waiting on BOs
6156
* DMA_RESV_USAGE_KERNEL slot (kernel ops) and kernel ops waiting on all BOs
62-
* slots (inflight execs are in the DMA_RESV_USAGE_BOOKING for private BOs and
63-
* in DMA_RESV_USAGE_WRITE for external BOs).
57+
* slots (inflight execs are in the DMA_RESV_USAGE_BOOKKEEP for private BOs and
58+
* for external BOs).
6459
*
6560
* Rebinds / dma-resv usage applies to non-compute mode VMs only as for compute
6661
* mode VMs we use preempt fences and a rebind worker (TODO: add link).
@@ -304,7 +299,8 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
304299
xe_sched_job_arm(job);
305300
if (!xe_vm_in_lr_mode(vm))
306301
drm_gpuvm_resv_add_fence(&vm->gpuvm, exec, &job->drm.s_fence->finished,
307-
DMA_RESV_USAGE_BOOKKEEP, DMA_RESV_USAGE_WRITE);
302+
DMA_RESV_USAGE_BOOKKEEP,
303+
DMA_RESV_USAGE_BOOKKEEP);
308304

309305
for (i = 0; i < num_syncs; i++) {
310306
xe_sync_entry_signal(&syncs[i], &job->drm.s_fence->finished);

drivers/gpu/drm/xe/xe_gpu_scheduler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ xe_sched_invalidate_job(struct xe_sched_job *job, int threshold)
6363
static inline void xe_sched_add_pending_job(struct xe_gpu_scheduler *sched,
6464
struct xe_sched_job *job)
6565
{
66+
spin_lock(&sched->base.job_list_lock);
6667
list_add(&job->drm.list, &sched->base.pending_list);
68+
spin_unlock(&sched->base.job_list_lock);
6769
}
6870

6971
static inline

drivers/gpu/drm/xe/xe_gt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ static void xe_gt_enable_host_l2_vram(struct xe_gt *gt)
108108
return;
109109

110110
if (!xe_gt_is_media_type(gt)) {
111-
xe_mmio_write32(gt, SCRATCH1LPFC, EN_L3_RW_CCS_CACHE_FLUSH);
112111
reg = xe_gt_mcr_unicast_read_any(gt, XE2_GAMREQSTRM_CTRL);
113112
reg |= CG_DIS_CNTLBUS;
114113
xe_gt_mcr_multicast_write(gt, XE2_GAMREQSTRM_CTRL, reg);

drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ static long tlb_timeout_jiffies(struct xe_gt *gt)
3737
return hw_tlb_timeout + 2 * delay;
3838
}
3939

40+
static void xe_gt_tlb_invalidation_fence_fini(struct xe_gt_tlb_invalidation_fence *fence)
41+
{
42+
if (WARN_ON_ONCE(!fence->gt))
43+
return;
44+
45+
xe_pm_runtime_put(gt_to_xe(fence->gt));
46+
fence->gt = NULL; /* fini() should be called once */
47+
}
48+
4049
static void
4150
__invalidation_fence_signal(struct xe_device *xe, struct xe_gt_tlb_invalidation_fence *fence)
4251
{
@@ -204,7 +213,7 @@ static int send_tlb_invalidation(struct xe_guc *guc,
204213
tlb_timeout_jiffies(gt));
205214
}
206215
spin_unlock_irq(&gt->tlb_invalidation.pending_lock);
207-
} else if (ret < 0) {
216+
} else {
208217
__invalidation_fence_signal(xe, fence);
209218
}
210219
if (!ret) {
@@ -267,10 +276,8 @@ int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt)
267276

268277
xe_gt_tlb_invalidation_fence_init(gt, &fence, true);
269278
ret = xe_gt_tlb_invalidation_guc(gt, &fence);
270-
if (ret < 0) {
271-
xe_gt_tlb_invalidation_fence_fini(&fence);
279+
if (ret)
272280
return ret;
273-
}
274281

275282
xe_gt_tlb_invalidation_fence_wait(&fence);
276283
} else if (xe_device_uc_enabled(xe) && !xe_device_wedged(xe)) {
@@ -496,7 +503,8 @@ static const struct dma_fence_ops invalidation_fence_ops = {
496503
* @stack: fence is stack variable
497504
*
498505
* Initialize TLB invalidation fence for use. xe_gt_tlb_invalidation_fence_fini
499-
* must be called if fence is not signaled.
506+
* will be automatically called when fence is signalled (all fences must signal),
507+
* even on error.
500508
*/
501509
void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
502510
struct xe_gt_tlb_invalidation_fence *fence,
@@ -516,14 +524,3 @@ void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
516524
dma_fence_get(&fence->base);
517525
fence->gt = gt;
518526
}
519-
520-
/**
521-
* xe_gt_tlb_invalidation_fence_fini - Finalize TLB invalidation fence
522-
* @fence: TLB invalidation fence to finalize
523-
*
524-
* Drop PM ref which fence took durinig init.
525-
*/
526-
void xe_gt_tlb_invalidation_fence_fini(struct xe_gt_tlb_invalidation_fence *fence)
527-
{
528-
xe_pm_runtime_put(gt_to_xe(fence->gt));
529-
}

drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len);
2828
void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
2929
struct xe_gt_tlb_invalidation_fence *fence,
3030
bool stack);
31-
void xe_gt_tlb_invalidation_fence_fini(struct xe_gt_tlb_invalidation_fence *fence);
3231

3332
static inline void
3433
xe_gt_tlb_invalidation_fence_wait(struct xe_gt_tlb_invalidation_fence *fence)

0 commit comments

Comments
 (0)