]> Git Repo - linux.git/log
linux.git
6 months agoRevert "drm/xe: Invalidate media_gt TLBs in PT code"
Matthew Brost [Fri, 23 Aug 2024 16:22:07 +0000 (09:22 -0700)]
Revert "drm/xe: Invalidate media_gt TLBs in PT code"

This reverts commit 40520283e0fd11237ed9dfc0991503b3403d5fa4.

We can't install dma-fence-chain in timeline sync objs.

Signed-off-by: Matthew Brost <[email protected]>
Acked-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
6 months agodrm/xe: Fix missing runtime outer protection for ggtt_remove_node
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:42 +0000 (15:38 -0400)]
drm/xe: Fix missing runtime outer protection for ggtt_remove_node

Defer the ggtt node removal to a thread if runtime_pm is not active.

The ggtt node removal can be called from multiple places, including
places where we cannot protect with outer callers and places we are
within other locks. So, try to grab the runtime reference if the
device is already active, otherwise defer the removal to a separate
thread from where we are sure we can wake the device up.

v2: - use xe wq instead of system wq (Matt and CI)
    - Avoid GFP_KERNEL to be future proof since this removal can
    be called from outside our drivers and we don't want to block
    if atomic is needed. (Brost)
v3: amend forgot chunk declaring xe_device.
v4: Use a xe_ggtt_region to encapsulate the node and remova info,
    wihtout the need for any memory allocation at runtime.
v5: Actually fill the delayed_removal.invalidate (Brost)
v6: - Ensure that ggtt_region is not freed before work finishes (Auld)
    - Own wq to ensures that the queued works are flushed before
      ggtt_fini (Brost)
v7: also free ggtt_region on early !bound return (Auld)
v8: Address the null deref (CI)
v9: Based on the new xe_ggtt_node for the proper care of the lifetime
    of the object.
v10: Redo the lost v5 change. (Brost)
v11: Simplify the invalidate_on_remove (Lucas)

Cc: Matthew Auld <[email protected]>
Cc: Paulo Zanoni <[email protected]>
Cc: Francois Dugast <[email protected]>
Cc: Thomas Hellström <[email protected]>
Cc: Matthew Brost <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Make xe_ggtt_node struct independent
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:41 +0000 (15:38 -0400)]
drm/xe: Make xe_ggtt_node struct independent

In some rare cases, the drm_mm node cannot be removed synchronously
due to runtime PM conditions. In this situation, the node removal will
be delegated to a workqueue that will be able to wake up the device
before removing the node.

However, in this situation, the lifetime of the xe_ggtt_node cannot
be restricted to the lifetime of the parent object. So, this patch
introduces the infrastructure so the xe_ggtt_node struct can be
allocated in advance and freed when needed.

By having the ggtt backpointer, it also ensure that the init function
is always called before any attempt to insert or reserve the node
in the GGTT.

v2: s/xe_ggtt_node_force_fini/xe_ggtt_node_fini and use it
    internaly (Brost)
v3: - Use GF_NOFS for node allocation (CI)
    - Avoid ggtt argument, now that we have it inside the node (Lucas)
    - Fix some missed fini cases (CI)
v4: - Fix SRIOV critical case where config->ggtt_region was
      lost (Michal)
    - Avoid ggtt argument also on removal (missed case on v3) (Michal)
    - Remove useless checks (Michal)
    - Return 0 instead of negative errno on a u32 addr. (Michal)
    - s/xe_ggtt_assign/xe_ggtt_node_assign for coherence, while we
      are touching it (Michal)
v5: - Fix VFs' ggtt_balloon

Cc: Matthew Auld <[email protected]>
Cc: Michal Wajdeczko <[email protected]>
Cc: Matthew Brost <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Refactor xe_ggtt balloon functions to make the node clear
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:40 +0000 (15:38 -0400)]
drm/xe: Refactor xe_ggtt balloon functions to make the node clear

These operations are related to node. Convert them to the
new appropriate name space xe_ggtt_node.

v2: Also move arguments around for consistency (Lucas).
v3: s/node_balloon/node_insert_balloon and
    s/node_deballoon/node_remove_balloon (Michal).

Reviewed-by: Lucas De Marchi <[email protected]>
Cc: Michal Wajdeczko <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Introduce xe_ggtt_print_holes
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:39 +0000 (15:38 -0400)]
drm/xe: Introduce xe_ggtt_print_holes

Introduce a new xe_ggtt_print_holes helper that attends the SRIOV
demand and finishes the goal of limiting drm_mm access to xe_ggtt.

Cc: Michal Wajdeczko <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Introduce xe_ggtt_largest_hole
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:38 +0000 (15:38 -0400)]
drm/xe: Introduce xe_ggtt_largest_hole

Introduce a new xe_ggtt_largest_hole helper that attends the SRIOV
demand and continue with the goal of limiting drm_mm access to xe_ggtt.

v2: Fix a typo (Michal)

Cc: Michal Wajdeczko <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:37 +0000 (15:38 -0400)]
drm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node

Continue with the encapsulation of drm_mm_node inside xe_ggtt.

Cc: Michal Wajdeczko <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Rename xe_ggtt_node related functions
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:36 +0000 (15:38 -0400)]
drm/xe: Rename xe_ggtt_node related functions

Bring some consistency and prepare for more xe_ggtt_node related
functions to be introduced.

Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Encapsulate drm_mm_node inside xe_ggtt_node
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:35 +0000 (15:38 -0400)]
drm/xe: Encapsulate drm_mm_node inside xe_ggtt_node

The xe_ggtt component uses drm_mm to manage the GGTT.
The drm_mm_node is just a node inside drm_mm, but in Xe we use that
only in the GGTT context. So, this patch encapsulates the drm_mm_node
into a xe_ggtt's new struct.

This is the first step towards limiting all the drm_mm access
through xe_ggtt. The ultimate goal is to have a better control of
the node insertion and removal, so the removal can be delegated
to a delayed workqueue.

v2: Fix includes and typos (Michal and Brost)

Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/{i915, xe}: Avoid direct inspection of dpt_vma from outside dpt
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:34 +0000 (15:38 -0400)]
drm/{i915, xe}: Avoid direct inspection of dpt_vma from outside dpt

DPT code is so dependent on i915 vma implementation and it is not
ported yet to Xe.

This patch limits inspection to DPT's VMA struct to intel_dpt
component only, so the Xe GGTT code can evolve.

Cc: Matthew Brost <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Juha-Pekka Heikkila <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Remove unnecessary drm_mm.h includes
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:33 +0000 (15:38 -0400)]
drm/xe: Remove unnecessary drm_mm.h includes

These includes are no longer necessary, and where appropriate
are replaced by the linux/types.h one.

Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Introduce GGTT documentation
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:32 +0000 (15:38 -0400)]
drm/xe: Introduce GGTT documentation

Document xe_ggtt and ensure it is part of the built kernel docs.

v2: - Accepted all Michal's suggestions
    - Rebased on top of new set_pte per platform/wa function pointer
v3: - Typos and other acronym fixes (Michal)

Cc: Matthew Brost <[email protected]>
Cc: Michal Wajdeczko <[email protected]>
Reviewed-by: Himal Prasad Ghimiray <[email protected]> #v1
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: Removed unused xe_ggtt_printk
Rodrigo Vivi [Wed, 21 Aug 2024 19:38:31 +0000 (15:38 -0400)]
drm/xe: Removed unused xe_ggtt_printk

Apparently this was only useful when enabling ggtt support
for the very first time and never used again.
It is also not useful now that we have the ggtt_dump available
through debugfs.

Reviewed-by: Himal Prasad Ghimiray <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
6 months agodrm/xe: fixup xe_alloc_pf_queue
Matthew Auld [Wed, 21 Aug 2024 17:19:18 +0000 (18:19 +0100)]
drm/xe: fixup xe_alloc_pf_queue

kzalloc expects number of bytes, therefore we should convert the number
of dw into bytes, otherwise we are likely just accessing beyond the
array causing all kinds of carnage. Also fixup the error handling while
we are here.

v2:
 - Prefer kcalloc (dim)

Fixes: 3338e4f90c14 ("drm/xe: Use topology to determine page fault queue size")
Signed-off-by: Matthew Auld <[email protected]>
Cc: Stuart Summers <[email protected]>
Cc: Matthew Brost <[email protected]>
Reviewed-by: Nirmoy Das <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
6 months agodrm/xe: Invalidate media_gt TLBs in PT code
Matthew Brost [Tue, 20 Aug 2024 16:16:32 +0000 (09:16 -0700)]
drm/xe: Invalidate media_gt TLBs in PT code

