Skip to content

Commit 6ec8a47

Browse files
committed
Merge tag 'drm-intel-fixes-2025-11-06' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-fixes
- Avoid lock inversion when pinning to GGTT on CHV/BXT+VTD (Janusz) - Fix conversion between clock ticks and nanoseconds (Umesh) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patch.msgid.link/aQyxT1D8IW-xcDbM@intel.com
2 parents faf66a7 + 7d44ad6 commit 6ec8a47

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static u64 div_u64_roundup(u64 nom, u32 den)
205205

206206
u64 intel_gt_clock_interval_to_ns(const struct intel_gt *gt, u64 count)
207207
{
208-
return div_u64_roundup(count * NSEC_PER_SEC, gt->clock_frequency);
208+
return mul_u64_u32_div(count, NSEC_PER_SEC, gt->clock_frequency);
209209
}
210210

211211
u64 intel_gt_pm_interval_to_ns(const struct intel_gt *gt, u64 count)
@@ -215,7 +215,7 @@ u64 intel_gt_pm_interval_to_ns(const struct intel_gt *gt, u64 count)
215215

216216
u64 intel_gt_ns_to_clock_interval(const struct intel_gt *gt, u64 ns)
217217
{
218-
return div_u64_roundup(gt->clock_frequency * ns, NSEC_PER_SEC);
218+
return mul_u64_u32_div(ns, gt->clock_frequency, NSEC_PER_SEC);
219219
}
220220

221221
u64 intel_gt_ns_to_pm_interval(const struct intel_gt *gt, u64 ns)

drivers/gpu/drm/i915/i915_vma.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,8 +1595,20 @@ int i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
15951595
err_vma_res:
15961596
i915_vma_resource_free(vma_res);
15971597
err_fence:
1598-
if (work)
1599-
dma_fence_work_commit_imm(&work->base);
1598+
if (work) {
1599+
/*
1600+
* When pinning VMA to GGTT on CHV or BXT with VTD enabled,
1601+
* commit VMA binding asynchronously to avoid risk of lock
1602+
* inversion among reservation_ww locks held here and
1603+
* cpu_hotplug_lock acquired from stop_machine(), which we
1604+
* wrap around GGTT updates when running in those environments.
1605+
*/
1606+
if (i915_vma_is_ggtt(vma) &&
1607+
intel_vm_no_concurrent_access_wa(vma->vm->i915))
1608+
dma_fence_work_commit(&work->base);
1609+
else
1610+
dma_fence_work_commit_imm(&work->base);
1611+
}
16001612
err_rpm:
16011613
intel_runtime_pm_put(&vma->vm->i915->runtime_pm, wakeref);
16021614

0 commit comments

Comments
 (0)