Testing on LNL has shown media GT's TLBs need to be invalidated via the
GuC, update PT code appropriately.

v2:
 - Do dma_fence_get before first call of invalidation_fence_init (Himal)
 - No need to check for valid chain fence (Himal)

Fixes: 3330361543fc ("drm/xe/lnl: Add LNL platform definition")
Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Himal Prasad Ghimiray <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
6 months agodrm/xe: Invalidate media_gt TLBs
Matthew Brost [Tue, 20 Aug 2024 16:01:29 +0000 (09:01 -0700)]
drm/xe: Invalidate media_gt TLBs

Testing on LNL has shown media TLBs need to be invalidated via the GuC,
update xe_vm_invalidate_vma appropriately.

v2: Fix 2 tile case
v3: Include missing local change

Fixes: 3330361543fc ("drm/xe/lnl: Add LNL platform definition")
Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Himal Prasad Ghimiray <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
6 months agodrm/xe: Free job before xe_exec_queue_put
Matthew Brost [Tue, 20 Aug 2024 20:23:09 +0000 (13:23 -0700)]
drm/xe: Free job before xe_exec_queue_put

Free job depends on job->vm being valid, the last xe_exec_queue_put can
destroy the VM. Prevent UAF by freeing job before xe_exec_queue_put.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Nirmoy Das <[email protected]>
Reviewed-by: Jagmeet Randhawa <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
6 months agodrm/xe: Drop HW fence pointer to HW fence ctx
Matthew Brost [Thu, 15 Aug 2024 19:35:22 +0000 (12:35 -0700)]
drm/xe: Drop HW fence pointer to HW fence ctx

The HW fence ctx objects are not ref counted rather tied to the life of
an LRC object. HW fences reference the HW fence ctx, HW fences can
outlive LRCs thus resulting in UAF. Drop the  HW fence pointer to HW
fence ctx rather just store what is needed directly in HW fence.

v2:
 - Fix typo in commit (Ashutosh)
 - Use snprintf (Ashutosh)

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Ashutosh Dixit <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
6 months agodrm/xe/guc: Bump the G2H queue size to account for page faults
Stuart Summers [Sat, 17 Aug 2024 02:47:32 +0000 (02:47 +0000)]
drm/xe/guc: Bump the G2H queue size to account for page faults

With the increase in the size of the recoverable page fault
queue, we want to ensure the initial messages from GuC in
the G2H buffer have space while we transfer those out to the
actual pf_queue. Bump the G2H queue size to account for this
increase in the pf_queue size.

Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Stuart Summers <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/4c2b6974801bcffd8a010d838c8733fa4092573d.1723862633.git.stuart.summers@intel.com
6 months agodrm/xe: Use topology to determine page fault queue size
Stuart Summers [Sat, 17 Aug 2024 02:47:31 +0000 (02:47 +0000)]
drm/xe: Use topology to determine page fault queue size

Currently the page fault queue size is hard coded. However
the hardware supports faulting for each EU and each CS.
For some applications running on hardware with a large
number of EUs and CSs, this can result in an overflow of
the page fault queue.

Add a small calculation to determine the page fault queue
size based on the number of EUs and CSs in the platform as
detmined by fuses.

Signed-off-by: Stuart Summers <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/24d582a3b48c97793b8b6a402f34b4b469471636.1723862633.git.stuart.summers@intel.com
6 months agodrm/xe: Fix missing workqueue destroy in xe_gt_pagefault
Stuart Summers [Sat, 17 Aug 2024 02:47:30 +0000 (02:47 +0000)]
drm/xe: Fix missing workqueue destroy in xe_gt_pagefault

On driver reload we never free up the memory for the pagefault and
access counter workqueues. Add those destroy calls here.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Stuart Summers <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/c9a951505271dc3a7aee76de7656679f69c11518.1723862633.git.stuart.summers@intel.com
6 months agodrm/xe/lnl: Offload system clear page activity to GPU
Nirmoy Das [Fri, 16 Aug 2024 13:51:54 +0000 (15:51 +0200)]
drm/xe/lnl: Offload system clear page activity to GPU

On LNL because of flat CCS, driver creates migrates job to clear
CCS meta data. Extend that to also clear system pages using GPU.
Inform TTM to allocate pages without __GFP_ZERO to avoid double page
clearing by clearing out TTM_TT_FLAG_ZERO_ALLOC flag and set
TTM_TT_FLAG_CLEARED_ON_FREE while freeing to skip ttm pool's clear
on free as XE now takes care of clearing pages. If a bo is in system
placement such as BO created with  DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING
and there is a cpu map then for such BO gpu clear will be avoided as
there is no dma mapping for such BO at that moment to create migration
jobs.

Tested this patch api_overhead_benchmark_l0 from
https://github.com/intel/compute-benchmarks

Without the patch:
api_overhead_benchmark_l0 --testFilter=UsmMemoryAllocation:
UsmMemoryAllocation(api=l0 type=Host size=4KB) 84.206 us
UsmMemoryAllocation(api=l0 type=Host size=1GB) 105775.56 us
erf tool top 5 entries:
71.44% api_overhead_be  [kernel.kallsyms]   [k] clear_page_erms
6.34%  api_overhead_be  [kernel.kallsyms]   [k] __pageblock_pfn_to_page
2.24%  api_overhead_be  [kernel.kallsyms]   [k] cpa_flush
2.15%  api_overhead_be  [kernel.kallsyms]   [k] pages_are_mergeable
1.94%  api_overhead_be  [kernel.kallsyms]   [k] find_next_iomem_res

With the patch:
api_overhead_benchmark_l0 --testFilter=UsmMemoryAllocation:
UsmMemoryAllocation(api=l0 type=Host size=4KB) 79.439 us
UsmMemoryAllocation(api=l0 type=Host size=1GB) 98677.75 us
Perf tool top 5 entries:
11.16% api_overhead_be  [kernel.kallsyms]   [k] __pageblock_pfn_to_page
7.85%  api_overhead_be  [kernel.kallsyms]   [k] cpa_flush
7.59%  api_overhead_be  [kernel.kallsyms]   [k] find_next_iomem_res
7.24%  api_overhead_be  [kernel.kallsyms]   [k] pages_are_mergeable
5.53%  api_overhead_be  [kernel.kallsyms]   [k] lookup_address_in_pgd_attr

Without this patch clear_page_erms() dominates execution time which is
also not pipelined with migration jobs. With this patch page clearing
will get pipelined with migration job and will free CPU for more work.

v2: Handle regression on dgfx(Himal)
    Update commit message as no ttm API changes needed.
v3: Fix Kunit test.
v4: handle data leak on cpu mmap(Thomas)
v5: s/gpu_page_clear/gpu_page_clear_sys and move setting
    it to xe_ttm_sys_mgr_init() and other nits (Matt Auld)
v6: Disable it when init_on_alloc and/or init_on_free is active(Matt)
    Use compute-benchmarks as reporter used it to report this
    allocation latency issue also a proper test application than mime.
    In v5, the test showed significant reduction in alloc latency but
    that is not the case any more, I think this was mostly because
    previous test was done on IFWI which had low mem BW from CPU.

Cc: Himal Prasad Ghimiray <[email protected]>
Cc: Matthew Auld <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Thomas Hellström <[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Nirmoy Das <[email protected]>
6 months agodrm/ttm: Add a flag to allow drivers to skip clear-on-free
Nirmoy Das [Fri, 16 Aug 2024 13:51:53 +0000 (15:51 +0200)]
drm/ttm: Add a flag to allow drivers to skip clear-on-free

Add TTM_TT_FLAG_CLEARED_ON_FREE, which DRM drivers can set before
releasing backing stores if they want to skip clear-on-free.

Cc: Matthew Auld <[email protected]>
Cc: Thomas Hellström <[email protected]>
Suggested-by: Christian König <[email protected]>
Reviewed-by: Christian König <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Nirmoy Das <[email protected]>
6 months agodrm/xe/oa: Use vma_pages() helper function in xe_oa_mmap()
Thorsten Blum [Mon, 19 Aug 2024 09:57:52 +0000 (11:57 +0200)]
drm/xe/oa: Use vma_pages() helper function in xe_oa_mmap()

Use the vma_pages() helper function and remove the following
Coccinelle/coccicheck warning reported by vma_pages.cocci:

  WARNING: Consider using vma_pages helper on vma

Reviewed-by: Ashutosh Dixit <[email protected]>
Signed-off-by: Thorsten Blum <[email protected]>
Signed-off-by: Ashutosh Dixit <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
6 months agodrm/xe/display: Make display suspend/resume work on discrete
Maarten Lankhorst [Tue, 6 Aug 2024 10:50:44 +0000 (12:50 +0200)]
drm/xe/display: Make display suspend/resume work on discrete

We should unpin before evicting all memory, and repin after GT resume.
This way, we preserve the contents of the framebuffers, and won't hang
on resume due to migration engine not being restored yet.

Signed-off-by: Maarten Lankhorst <[email protected]>
Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: [email protected] # v6.8+
Reviewed-by: Uma Shankar <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Maarten Lankhorst,,, <[email protected]>
6 months agodrm/xe/display: Match i915 driver suspend/resume sequences better
Maarten Lankhorst [Tue, 6 Aug 2024 10:50:43 +0000 (12:50 +0200)]
drm/xe/display: Match i915 driver suspend/resume sequences better

Suspend fbdev sooner, and disable user access before suspending to
prevent some races. I've noticed this when comparing xe suspend to
i915's.

Matches the following commits from i915:
24b412b1bfeb ("drm/i915: Disable intel HPD poll after DRM poll init/enable")
1ef28d86bea9 ("drm/i915: Suspend the framebuffer console earlier during system suspend")
bd738d859e71 ("drm/i915: Prevent modesets during driver init/shutdown")

Thanks to Imre for pointing me to those commits.

Driver shutdown is currently missing, but I have some idea how to
implement it next.

Signed-off-by: Maarten Lankhorst <[email protected]>
Cc: Imre Deak <[email protected]>
Reviewed-by: Uma Shankar <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Maarten Lankhorst,,, <[email protected]>
6 months agodrm/xe: prevent UAF around preempt fence
Matthew Auld [Wed, 14 Aug 2024 11:01:30 +0000 (12:01 +0100)]
drm/xe: prevent UAF around preempt fence

The fence lock is part of the queue, therefore in the current design
anything locking the fence should then also hold a ref to the queue to
prevent the queue from being freed.

However, currently it looks like we signal the fence and then drop the
queue ref, but if something is waiting on the fence, the waiter is
kicked to wake up at some later point, where upon waking up it first
grabs the lock before checking the fence state. But if we have already
dropped the queue ref, then the lock might already be freed as part of
the queue, leading to uaf.

To prevent this, move the fence lock into the fence itself so we don't
run into lifetime issues. Alternative might be to have device level
lock, or only release the queue in the fence release callback, however
that might require pushing to another worker to avoid locking issues.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2454
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2342
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2020
Signed-off-by: Matthew Auld <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: <[email protected]> # v6.8+
Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
6 months agodrm/xe: Remove redundant param from xe_bo_create_user
Nirmoy Das [Fri, 16 Aug 2024 10:22:48 +0000 (12:22 +0200)]
drm/xe: Remove redundant param from xe_bo_create_user

BO from xe_bo_create_user() will always be of type,
ttm_bo_type_device. So remove that redundant parameter.

Cc: Matthew Auld <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Thomas Hellström <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Nirmoy Das <[email protected]>
7 months agodrm/xe/device: Remove unused xe_device::usm::num_vm_in_*
Francois Dugast [Fri, 9 Aug 2024 15:51:36 +0000 (17:51 +0200)]
drm/xe/device: Remove unused xe_device::usm::num_vm_in_*

Those counters were used to keep track of the numbers VMs in fault mode
and in non-fault mode, to determine if the whole device was in fault mode
or not. This is no longer needed so remove those variables and their
usages.

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/vm: Remove restriction that all VMs must be faulting if one is
Francois Dugast [Fri, 9 Aug 2024 15:51:35 +0000 (17:51 +0200)]
drm/xe/vm: Remove restriction that all VMs must be faulting if one is

With this restriction, all VMs on the device must be faulting VMs if there
is already one faulting VM, in which case the device is considered in
fault mode. This prevents for example an application from running 3D jobs
for the compositor while submitting a SVM compute job on the same device.

Now that mutual exclusion of faulting LR jobs and dma fence jobs is
ensured on the hw engine group, remove this restriction to allow running
faulting and non-faulting VMs on the same device.

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/exec: Switch hw engine group execution mode upon job submission
Francois Dugast [Fri, 9 Aug 2024 15:51:34 +0000 (17:51 +0200)]
drm/xe/exec: Switch hw engine group execution mode upon job submission

If the job about to be submitted is a dma-fence job, update the current
execution mode of the hw engine group. This triggers an immediate suspend
of the exec queues running faulting long-running jobs.

If the job about to be submitted is a long-running job, kick a new worker
used to resume the exec queues running faulting long-running jobs once
the dma-fence jobs have completed.

v2: Kick the resume worker from exec IOCTL, switch to unordered workqueue,
    destroy it after use (Matt Brost)

v3: Do not resume if no exec queue was suspended (Matt Brost)

v4: Squash commits (Matt Brost)

v5: Do not kick the worker when xe_vm_in_preempt_fence_mode (Matt Brost)

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/hw_engine_group: Ensure safe transition between execution modes
Francois Dugast [Fri, 9 Aug 2024 15:51:33 +0000 (17:51 +0200)]
drm/xe/hw_engine_group: Ensure safe transition between execution modes

Provide a way to safely transition execution modes of the hw engine group
ahead of the actual execution. When necessary, either wait for running
jobs to complete or preempt them, thus ensuring mutual exclusion between
execution modes.

Unlike a mutex, the rw_semaphore used in this context allows multiple
submissions in the same mode.

v2: Use lockdep_assert_held_write, add annotations (Matt Brost)

v3: Fix kernel doc, remove redundant code (Matt Brost)

v4: Now that xe_hw_engine_group_suspend_faulting_lr_jobs can fail,
    propagate the error to the caller (Matt Brost)

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/hw_engine_group: Add helper to wait for dma fence jobs
Francois Dugast [Fri, 9 Aug 2024 15:51:32 +0000 (17:51 +0200)]
drm/xe/hw_engine_group: Add helper to wait for dma fence jobs

This is a required feature for faulting long running jobs not to be
submitted while dma fence jobs are running on the hw engine group.

v2: Switch to lockdep_assert_held_write in worker, get a proper reference
    for the last fence (Matt Brost)

v3: Directly call dma_fence_put with the fence ref (Matt Brost)

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/exec_queue: Prepare last fence for hw engine group resume context
Francois Dugast [Fri, 9 Aug 2024 15:51:31 +0000 (17:51 +0200)]
drm/xe/exec_queue: Prepare last fence for hw engine group resume context

Ensure we can safely take a ref of the exec queue's last fence from the
context of resuming jobs from the hw engine group. The locking requirements
differ from the general case, hence the introduction of this new function.

v2: Add kernel doc, rework the code to prevent code duplication

v3: Fix kernel doc, remove now unnecessary lockdep variants (Matt Brost)

v4: Remove new put function (Matt Brost)

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/exec_queue: Remove duplicated code
Francois Dugast [Fri, 9 Aug 2024 15:51:30 +0000 (17:51 +0200)]
drm/xe/exec_queue: Remove duplicated code

This code section is the same as the body of
xe_exec_queue_last_fence_put_unlocked() so call the function instead and
remove duplicated code to make maintenance easier.

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/hw_engine_group: Add helper to suspend faulting LR jobs
Francois Dugast [Fri, 9 Aug 2024 15:51:29 +0000 (17:51 +0200)]
drm/xe/hw_engine_group: Add helper to suspend faulting LR jobs

This is a required feature for dma fence jobs to preempt faulting long
running jobs in order to ensure mutual exclusion on a given hw engine
group.

v2: Pipeline calls to suspend(q) and suspend_wait(q) to improve
    efficiency, switch to lockdep_assert_held_write (Matt Brost)

v3: Return error on suspend_wait failure to propagate on the call stack
    up to IOCTL (Matt Brost)

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months ago'drm/xe/hw_engine_group: Register hw engine group's exec queues
Francois Dugast [Fri, 9 Aug 2024 15:51:28 +0000 (17:51 +0200)]
'drm/xe/hw_engine_group: Register hw engine group's exec queues

Add helpers to safely add and delete the exec queues attached to a hw
engine group, and make use them at the time of creation and destruction of
the exec queues. Keeping track of them is required to control the
execution mode of the hw engine group.

v2: Improve error handling and robustness, suspend exec queues created in
    fault mode if group in dma-fence mode, init queue link (Matt Brost)

v3: Delete queue from hw engine group when it is destroyed by the user,
    also clean up at the time of closing the file in case the user did
    not destroy the queue

v4: Use correct list when checking if empty, do not add the queue if VM
    is in xe_vm_in_preempt_fence_mode (Matt Brost)

v5: Remove unrelated newline, add checks and asserts for group, unwind on
    suspend failure (Matt Brost)

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/guc_submit: Make suspend_wait interruptible
Francois Dugast [Fri, 9 Aug 2024 15:51:27 +0000 (17:51 +0200)]
drm/xe/guc_submit: Make suspend_wait interruptible

Rely on wait_event_interruptible_timeout() to put the process to sleep
with TASK_INTERRUPTIBLE. It allows using this function in interruptible
context.

v2: Propagate error on wait_event_interruptible_timeout (Matt Brost)

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/hw_engine_group: Introduce xe_hw_engine_group
Francois Dugast [Fri, 9 Aug 2024 15:51:26 +0000 (17:51 +0200)]
drm/xe/hw_engine_group: Introduce xe_hw_engine_group

A xe_hw_engine_group is a group of hw engines. Two hw engines belong to
the same xe_hw_engine_group if one hw engine cannot make progress while
the other is stuck on a page fault.

Typically, hw engines of the same group share some resources such as EUs,
but this really depends on the hardware configuration of the platforms.
The simple engines partitioning proposed here might be too conservative
but is intended to work for existing platforms. It can be optimized later
if more sets of independent engines are identified.

The hw engine groups are intended to be used in the context of faulting
long-running jobs submissions.

v2: Move to own files, improve error handling (Matt Brost)

v3: Fix build issue reported by CI, improve commit message (Matt Roper)

v4: Fix kernel doc

v5: Add switch case for XE_ENGINE_CLASS_OTHER

Signed-off-by: Francois Dugast <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Use reserved copy engine for user binds on faulting devices
Matthew Brost [Fri, 16 Aug 2024 03:40:33 +0000 (20:40 -0700)]
drm/xe: Use reserved copy engine for user binds on faulting devices

User binds map to engines with can fault, faults depend on user binds
completion, thus we can deadlock. Avoid this by using reserved copy
engine for user binds on faulting devices.

While we are here, normalize bind queue creation with a helper.

v2:
 - Pass in extensions to bind queue creation (CI)
v3:
 - s/resevered/reserved (Lucas)
 - Fix NULL hwe check (Jonathan)

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Thomas Hellström <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/mcr: Try to derive dss_per_grp from hwconfig attributes
Matt Roper [Thu, 15 Aug 2024 17:26:04 +0000 (10:26 -0700)]
drm/xe/mcr: Try to derive dss_per_grp from hwconfig attributes

When steering MCR register ranges of type "DSS," the group_id and
instance_id values are calculated by dividing the DSS pool according to
the size of a gslice or cslice, depending on the platform.  These values
haven't changed much on past platforms, so we've been able to hardcode
the proper divisor so far.  However the layout may not be so fixed on
future platforms so the proper, future-proof way to determine this is by
using some of the attributes from the GuC's hwconfig table.  The
hwconfig has two attributes reflecting the architectural maximum slice
and subslice counts (i.e., before any fusing is considered) that can be
used for the purposes of calculating MCR steering targets.

If the hwconfig is lacking the necessary values (which should only be
possible on older platforms before these attributes were added), we can
still fall back to the old hardcoded values.  Going forward the hwconfig
is expected to always provide the information we need on newer
platforms, and any failure to do so will be considered a bug in the
firmware that will prevent us from switching to the buggy firmware
release.

It's worth noting that over time GuC's hwconfig has provided a couple
different keys with similar-sounding descriptions.  For our purposes
here, we only trust the newer key "70" which has supplanted the
similarly-named key "2" that existed on older platforms.

Bspec: 73210
Signed-off-by: Matt Roper <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Add debugfs to dump GuC's hwconfig
Matt Roper [Thu, 15 Aug 2024 17:26:03 +0000 (10:26 -0700)]
drm/xe: Add debugfs to dump GuC's hwconfig

Although the query uapi is the official way to get at the GuC's hwconfig
table contents, it's still useful to have a quick debugfs interface to
dump the table in a human-readable format while debugging the driver.

Signed-off-by: Matt Roper <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Reviewed-by: Jagmeet Randhawa <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agoMerge drm/drm-next into drm-xe-next
Lucas De Marchi [Fri, 16 Aug 2024 17:05:54 +0000 (10:05 -0700)]
Merge drm/drm-next into drm-xe-next

Get drm-xe-next on v6.11-rc2 and synchronized with drm-intel-next for
the display side. This resolves the current conflict for the
enable_display module parameter and allows further pending refactors.

Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Use for_each_remote_tile rather than manual check
Matthew Brost [Fri, 16 Aug 2024 04:02:08 +0000 (21:02 -0700)]
drm/xe: Use for_each_remote_tile rather than manual check

Replace for_each_tile plus a check against primary tile with
for_each_remote_tile in tiles_fini. The latter macro does this for us.

Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Reviewed-by: Himal Prasad Ghimiray <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe/uc: Use devm to register cleanup that includes exec_queues
Daniele Ceraolo Spurio [Thu, 15 Aug 2024 23:05:40 +0000 (16:05 -0700)]
drm/xe/uc: Use devm to register cleanup that includes exec_queues

Exec_queue cleanup requires HW access, so we need to use devm instead of
drmm for it.

Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Cc: John Harrison <[email protected]>
Cc: Alan Previn <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe/uc: Use managed bo for HuC and GSC objects
Daniele Ceraolo Spurio [Thu, 15 Aug 2024 23:05:39 +0000 (16:05 -0700)]
drm/xe/uc: Use managed bo for HuC and GSC objects

Drmm actions are not the right ones to clean up BOs and we should use
devm instead. However, we can also instead just allocate the objects
using the managed_bo function, which will internally register the
correct cleanup call and therefore allows us to simplify the code.

While at it, switch to drmm_kzalloc for the GSC proxy allocation to
further simplify the cleanup.

Cc: John Harrison <[email protected]>
Cc: Alan Previn <[email protected]>
Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agoMerge tag 'drm-intel-next-2024-08-13' of https://gitlab.freedesktop.org/drm/i915...
Dave Airlie [Fri, 16 Aug 2024 02:56:37 +0000 (12:56 +1000)]
Merge tag 'drm-intel-next-2024-08-13' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next

- Type-C programming fix for MTL+ (Gustavo)
 - Fix display clock workaround (Mitul)
 - Fix DP LTTPR detection (Imre)
 - Calculate vblank delay more accurately (Ville)
 - Make vrr_{enabling,disabling}() usable outside intel_display.c (Ville)
 - FBC clean-up (Ville)
 - DP link-training fixes and clean-up (Imre)
 - Make I2C terminology more inclusive (Easwar)
 - Make read-only array bw_gbps static const (Colin)
 - HDCP fixes and improvements (Suraj)
 - DP VSC SDP fixes and clean-ups (Suraj, Mitul)
 - Fix opregion leak in Xe code (Lucas)
 - Fix possible int overflow in skl_ddi_calculate_wrpll (Nikita)]
 - General display clean-ups and conversion towards intel_display (Jani)
 - On DP MST, Enable LT fallback for UHBR<->non-UHBR rates (Imre)
 - Add VRR condition for DPKGC Enablement (Suraj)
 - Use backlight power constants (Zimmermann)
 - Correct dual pps handling for MTL_PCH+ (Dnyaneshwar)
 - Dump DSC HW state (Imre)
 - Replace double blank with single blank after comma (Andi)
 - Read display register timeout on BMG (Mitul)

Signed-off-by: Dave Airlie <[email protected]>
From: Rodrigo Vivi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Fix tile fini sequence
Matthew Brost [Fri, 9 Aug 2024 23:28:30 +0000 (16:28 -0700)]
drm/xe: Fix tile fini sequence

Only set tile->mmio.regs to NULL if not the root tile in tile_fini. The
root tile mmio regs is setup ealier in MMIO init thus it should be set
to NULL in mmio_fini.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Reviewed-by: Himal Prasad Ghimiray <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: use devm instead of drmm for managed bo
Daniele Ceraolo Spurio [Fri, 9 Aug 2024 23:12:35 +0000 (16:12 -0700)]
drm/xe: use devm instead of drmm for managed bo

The BO cleanup touches the GGTT and therefore requires the HW to be
available, so we need to use devm instead of drmm.

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1160
Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Cc: Lucas De Marchi <[email protected]>
Cc: Matthew Auld <[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Make exec_queue_kill safe to call twice
Daniele Ceraolo Spurio [Wed, 14 Aug 2024 20:56:54 +0000 (13:56 -0700)]
drm/xe: Make exec_queue_kill safe to call twice

An upcoming PXP patch will kill queues at runtime when a PXP
invalidation event occurs, so we need exec_queue_kill to be safe to call
multiple times.

v2: Add documentation (Matt B)

Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Cc: Matthew Brost <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: fix engine_class bounds check again
Matthew Auld [Mon, 12 Aug 2024 14:13:32 +0000 (15:13 +0100)]
drm/xe: fix engine_class bounds check again

This was fixed in commit b7dce525c4fc ("drm/xe/queue: fix engine_class
bounds check"), but then re-introduced in commit 6f20fc09936e ("drm/xe:
Move and export xe_hw_engine lookup.") which should only be simple code
movement of the existing function.

Fixes: 6f20fc09936e ("drm/xe: Move and export xe_hw_engine lookup.")
Signed-off-by: Matthew Auld <[email protected]>
Cc: Dominik Grzegorzek <[email protected]>
Cc: Mika Kuoppala <[email protected]>
Cc: Matthew Brost <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Define STATELESS_COMPRESSION_CTRL as mcr register
Tejas Upadhyay [Wed, 14 Aug 2024 09:56:14 +0000 (15:26 +0530)]
drm/xe: Define STATELESS_COMPRESSION_CTRL as mcr register

Register STATELESS_COMPRESSION_CTRL should be considered
mcr register which should write to all slices as per
documentation.

Bspec: 71185
Fixes: ecabb5e6ce54 ("drm/xe/xe2: Add performance turning changes")
Signed-off-by: Tejas Upadhyay <[email protected]>
Reviewed-by: Shekhar Chauhan <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Write all slices if its mcr register
Tejas Upadhyay [Wed, 14 Aug 2024 09:56:13 +0000 (15:26 +0530)]
drm/xe: Write all slices if its mcr register

Register GAMREQSTRM_CTRL should be considered mcr register
which should write to all slices as per documentation.

Bspec: 71185
Fixes: 01570b446939 ("drm/xe/bmg: implement Wa_16023588340")
Reviewed-by: Matt Roper <[email protected]>
Signed-off-by: Tejas Upadhyay <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Move enable host l2 VRAM post MCR init
Tejas Upadhyay [Wed, 14 Aug 2024 09:56:12 +0000 (15:26 +0530)]
drm/xe: Move enable host l2 VRAM post MCR init

xe_gt_enable_host_l2_vram() is reading the XE2_GAMREQSTRM_CTRL register
that is currently missing the MCR annotation. However, just adding the
annotation doesn't work as this function is called before MCR handling
is initialized in xe_gt_mcr_init().

xe_gt_enable_host_l2_vram() is used to implement WA 16023588340 that
needs to be done as early as possible during initialization in order to
be effective since the MMIO writes impact it. In the failure scenario,
driver would simply not be able to bind successfully.

Moving xe_gt_enable_host_l2_vram() later, after MCR initialization is
done, only incurs a few additional HW accesses, particularly when
loading GuC for hwconfig. Binding/unbinding the driver 100 times in BMG
still works so it should be ok to start handling the WA a little bit
later. This is sufficient to allow adding the MCR annotation to
XE2_GAMREQSTRM_CTRL.

Cc: Lucas De Marchi <[email protected]>
Signed-off-by: Tejas Upadhyay <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Rename enable_display module param
Lucas De Marchi [Tue, 13 Aug 2024 14:19:31 +0000 (07:19 -0700)]
drm/xe: Rename enable_display module param

The different approach used by xe regarding the initialization of
display HW has been proved a great addition for early driver bring up:
core xe can be tested without having all the bits sorted out on the
display side.

On the other hand, the approach exposed by i915-display is to *actively*
disable the display by programming it if needed, i.e. if it was left
enabled by firmware. It also has its use to make sure the HW is actually
disabled and not wasting power.

However having both the way it is in xe doesn't expose a good interface
wrt module params. From modinfo:

disable_display:Disable display (default: false) (bool)
enable_display:Enable display (bool)

Rename enable_display to probe_display to try to convey the message that
the HW is being touched and improve the module param description. To
avoid confusion, the enable_display is renamed everywhere, not only in
the module param. New description for the parameters:

disable_display:Disable display (default: false) (bool)
probe_display:Probe display HW, otherwise it's left untouched (default: true) (bool)

Reviewed-by: Matt Roper <[email protected]>
Acked-by: Jani Nikula <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Remove unused xe parameter
Himal Prasad Ghimiray [Tue, 13 Aug 2024 10:44:19 +0000 (16:14 +0530)]
drm/xe: Remove unused xe parameter

Remove the xe parameter from the pde_encode_pat_index and
pte_encode_pat_index functions, as it is no longer used.

Signed-off-by: Himal Prasad Ghimiray <[email protected]>
Reviewed-by: Tejas Upadhyay <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Name and document Wa_14019789679
Matt Roper [Mon, 12 Aug 2024 18:10:43 +0000 (11:10 -0700)]
drm/xe: Name and document Wa_14019789679

Early in the development of Xe we identified an issue with SVG state
handling on DG2 and MTL (and later on Xe2 as well).  In
commit 72ac304769dd ("drm/xe: Emit SVG state on RCS during driver load
on DG2 and MTL") and commit fb24b858a20d ("drm/xe/xe2: Update SVG state
handling") we implemented our own workaround to prevent SVG state from
leaking from context A to context B in cases where context B never
issues a specific state setting.

The hardware teams have now created official workaround Wa_14019789679
to cover this issue.  The workaround description only requires emitting
3DSTATE_MESH_CONTROL, since they believe that's the only SVG instruction
that would potentially remain unset by a context B, but still cause
notable issues if unwanted values were inherited from context A.
However since we already have a more extensive implementation that emits
the entire SVG state and prevents _any_ SVG state from unintentionally
leaking, we'll stick with our existing implementation just to be safe.

Signed-off-by: Matt Roper <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: add kdev_to_xe_device() helper and use it
Jani Nikula [Mon, 12 Aug 2024 10:30:21 +0000 (13:30 +0300)]
drm/xe: add kdev_to_xe_device() helper and use it

There are enough users for kernel device to xe device conversion, add a
helper for it.

Reviewed-by: Gustavo Sousa <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/38c80846e70c7e410850530426384e17cff9d031.1723458544.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/xe: use pdev_to_xe_device() instead of pci_get_drvdata() directly
Jani Nikula [Mon, 12 Aug 2024 10:30:20 +0000 (13:30 +0300)]
drm/xe: use pdev_to_xe_device() instead of pci_get_drvdata() directly

We have a helper for converting pci device to xe device, use it.

Reviewed-by: Gustavo Sousa <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/1b87c2e56200e001ce3a5d2f4a93eb26b294df32.1723458544.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/xe/tests: remove unused leftover xe_call_for_each_device()
Jani Nikula [Mon, 12 Aug 2024 10:30:19 +0000 (13:30 +0300)]
drm/xe/tests: remove unused leftover xe_call_for_each_device()

xe_call_for_each_device() has been unused since commit 57ecead343e7
("drm/xe/tests: Convert xe_mocs live tests"). Remove it and the related
dev_to_xe_device_fn() and struct kunit_test_data.

Cc: Lucas De Marchi <[email protected]>
Reviewed-by: Gustavo Sousa <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/fa3bb23d005313c9797f557e1211fde09fcb59cc.1723458544.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/xe/migrate: Parameterize ccs and bo data clear in xe_migrate_clear()
Nirmoy Das [Fri, 9 Aug 2024 22:03:47 +0000 (00:03 +0200)]
drm/xe/migrate: Parameterize ccs and bo data clear in xe_migrate_clear()

Parameterize clearing ccs and bo data in xe_migrate_clear() which  higher
layers can utilize. This patch will be used later on when doing bo data
clear for igfx as well.

v2: Replace multiple params with flags in xe_migrate_clear (Matt B)
v3: s/CLEAR_BO_DATA_FLAG_*/XE_MIGRATE_CLEAR_FLAG_* and move to
    xe_migrate.h. other nits(Matt B)

Cc: Himal Prasad Ghimiray <[email protected]>
Cc: Matthew Auld <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Thomas Hellström <[email protected]>
Signed-off-by: Akshata Jahagirdar <[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Nirmoy Das <[email protected]>
7 months agodrm/i915: use pdev_to_i915() instead of pci_get_drvdata() directly
Jani Nikula [Mon, 12 Aug 2024 10:34:15 +0000 (13:34 +0300)]
drm/i915: use pdev_to_i915() instead of pci_get_drvdata() directly

We have a helper for converting pci device to i915 device, use it.

v2: Also convert i915_pci_probe() (Gustavo)

Reviewed-by: Gustavo Sousa <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/xe/xe2hpg: Add Wa_14021821874
Tejas Upadhyay [Mon, 12 Aug 2024 13:41:17 +0000 (19:11 +0530)]
drm/xe/xe2hpg: Add Wa_14021821874

Wa_14021821874 applies to xe2_hpg

V2(Himal):
  - Use space after define

Cc: Matt Roper <[email protected]>
Reviewed-by: Himal Prasad Ghimiray <[email protected]>
Signed-off-by: Tejas Upadhyay <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Signed-off-by: Matt Roper <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Add stats for tlb invalidation count
Nirmoy Das [Sat, 10 Aug 2024 19:15:19 +0000 (21:15 +0200)]
drm/xe: Add stats for tlb invalidation count

Add stats for tlb invalidation count which can be viewed with per GT
stat debugfs file.

Example output:
cat /sys/kernel/debug/dri/0/gt0/stats
tlb_inval_count: 22

v2: fix #include order(Tejas)

Cc: Lucas De Marchi <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Michal Wajdeczko <[email protected]>
Cc: Sai Gowtham Ch <[email protected]>
Reviewed-by: Tejas Upadhyay <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Nirmoy Das <[email protected]>
7 months agodrm/xe/gt: Add APIs for printing stats over debugfs
Nirmoy Das [Sat, 10 Aug 2024 19:15:18 +0000 (21:15 +0200)]
drm/xe/gt: Add APIs for printing stats over debugfs

Add skeleton APIs for recording and printing various stats over
debugfs. This currently only added counter types stats which is backed
by atomic_t and wrapped with CONFIG_DRM_XE_STATS so this can be disabled
on production system.

v4: Rebase and other minor fixes (Matt)
v3: s/CONFIG_DRM_XE_STATS/CONFIG_DEBUG_FS(Lucas)
v2: add missing docs
    Add boundary checks for stats id and other improvements (Michal)
    Fix build when CONFIG_DRM_XE_STATS is disabled(Matt)

Cc: Lucas De Marchi <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Michal Wajdeczko <[email protected]>
Cc: Sai Gowtham Ch <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Nirmoy Das <[email protected]>
7 months agodrm/i915/bios: convert to struct intel_display
Jani Nikula [Fri, 9 Aug 2024 14:27:06 +0000 (17:27 +0300)]
drm/i915/bios: convert to struct intel_display

Going forward, struct intel_display shall replace struct
drm_i915_private as the main display device data pointer type. Convert
intel_bios.[ch] to struct intel_display.

Do one drive-by conversion of unnecessary hex usage to decimal.

Reviewed-by: Imre Deak <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/0d0261a53aff5f141b16b482222a5ffce78e176e.1723213547.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/i915/opregion: convert to struct intel_display
Jani Nikula [Fri, 9 Aug 2024 14:27:05 +0000 (17:27 +0300)]
drm/i915/opregion: convert to struct intel_display

Going forward, struct intel_display shall replace struct
drm_i915_private as the main display device data pointer type. Convert
intel_opregion.[ch] to struct intel_display.

v2:
- Fix declarations for !CONFIG_ACPI (Imre, kernel test robot)
- Pass encoder/connector directly to intel_display() (Imre)

Reviewed-by: Imre Deak <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/aef94503909bbbf95f0244dc382a4d4cd050b903.1723213547.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/i915/opregion: unify intel_encoder/intel_connector naming
Jani Nikula [Fri, 9 Aug 2024 14:27:04 +0000 (17:27 +0300)]
drm/i915/opregion: unify intel_encoder/intel_connector naming

Prefer the short encoder/connector names for struct
intel_encoder/intel_connector variables and parameters.

Reviewed-by: Imre Deak <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/60c67da6b7282ab521366524109ade0470408cf8.1723213547.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/i915/acpi: convert to struct intel_display
Jani Nikula [Fri, 9 Aug 2024 14:27:03 +0000 (17:27 +0300)]
drm/i915/acpi: convert to struct intel_display

Going forward, struct intel_display shall replace struct
drm_i915_private as the main display device data pointer type. Convert
intel_acpi.[ch] to struct intel_display.

Reviewed-by: Imre Deak <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/465436a3442807b49609fc55c9f652a29f96fd02.1723213547.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/i915/bmg: Read display register timeout
Mitul Golani [Wed, 7 Aug 2024 14:21:05 +0000 (19:51 +0530)]
drm/i915/bmg: Read display register timeout

Log the address of the register that caused the timeout
interrupt by reading RMTIMEOUTREG_CAPTURE

--v2:
- Update RMTIMEOUTREG_CAPTURE naming (Suraj)

--v3:
- XeLpdp naming convention.
- Use if condition instead of else if

Signed-off-by: Mitul Golani <[email protected]>
Reviewed-by: Suraj Kandpal <[email protected]>
Signed-off-by: Suraj Kandpal <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Allow to compile out debugfs
Lucas De Marchi [Thu, 8 Aug 2024 17:11:21 +0000 (10:11 -0700)]
drm/xe: Allow to compile out debugfs

Use a dummy xe_debugfs_register() if debugfs is not enabled and move all
debugfs-related files under `ifeq ($(CONFIG_DEBUG_FS),y)` in the
Makefile. This is similar to what was done for display in
commit 439987f6f471 ("drm/xe: don't build debugfs files when
CONFIG_DEBUG_FS=n").

This removes the following warning while loading xe with
CONFIG_DEUBG_FS=n:

xe 0000:03:00.0: [drm] Create GT directory failed

Reviewed-by: Nirmoy Das <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
7 months agodrm/xe: Allow suspend / resume to be safely called multiple times
Matthew Brost [Fri, 9 Aug 2024 19:19:29 +0000 (12:19 -0700)]
drm/xe: Allow suspend / resume to be safely called multiple times

Switching modes between LR and dma-fence can result in multiple calls to
suspend / resume. Make these calls safe while still enforcing call
order.

Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Only enable scheduling upon resume if needed
Matthew Brost [Fri, 9 Aug 2024 19:19:28 +0000 (12:19 -0700)]
drm/xe: Only enable scheduling upon resume if needed

No need to enable scheduling in already enabled.

Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Add xe_sched_add_msg_locked helper
Matthew Brost [Fri, 9 Aug 2024 19:19:27 +0000 (12:19 -0700)]
drm/xe: Add xe_sched_add_msg_locked helper

Will help by allowing callers to own message locking.

Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Reinit msg link when processing a message
Matthew Brost [Fri, 9 Aug 2024 19:19:26 +0000 (12:19 -0700)]
drm/xe: Reinit msg link when processing a message

Will help to avoid adding a static message twice.

Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Add xe_sched_msg_lock/unlock helper
Matthew Brost [Fri, 9 Aug 2024 19:19:25 +0000 (12:19 -0700)]
drm/xe: Add xe_sched_msg_lock/unlock helper

Will help callers to own locking when adding messages to scheduler.

Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Move VM dma-resv lock from xe_exec_queue_create to __xe_exec_queue_init
Matthew Brost [Wed, 24 Jul 2024 15:28:31 +0000 (08:28 -0700)]
drm/xe: Move VM dma-resv lock from xe_exec_queue_create to __xe_exec_queue_init

The critical section which requires the VM dma-resv is the call
xe_lrc_create in __xe_exec_queue_init. Move this lock to
__xe_exec_queue_init holding it just around xe_lrc_create. Not only is
good practice, this also fixes a locking double of the VM dma-resv in
the error paths of __xe_exec_queue_init as xe_lrc_put tries to acquire
this too resulting in a deadlock.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Maarten Lankhorst <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Maarten Lankhorst <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agoMerge tag 'drm-misc-next-2024-08-09' of https://gitlab.freedesktop.org/drm/misc/kerne...
Daniel Vetter [Fri, 9 Aug 2024 08:41:58 +0000 (10:41 +0200)]
Merge tag 'drm-misc-next-2024-08-09' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next

drm-misc-next for v6.12:

UAPI Changes:

- remove Power Saving Policy property

Core Changes:

- update connector documentation

CI:
- add tests for mediatek, meson, rockchip

Driver Changes:

amdgpu:
- revert support for Power Saving Policy property

bridge:
- lt9611uxc: require DRM_BRIDGE_ATTACH_NO_CONNECTOR

mgag200:
- transparently support BMC outputs

omapdrm:
- use common helper for_each_endpoint_of_node()

panel:
- panel-edp: fix name for HKC MB116AN01

vkms:
- clean up endianess warnings

Signed-off-by: Daniel Vetter <[email protected]>
From: Thomas Zimmermann <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/pf: Fix VF config validation on multi-GT platforms
Michal Wajdeczko [Tue, 6 Aug 2024 18:05:16 +0000 (20:05 +0200)]
drm/xe/pf: Fix VF config validation on multi-GT platforms

When validating VF config on the media GT, we may wrongly report
that VF is already partially configured on it, as we consider GGTT
and LMEM provisioning done on the primary GT (since both GGTT and
LMEM are tile-level resources, not a GT-level).

This will cause skipping a VF auto-provisioning on the media-GT and
in result will block a VF from successfully initialize that GT.

Fix that by considering GGTT and LMEM configurations only when
checking if a VF provisioning is complete, and omit GGTT and LMEM
when reporting empty/partial provisioning.

Fixes: 234670cea9a2 ("drm/xe/pf: Skip fair VFs provisioning if already provisioned")
Signed-off-by: Michal Wajdeczko <[email protected]>
Cc: Piotr Piórkowski <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/mgag200: Remove BMC output
Thomas Zimmermann [Mon, 5 Aug 2024 13:06:01 +0000 (15:06 +0200)]
drm/mgag200: Remove BMC output

Mgag200's BMC connector tracks the status of an underlying physical
connector and updates the BMC status accordingly. This functionality
works around GNOME's settings app, which cannot handle multiple
outputs on the same CRTC.

The workaround is now obsolete as the VGA-BMC connector handles BMC
support internally. Hence, remove the driver's code and the BMC output
entirely.

Signed-off-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/mgag200: vga-bmc: Control BMC scanout from encoder
Thomas Zimmermann [Mon, 5 Aug 2024 13:06:00 +0000 (15:06 +0200)]
drm/mgag200: vga-bmc: Control BMC scanout from encoder

Move calls to stop and start BMC scanout from CRTC helpers to the
VGA-BMC encoder's atomic_disable and atomic_enable. Makes the BMC
scanout transparent to the CRTC.

DRM's atomic helpers call an encoder's atomic_disable and atomic_enable
helpers for all enabled encoders. The BMC stops scanning out the VGA
signal if modeset disables the VGA encoder, and starts scanning out
if the modeset enables the VGA encoder.

Signed-off-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/mgag200: vga-bmc: Control CRTC VIDRST flag from encoder
Thomas Zimmermann [Mon, 5 Aug 2024 13:05:59 +0000 (15:05 +0200)]
drm/mgag200: vga-bmc: Control CRTC VIDRST flag from encoder

Control the VIDRST pin from the VGA-BMC encoder's atomic_check and
remove the respective code from CRTC. Makes the VIDRST functionality
fully composable.

The VIDRST pin allows an external clock source to control the SYNC
signals of the Matrox chip. The functionality is part of the CRTC,
but depends on the presence of the clock source. This is the case for
some BMCs, so control the pin from the VGA-BMC output.

Signed-off-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/mgag200: vga-bmc: Transparently handle BMC
Thomas Zimmermann [Mon, 5 Aug 2024 13:05:58 +0000 (15:05 +0200)]
drm/mgag200: vga-bmc: Transparently handle BMC

The VGA-BMC connector selects the VGA output if a display has been
attached to the physical connector. Otherwise it selects the BMC
output. In any case, the connector status is set to 'detected', so
that the userspace compositor displays to it.

Depending on the setting, the connector's display modes either come
from the VGA monitor's EDID or from an internal list of BMC-compatible
modes.

Signed-off-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/mgag200: Add VGA-BMC output
Thomas Zimmermann [Mon, 5 Aug 2024 13:05:57 +0000 (15:05 +0200)]
drm/mgag200: Add VGA-BMC output

Duplicate VGA output to VGA-BMC output and update all code for Matrox
server chips. The new output represents a VGA output that has a BMC
attached to it. No functional changes so far.

Signed-off-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: fix WA 14018094691
Daniele Ceraolo Spurio [Wed, 7 Aug 2024 23:53:32 +0000 (16:53 -0700)]
drm/xe: fix WA 14018094691

This WA is applied while initializing the media GT, but it a primary
GT WA (because it modifies a register on the primary GT), so the XE_WA
macro is returning false even when the WA should be applied.
Fix this by using the primary GT in the macro.

Note that this WA only applies to PXP and we don't yet support that in
Xe, so there are no negative effects to this bug, which is why we didn't
see any errors in testing.

v2: use the primary GT in the macro instead of marking the WA as
platform-wide (Lucas, Matt).

Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Cc: Matt Roper <[email protected]>
Cc: Lucas De Marchi <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/guc: Enable w/a 14022293748 and 22019794406
Julia Filipchuk [Mon, 5 Aug 2024 20:54:35 +0000 (13:54 -0700)]
drm/xe/guc: Enable w/a 14022293748 and 22019794406

Enable workarounds for HW bug where render engine reset fails. Given
that we're bumping the minimum required GuC version to 70.29, we're
guaranteed to always have support for this KLV in the GuC.

v2: Enable KLV correctly for either workaround (Lucas)
v4: Add check for minimum supported GuC firmware version. Enable w/a for
hw version 20.01 too. (Daniele)
v5 (Daniele): remove now unneeded fw type and version checks (JohnH)

Signed-off-by: Julia Filipchuk <[email protected]>
Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Cc: John Harrison <[email protected]>
Reviewed-by: John Harrison <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agoMerge tag 'drm-misc-next-2024-08-01' of https://gitlab.freedesktop.org/drm/misc/kerne...
Daniel Vetter [Thu, 8 Aug 2024 16:58:45 +0000 (18:58 +0200)]
Merge tag 'drm-misc-next-2024-08-01' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next

drm-misc-next for v6.12:

UAPI Changes:

virtio:
- Define DRM capset

Cross-subsystem Changes:

dma-buf:
- heaps: Clean up documentation

printk:
- Pass description to kmsg_dump()

Core Changes:

CI:
- Update IGT tests
- Point upstream repo to GitLab instance

modesetting:
- Introduce Power Saving Policy property for connectors
- Add might_fault() to drm_modeset_lock priming
- Add dynamic per-crtc vblank configuration support

panic:
- Avoid build-time interference with framebuffer console

docs:
- Document Colorspace property

scheduler:
- Remove full_recover from drm_sched_start

TTM:
- Make LRU walk restartable after dropping locks
- Allow direct reclaim to allocate local memory

Driver Changes:

amdgpu:
- Support Power Saving Policy connector property

ast:
- astdp: Support AST2600 with VGA; Clean up HPD

bridge:
- Silence error message on -EPROBE_DEFER
- analogix: Clean aup
- bridge-connector: Fix double free
- lt6505: Disable interrupt when powered off
- tc358767: Make default DP port preemphasis configurable

gma500:
- Update i2c terminology

ivpu:
- Add MODULE_FIRMWARE()

lcdif:
- Fix pixel clock

loongson:
- Use GEM refcount over TTM's

mgag200:
- Improve BMC handling
- Support VBLANK intterupts

nouveau:
- Refactor and clean up internals
- Use GEM refcount over TTM's

panel:
- Shutdown fixes plus documentation
- Refactor several drivers for better code sharing
- boe-th101mb31ig002: Support for starry-er88577 MIPI-DSI panel plus
  DT; Fix porch parameter
- edp: Support AOU B116XTN02.3, AUO B116XAN06.1, AOU B116XAT04.1,
  BOE NV140WUM-N41, BOE NV133WUM-N63, BOE NV116WHM-A4D, CMN N116BCA-EA2,
  CMN N116BCP-EA2, CSW MNB601LS1-4
- himax-hx8394: Support Microchip AC40T08A MIPI Display panel plus DT
- ilitek-ili9806e: Support Densitron DMT028VGHMCMI-1D TFT plus DT
- jd9365da: Support Melfas lmfbx101117480 MIPI-DSI panel plus DT; Refactor
  for code sharing

sti:
- Fix module owner

stm:
- Avoid UAF wih managed plane and CRTC helpers
- Fix module owner
- Fix error handling in probe
- Depend on COMMON_CLK
- ltdc: Fix transparency after disabling plane; Remove unused interrupt

tegra:
- Call drm_atomic_helper_shutdown()

v3d:
- Clean up perfmon

vkms:
- Clean up

Signed-off-by: Daniel Vetter <[email protected]>
From: Thomas Zimmermann <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/i915: remove __i915_printk()
Jani Nikula [Tue, 6 Aug 2024 13:38:32 +0000 (16:38 +0300)]
drm/i915: remove __i915_printk()

With the previous cleanups, the last remaining user of __i915_printk()
is i915_probe_error(). Switch that to use drm_dbg() and drm_err()
instead, dropping the request to report bugs in the few remaining
specific cases.

It's not common for drivers to log bug filing requests to begin with,
but these cases are in init, which is most likely to be tested in CI and
least likely to be hit by end users anyway.

Acked-by: Tvrtko Ursulin <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/be9baeab281f75999e96cc7ad1c06c6680494bc1.1722951405.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/i915: remove i915_report_error()
Jani Nikula [Tue, 6 Aug 2024 13:38:31 +0000 (16:38 +0300)]
drm/i915: remove i915_report_error()

i915_report_error() presently acts as a wrapper for __i915_printk(). In
practice, it would be better to use drm level error reporting wherever
possible, so replace all uses of i915_report_error() with the equivalent
drm_err() call. These cases are not worth having a dedicated wrapper to
also print bug reporting info. Replacing the calls leaves
i915_report_error() with no users, so remove it.

Reviewed-by: Tvrtko Ursulin <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/19eab020c57c0fa45acacf4e4a8077e57cd4d561.1722951405.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/i915: remove a few __i915_printk() uses
Jani Nikula [Tue, 6 Aug 2024 13:38:30 +0000 (16:38 +0300)]
drm/i915: remove a few __i915_printk() uses

__i915_printk() does nothing special for notice/info levels. Just use
the regular drm_notice() and drm_info() calls.

Reviewed-by: Andi Shyti <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/82857a0c04d3c11ca6758f05c13a3cec4f1a2f01.1722951405.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <[email protected]>
7 months agodrm/i915: Replace double blank with single blank after comma
Andi Shyti [Wed, 7 Aug 2024 13:05:16 +0000 (14:05 +0100)]
drm/i915: Replace double blank with single blank after comma

Do not use double blanks, ",  " in function parameters where it's
not required by any alignment purpose. Replase it with a single
blank, ", ".

Signed-off-by: Andi Shyti <[email protected]>
Reviewed-by: Jani Nikula <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/vkms: Fix cpu_to_le16()/le16_to_cpu() warnings
José Expósito [Tue, 16 Jul 2024 16:17:26 +0000 (18:17 +0200)]
drm/vkms: Fix cpu_to_le16()/le16_to_cpu() warnings

Building with Sparse enabled prints this warning for cpu_to_le16()
calls:

    warning: incorrect type in assignment (different base types)
        expected unsigned short [usertype]
        got restricted __le16 [usertype]

And this warning for le16_to_cpu() calls:

    warning: cast to restricted __le16

Declare the target buffer as __le16 to fix both warnings.

Reviewed-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Louis Chauvet <[email protected]>
Acked-by: Maíra Canal <[email protected]>
Signed-off-by: José Expósito <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Fix access_ok check in user_fence_create
Nirmoy Das [Tue, 6 Aug 2024 11:07:22 +0000 (13:07 +0200)]
drm/xe: Fix access_ok check in user_fence_create

Check size of the data not size of the pointer.

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Fixes: 0fde907da2d5 ("drm/xe: Validate user fence during creation")
Cc: Matthew Auld <[email protected]>
Cc: Matthew Brost <[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
Reviewed-by: Tejas Upadhyay <[email protected]>
Reviewed-by: Apoorva Singh <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Nirmoy Das <[email protected]>
7 months agogpu: drm: use for_each_endpoint_of_node()
Kuninori Morimoto [Tue, 30 Jul 2024 00:34:40 +0000 (00:34 +0000)]
gpu: drm: use for_each_endpoint_of_node()

We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto <[email protected]>
Acked-by: Dmitry Baryshkov <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Tomi Valkeinen <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Add kernel doc for xe_hw_engine_lookup
Mika Kuoppala [Tue, 6 Aug 2024 15:30:09 +0000 (18:30 +0300)]
drm/xe: Add kernel doc for xe_hw_engine_lookup

kerneldoc was missing from earlier commit where
we exported xe_hw_engine_lookup. Add it.

Cc: Dominik Grzegorzek <[email protected]>
Cc: Mika Kuoppala <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Lucas De Marchi <[email protected]>
Cc: "Thomas Hellström" <[email protected]>
Cc: [email protected]
Signed-off-by: Mika Kuoppala <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe: Export xe_hw_engine's mmio accessors
Dominik Grzegorzek [Tue, 6 Aug 2024 15:30:08 +0000 (18:30 +0300)]
drm/xe: Export xe_hw_engine's mmio accessors

Export hw engine's mmio accessors. This is in preparation
to use these from eudebug code.

v2: s/hw_engine_mmio/xe_hw_engine_mmio (Matthew)
v3: kernel doc (Matthew)

Cc: Matthew Brost <[email protected]>
Signed-off-by: Dominik Grzegorzek <[email protected]>
Signed-off-by: Mika Kuoppala <[email protected]>
Reviewed-by: Matthew Brost <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/guc: Define GuC version v70.29.2 for BMG
Julia Filipchuk [Fri, 2 Aug 2024 22:21:28 +0000 (15:21 -0700)]
drm/xe/guc: Define GuC version v70.29.2 for BMG

UAPI version 1.13.4

Signed-off-by: Julia Filipchuk <[email protected]>
Reviewed-by: Daniele Ceraolo Spurio <[email protected]>
Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/guc: Bump minimum required GuC version to v70.29.2
Julia Filipchuk [Fri, 2 Aug 2024 22:21:27 +0000 (15:21 -0700)]
drm/xe/guc: Bump minimum required GuC version to v70.29.2

The VF API version for this release is 1.13.4.

Bumping the minimum required GuC version just before force-probe
removal allows us to set a baseline for what API features are expected
to be available. I.e., at this point there is no need for any version
checking in the code before using a feature. Of course, if/when the
API is extended in future GuC releases, those new features will need
API version checks in the code.

Bump the recommended GuC versions to match.

Also add numerical comparison helpers to simplify the version number
checks.

v2: Reword commit message and make comparison helpers GuC specific -
review feedback from Daniele, done by JohnH

Signed-off-by: Julia Filipchuk <[email protected]>
Signed-off-by: John Harrison <[email protected]>
Reviewed-by: Daniele Ceraolo Spurio <[email protected]>
Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/xe/xe2: Add performance turning changes
Shekhar Chauhan [Mon, 5 Aug 2024 05:37:10 +0000 (11:07 +0530)]
drm/xe/xe2: Add performance turning changes

Update performance tuning according to the hardware spec.

Bspec: 72161
Signed-off-by: Shekhar Chauhan <[email protected]>
Reviewed-by: Sai Teja Pottumuttu <[email protected]>
Reviewed-by: Akshata Jahagirdar <[email protected]>
Signed-off-by: Matt Roper <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
7 months agodrm/ci: rockchip: add tests for rockchip display driver
Vignesh Raman [Tue, 30 Jul 2024 02:15:41 +0000 (07:45 +0530)]
drm/ci: rockchip: add tests for rockchip display driver

For rockchip rk3288 and rk3399, the display driver is rockchip
and gpu driver is panfrost. Currently, in drm-ci for rockchip
rk3288 and rk3399, only the gpu driver is tested. Refactor
the existing rockchip jobs to test both display and gpu driver
and update xfails.

Since the correct driver name is passed from the job to test gpu
and display driver, remove the check to set IGT_FORCE_DRIVER
based on driver name for rockchip jobs.

Acked-by: Helen Koike <[email protected]>
Reviewed-by: Daniel Stone <[email protected]>
Signed-off-by: Vignesh Raman <[email protected]>
Signed-off-by: Helen Koike <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
This page took 0.118305 seconds and 4 git commands to generate.