Commit graph

1,463,948 commits

Author SHA1 Message Date
Matthew Brost
aa8216142a drm/xe: Track parallel page fault activity in GT stats
Add a new GT statistic, PARALLEL_PAGEFAULT_COUNT, to record when
multiple page fault workers are active concurrently.

When a worker dequeues a fault, scan peer workers for an active
cache entry and increment the counter if another fault is already
in flight. This provides basic visibility into parallel fault
handling behavior for performance analysis and tuning.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-13-matthew.brost@intel.com
2026-08-07 13:31:50 -07:00
Matthew Brost
d4a7e16117 drm/xe: batch CT pagefault acks with periodic flush
Pagefault storms can generate long chains of acknowledgments back to the
GuC. Sending each ack as a full CT submission forces a barrier,
descriptor update and doorbell per fault.

Extend xe_guc_ct_send_locked() with a “defer-flush” mode that copies the
message into the H2G ring but defers publishing the descriptor and
ringing the doorbell. Add xe_guc_ct_send_flush() to publish pending
writes and notify GuC once per batch. Wire this into the pagefault
producer via new ack_fault_begin/ack_fault_end callbacks and CT lock
wrappers.

To avoid excessive flush latency while still amortizing MMIO costs, use
a simple periodic flush heuristic for GuC pagefault acks: batch most
acks as defer-flush and force a publish at a fixed interval (e.g., every
16th ack), with a final flush at end-of-batch.

Also increase the H2G CTB size to 16K to better absorb bursts.

Assisted-by: ChatGPT:gpt-5 # Documentation
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Francois Dugast <francois.dugast@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-12-matthew.brost@intel.com
2026-08-07 13:31:48 -07:00
Matthew Brost
dd157120f7 drm/xe: Add debugfs pagefault_info
Add a debugfs entry to dump Xe page fault queue state. The output
includes queue geometry (entry size, total size, head/tail), per-entry
allocation state counts, and whether each page fault worker cache is
currently valid.

This is intended to help debug page fault storms, chaining, and retry
behaviour without needing tracing.

Assisted-by: ChatGPT:gpt-5 # Documentation
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-11-matthew.brost@intel.com
2026-08-07 13:31:46 -07:00
Matthew Brost
d67f040466 drm/xe: Add pagefault chaining stats
Add GT stats to quantify pagefault chaining behavior during fault storms.

Track total chained faults, faults chained directly from the IRQ
handler, cases where IRQ chaining also drained the queue, chained faults
that had to be requeued due to range mismatch, and cases where the last
serviced range allowed immediate ack.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-10-matthew.brost@intel.com
2026-08-07 13:31:45 -07:00
Matthew Brost
f2b4b3f814 drm/xe: Chain page faults via queue-resident cache to avoid fault storms
Some Xe platforms can generate pagefault storms where many faults target
the same address range in a short time window (e.g. many EU threads
faulting the same page). The current worker/locking model effectively
serializes faults for a given range and repeatedly performs VMA/range
lookups for each fault, which creates head-of-queue blocking and wastes
CPU in the hot path.

Introduce a page fault chaining cache that coalesces faults targeting
the same ASID and address range.

Each worker tracks the active fault range it is servicing. Fault entries
reside in stable queue storage, allowing the IRQ handler to match new
faults against the worker cache and directly chain cache hits onto the
active entry without allocation or waiting for dequeue. Once the leading
fault completes, the worker acknowledges the entire chain.

A small allocation state is added to each entry so queue, worker, and
IRQ paths can safely reference the same fault object. This prevents
reuse while the fault is active and guarantees that chained faults
remain valid until acknowledged.

Fault handlers also record the serviced range so subsequent faults can
be acknowledged without re-running the full resolution path.

This removes repeated fault resolution during fault storms and
significantly improves forward progress in SVM workloads.

Since threaded prefetches now use a dedicated prefetch workqueue
(usm.prefetch_wq) rather than sharing the page fault workqueue, page
fault servicing can no longer deadlock on vm->lock, so this cache does
not need an -EAGAIN retry path for a failed vm->lock acquisition.

Assisted-by: ChatGPT:gpt-5 # Documentation
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Francois Dugast <francois.dugast@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-9-matthew.brost@intel.com
2026-08-07 13:31:43 -07:00
Matthew Brost
107156dc6b drm/xe: Track pagefault worker runtime
Add a GT stat measuring total time spent servicing pagefault workqueue
iterations. The counter accumulates the runtime of the pagefault worker
in microseconds, allowing correlation of fault storms and chaining
behavior with CPU time spent in the fault handler.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-8-matthew.brost@intel.com
2026-08-07 13:31:41 -07:00
Matthew Brost
24fca684c4 drm/xe: Engine class and instance into a u8
Pack the engine class and instance fields into a single u8 to save space
in struct xe_pagefault. This also makes future extensions easier.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-7-matthew.brost@intel.com
2026-08-07 13:31:39 -07:00
Matthew Brost
b56f37907a drm/xe: Add num_pf_work modparam
Add a module parameter to control the number of page-fault work threads,
making it easy to experiment with how different numbers of work threads
impact performance.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-6-matthew.brost@intel.com
2026-08-07 13:31:37 -07:00
Matthew Brost
6c10041422 drm/xe: Use a single page-fault queue with multiple workers
With fine-grained page-fault locking, it no longer makes sense to
maintain multiple page-fault queues, as we no longer hash queues based
on the VM’s ASID. Multiple workers can pull page faults from a single
queue, eliminating any head-of-queue blocking. Refactor the structures
and code to use a single shared queue.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-5-matthew.brost@intel.com
2026-08-07 13:31:35 -07:00
Matthew Brost
65d3bfa42c drm/xe: Thread prefetch of SVM ranges
The migrate_vma_* functions are very CPU-intensive; as a result,
prefetching SVM ranges is limited by CPU performance rather than paging
copy engine bandwidth. To accelerate SVM range prefetching, the step
that calls migrate_vma_* is now threaded. A dedicated prefetch
workqueue is used for threading so prefetch work is never mixed with
page fault or garbage collector work.

Running xe_exec_system_allocator --r prefetch-benchmark, which tests
64MB prefetches, shows an increase from ~4.35 GB/s to 12.25 GB/s with
this patch on drm-tip. Enabling high SLPC further increases throughput
to ~15.25 GB/s, and combining SLPC with ULLS raises it to ~16 GB/s. Both
of these optimizations are upcoming.

Since the dedicated prefetch workqueue is not shared with page fault
or SVM garbage collector work, page fault servicing and garbage
collection can keep using a plain down_read() on vm->lock: there is no
risk of a blocked reader starving a worker that a pending writer is
waiting to flush, because that flushing is now confined to the
separate prefetch workqueue.

Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Francois Dugast <francois.dugast@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-4-matthew.brost@intel.com
2026-08-07 13:31:33 -07:00
Matthew Brost
53e76bde11 drm/xe: Allow prefetch-only VM bind IOCTLs to use VM read lock
Prefetch-only VM bind IOCTLs do not modify VMAs or use userptr pages.
Downgrade vm->lock to read mode once setup is complete.

Lays the groundwork for prefetch IOCTLs to use threaded migration.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Francois Dugast <francois.dugast@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-3-matthew.brost@intel.com
2026-08-07 13:31:31 -07:00
Matthew Brost
941bcc1a4b drm/xe: Fine grained page fault locking
Enable page faults to be serviced while holding vm->lock in read mode.

Introduce additional locks to:
 - Ensure only one page fault thread services a given range or VMA
 - Serialize SVM garbage collection
 - Protect SVM range insertion and removal

While these locks may contend during page faults, expensive operations
like migration can now run in parallel within a single VM.

In addition to new locking, ranges must be reference-counted after
lookup, as another thread could immediately remove them from the GPU SVM
tree, potentially dropping the last reference.

Lastly, decouple the VM’s ASID from the page fault queue selection to
allow parallel page fault handling within the same VM.

Lays the groundwork for prefetch IOCTLs to use threaded migration too.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Link: https://patch.msgid.link/20260806185202.3922432-2-matthew.brost@intel.com
2026-08-07 13:31:29 -07:00
Matthew Brost
52d223c05e Merge drm/drm-next into drm-xe-next
Bring drm-xe-next up to date DRM GPU SVM changes.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
2026-08-07 13:29:14 -07:00
Karthik Poosa
b30c987554
drm/xe/hwmon: handle CRI+ power interval encoding
On CRI and newer platforms, the power-limit interval encoding is changed
from the legacy 1.x * 2^y format to a U5.2 value in milliseconds.
Update the interval calculation accordingly for CRI and future platforms.

v2: Round the fractional bit to 1 for values greater than 0.5 ms in the
    show path, as the minimum supported time is 1 ms.
    No special handling is needed in the store path since sysfs inputs are
    only in milliseconds. (Badal)

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Link: https://patch.msgid.link/20260703153320.1368225-1-karthik.poosa@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2026-08-07 09:59:49 -04:00
Jia Yao
9daa302a82 drm/xe/guc_ads: use uncached mapping for UM queue BO
On Pre-Xe3p platform, the GAM write the UM queue through DPA using UC.
if GuC reads the queue via GGTT (WB), stale data may be observed
when the cacheline has been polluted by another agent.

To match the GAM's UC writes, configure the GuC mapping as UC as well.

Fixes: 9c57bc0865 ("drm/xe/lnl: Drop force_probe requirement")
Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: <stable@vger.kernel.org> # v6.12+
Signed-off-by: Jia Yao <jia.yao@intel.com>
Reviewed by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patch.msgid.link/20260804165057.129529-4-jia.yao@intel.com
2026-08-06 11:54:00 +01:00
Jia Yao
ace076ef0a drm/xe/guc_ads: allocate UM queues in VRAM on dGFX
On iGPU, the UM queue BO is allocated in system memory. On dGFX, the BO
was previously created in system memory and later reallocated in
xe_guc_realloc_post_hwconfig().  Allocate the UM queue BO directly in
VRAM on dGFX, where it is ultimately required.

Fixes: 9c57bc0865 ("drm/xe/lnl: Drop force_probe requirement")
Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: <stable@vger.kernel.org> # v6.12+
Signed-off-by: Jia Yao <jia.yao@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patch.msgid.link/20260804165057.129529-3-jia.yao@intel.com
2026-08-06 11:54:00 +01:00
Jia Yao
6af05de0dc drm/xe/guc_ads: allocate UM queues in a separate BO
Move the UM queues into a dedicated BO (ads->um_queue_bo) and avoid
CPU memset operations on it, which eliminates the CPU as a potential
cacheline-polluting agent and helps maintain consistency between GAM
writes and GuC reads.

We also need to ensure the base_dpa for the queue is contiguous on hw
where this is used instead of a GGTT address. Another good reason to
split this out to a separate BO.

Fixes: 9c57bc0865 ("drm/xe/lnl: Drop force_probe requirement")
Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: <stable@vger.kernel.org> # v6.12+
Signed-off-by: Jia Yao <jia.yao@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patch.msgid.link/20260804165057.129529-2-jia.yao@intel.com
2026-08-06 11:46:31 +01:00
Dave Airlie
ec3e941937 Cleanup and modernization for Exynos encoders
- Remove dependency on deprecated DRM simple KMS helpers
     . Replaces drm_simple_encoder_init() with drm_encoder_init() across dp,
       dpi, dsi, vidi and hdmi.
     . Adds per-driver drm_encoder_funcs with .destroy = drm_encoder_cleanup,
       removing the intermediate layer between the drivers and atomic modesetting.
   - Add error handling to drm_encoder_init()
     . Checks the return code at every call site instead of ignoring it.
     . Prevents silent encoder creation failures and drm_encoder_cleanup() on an
       uninitialized encoder.
 
   Bug fix for Exynos HDMI DDC adapter refcounting
   - Take an i2c adapter module reference
     . Switches to of_get_i2c_adapter_by_node() / i2c_put_adapter() so the
       adapter module reference is held while the DDC bus is in use.
     . Makes an unload attempt fail gracefully with -EBUSY instead of blocking
       uninterruptibly in i2c_del_adapter().
 -----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEoxi+6c5pRPV/gdXcxWAb7Og/+bYFAmpu3mwACgkQxWAb7Og/
 +bZS2wwAj9i6AMtZRTtBuA2tieGVabQDTg91AHWHEhkH6+oWOCl+lsM5NTi9vuls
 OyyF729TEcfIFMEM/mHwqanX1AZaKBHoBmsTgAmA6UM92cwXzrBMC6I7ueXjPBT7
 ZzVxilgOWpls+RYVks6kA+XLOlk9CCvTXOuOZocwFqCAuKM0L6nw/udfo2KdqJdb
 bql24T26g1Sj4AgasirewOERA3vFqKdrA5dlf72VhkXReoq/8VfMIDc1BGx2dPjB
 VsRY9U/t6wvoZEwbpmGnvjBYwPSs64Y5Qw2v6Z8Q8oZbpK5Igl5LNpIPWKwEyl46
 cOBHsPoG0/SC+/PO2U1v5hyy0c4gl+PiWUnrAZypthT/7anRzh8FA6cKZpAmB1dh
 9iQJ+hS+nodQNZEvSqJ4lmsVhUnJmZbuNrZ9pvUFhYqtsI+GN6J4p0SqyGmpZZ6k
 WGhT/JTLeueoADHcokcvBntf2bSst2kUFY87UUvvyTrlYl2+nSNPpW8VRx4lhFHP
 I4CX9Oze
 =/qfD
 -----END PGP SIGNATURE-----

Merge tag 'exynos-drm-next-for-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next

  Cleanup and modernization for Exynos encoders
  - Remove dependency on deprecated DRM simple KMS helpers
    . Replaces drm_simple_encoder_init() with drm_encoder_init() across dp,
      dpi, dsi, vidi and hdmi.
    . Adds per-driver drm_encoder_funcs with .destroy = drm_encoder_cleanup,
      removing the intermediate layer between the drivers and atomic modesetting.
  - Add error handling to drm_encoder_init()
    . Checks the return code at every call site instead of ignoring it.
    . Prevents silent encoder creation failures and drm_encoder_cleanup() on an
      uninitialized encoder.

  Bug fix for Exynos HDMI DDC adapter refcounting
  - Take an i2c adapter module reference
    . Switches to of_get_i2c_adapter_by_node() / i2c_put_adapter() so the
      adapter module reference is held while the DDC bus is in use.
    . Makes an unload attempt fail gracefully with -EBUSY instead of blocking
      uninterruptibly in i2c_del_adapter().

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Inki Dae <inki.dae@samsung.com>
Link: https://patch.msgid.link/20260802061039.73544-1-inki.dae@samsung.com
2026-08-06 14:40:00 +10:00
Dave Airlie
24893f3f08 amd-drm-next-7.3-2026-07-31:
amdgpu:
 - PM sysfs fix for APUs
 - DC pageflip timeout fixes
 - New GFX7 soft reset implementation
 - Misc code cleanup
 
 amdkfd:
 - Remove svm_bo eviction fence
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQgO5Idg2tXNTSZAr293/aFa7yZ2AUCamy9NAAKCRC93/aFa7yZ
 2NmJAP9dfXEzqxC4xoozErqmDsAHd5zCYtD80aJSyNfQuZkzhQEAnCogTQDJPK5u
 67LKXehWeCYJBx38gk412ZesZUYoKQE=
 =+H72
 -----END PGP SIGNATURE-----

Merge tag 'amd-drm-next-7.3-2026-07-31' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-7.3-2026-07-31:

amdgpu:
- PM sysfs fix for APUs
- DC pageflip timeout fixes
- New GFX7 soft reset implementation
- Misc code cleanup

amdkfd:
- Remove svm_bo eviction fence

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patch.msgid.link/20260731153253.1393962-1-alexander.deucher@amd.com
2026-08-06 12:50:01 +10:00
Dave Airlie
cc8d88fdc5 Mediatek DRM Next - 20260731
1. cec: Correct the compatibles for mt7623-mt8167
 -----BEGIN PGP SIGNATURE-----
 
 iQJMBAABCgA2FiEEACwLKSDmq+9RDv5P4cpzo8lZTiQFAmpr3cAYHGNodW5rdWFu
 Zy5odUBrZXJuZWwub3JnAAoJEOHKc6PJWU4k2AUP/02+O7EkBvIhZPBanjG4gR4v
 dGmt+IC2y6usetdsyY/8yWrgTRDhwbmG6YFbCYaedpNsPg7WNcqAyt2s+JaLtp0B
 z8/c6bDtBm6cUF/h/7FXm9E79efiE3Pi1HXBdNeKMNtJ+JCh2leu0AOxm7HSrAdB
 01ciL0u6BLpxmlOwr7mthyCIPHxsEMF1Ikkm9ps5LZFTf5m94MNvssC7bR1jtYe5
 XTus2II4WanO1xBVsp1GgRVE+tO5Lfb2dW689Q39GHx0L/WYlUuHRFhD6xvI+hwC
 Duoek8Skw6pPJ/A0IAdKlCb3dE77EmCqi/WO3THrGvurG4muj8ZIBO+JwNBfThbz
 t0Y3kvs/Hs+ZfUMlN00wf2VWwL0vGzrmTP70S/vhWmdGfagcC4fSrLMqQFTpN/aT
 s3AHuqIeE/Z31JPOnZ57+wMd1JH6L+VeDiwKF+3niuEjkfuITDGjvwUAd0IAP6Q/
 FjIzRQrG+SZgS14mKyoNNpKBQgQogBnnxO9ZGOmsj5XDlrojNkxU6HIdN+xTEmNs
 Y8Fk2uUcOnIuIwNszdMzgSKHYSxqg0EUlBztmPFGk/RLdBm0REJ9Bzd8u1cfnM4b
 +R7X8hHaLu9YRaFIoSAI9LTx8sJX8qIuesg2pl6GR7PXXHtjtRIKDT2is8xQgGxf
 g9lCQG8TVyxT4LN3PpZr
 =q7mT
 -----END PGP SIGNATURE-----

Merge tag 'mediatek-drm-next-20260731' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-next

Mediatek DRM Next - 20260731

1. cec: Correct the compatibles for mt7623-mt8167

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://patch.msgid.link/20260730233317.3222-1-chunkuang.hu@kernel.org
2026-08-06 11:26:06 +10:00
Raag Jadav
20bc4883c7 drm/xe/ras: Fix boot-time ras error processing
Currently, we xe_ras_process_errors() inside xe_ras_init() to handle boot
time errors. But this can potentially result in declaring the device as
wedged quite early in the driver load sequence, which is problematic due to
the lack of registered drm device or required wedged cleanup hooks at this
point.

Call xe_ras_process_errors() only after the prerequisites are available.

Fixes: d9732e498f ("drm/xe/xe_ras: Query errors from system controller on probe")
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Tested-by: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
Link: https://patch.msgid.link/20260730110635.925537-1-raag.jadav@intel.com
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
2026-08-04 11:45:03 +05:30
Niranjana Vishwanathapura
c40be0c6e4 drm/xe/multi_queue: replay dynamic CGP updates lost during VF migration
When guc_exec_queue_revert_pending_state_change() sets needs_cgp_sync for
a queue, replay that update during unpause by injecting a CGP_SYNC_MSG
static message at the head of the scheduler queue.

The message handler __guc_exec_queue_process_msg_cgp_sync() calls
guc_exec_queue_send_cgp_sync() which re-reads the current priority from
q->multi_queue.priority and re-issues the CGP write + CGP_SYNC H2G, so
the queue's CGP entry is restored to the correct value after migration.

Assisted-by: Github-Copilot:Claude-opus-4.8
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260803230528.3428029-10-niranjana.vishwanathapura@intel.com
2026-08-03 16:19:15 -07:00
Niranjana Vishwanathapura
116a19d83e drm/xe/multi_queue: track and recover lost CGP updates across VF migration
When a CGP_SYNC (or REGISTER_CONTEXT_MULTI_QUEUE with CGP) is in flight
during VF migration, GuC loses the message and never sends CGP_SYNC_DONE.
Two failure modes exist:

1. The send was already issued (CGP_SYNC_DONE not received):
   group->sync_pending stays set and cgp_update_q points to the queue
   that owns the outstanding sync.

2. The wait woke early (send not issued):
   The queue returned from xe_guc_exec_queue_group_cgp_sync() without
   sending after vf_recovery() became true.

Track which kind of sync is outstanding (registering_cgp / updating_cgp)
and the owning queue (cgp_update_q) so
guc_exec_queue_revert_pending_state_change()
can recover both cases:
- A registration-time CGP bails or is lost  → clear registered flag so
  run_job re-registers after unpause (re_register / registering_cgp paths).
- A dynamic CGP update bails or is lost → set needs_cgp_sync so replay
  re-issues the update after unpause (re_update / updating_cgp paths).

Tag all registration call sites with CGP_SYNC_REGISTRATION so the bail
path distinguishes them from dynamic updates.

Assisted-by: Github-Copilot:Claude-opus-4.8
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260803230528.3428029-9-niranjana.vishwanathapura@intel.com
2026-08-03 16:19:14 -07:00
Niranjana Vishwanathapura
713d515168 drm/xe/multi_queue: handle CGP_SYNC wait timeout during VF recovery
The CGP_SYNC wait in xe_guc_exec_queue_group_cgp_sync() only woke on
sync_pending clearing or GuC stop. During VF migration the CT wakes all
waiters but sync_pending may still be set (the GuC lost the in-flight
message), causing the timeout path to fire and ban the group.

Add vf_recovery() as a third wake condition and exclude it from the
error path so a migration-woken wait returns success rather than
triggering a GT reset.

Assisted-by: Github-Copilot:Claude-opus-4.8
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260803230528.3428029-8-niranjana.vishwanathapura@intel.com
2026-08-03 16:19:13 -07:00
Niranjana Vishwanathapura
245d86b3d5 drm/xe: split VF pause into prepare and revert phases
Extract xe_sched_submission_stop() + cancel_delayed_work_sync() into a
new guc_exec_queue_pause_prepare() helper, then call it in a first pass
over all queues before the existing revert loop in
xe_guc_submit_pause_vf().

In a multi-queue group a secondary's run_job() can register the primary
queue, which must not race an in-progress revert of a sibling queue.
Stopping every scheduler before reverting any queue prevents that race.

No functional change outside the VF migration path.

Assisted-by: Github-Copilot:Claude-opus-4.8
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260803230528.3428029-7-niranjana.vishwanathapura@intel.com
2026-08-03 16:19:12 -07:00
Marcin Bernatowicz
f09360e857 drm/xe/uc: Apply RCS/CCS yield policy to SR-IOV VFs
VFs were missing the call to apply the global scheduling policy.
Call xe_guc_submit_enable() during vf_uc_load_hw() to ensure VFs
get the same policy enforcement as PF.

Fixes: 26caeae9fb ("drm/xe/guc: Set RCS/CCS yield policy")
Suggested-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patch.msgid.link/20260709075945.1337660-1-marcin.bernatowicz@linux.intel.com
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
2026-08-04 01:07:05 +02:00
Michał Winiarski
75e7ac70ec drm/xe: Reject duplicated properties for EXEC_QUEUE_SET_PROPERTY
All of the properties are idempotent - setting them multiple times on
the same exec_queue within a single IOCTL doesn't make sense.
Return an error when duplicated property is found.

Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260624111421.1258364-2-michal.winiarski@intel.com
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
2026-08-04 01:07:05 +02:00
Michał Winiarski
f6b6cc1118 drm/xe: Fix memory leak in exec_queue_set_hang_replay_state()
The q->replay_state is blindly overwritten, which can potentially leak
memory that was previously allocated by vmemdup_user().
Return an error if q->replay_state is not empty.

Discovered using AI-assisted static analysis confirmed by Intel Product
Security.

Reported-by: Martin Hodo <martin.hodo@intel.com>
Fixes: 1026c1a73a ("drm/xe: Implement DRM_XE_EXEC_QUEUE_SET_HANG_REPLAY_STATE")
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260624111421.1258364-1-michal.winiarski@intel.com
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
2026-08-04 01:07:05 +02:00
Vinay Belgaumkar
41fe15d1a4
drm/xe: Add debugfs for IA/GT bias
GT_IA_PERF_BIAS_REG indicates power budget between IA and GT.
Lower 16 bits correspond to IA and upper to GT. Higher value
indicates more bias towards that plane. The values are in U1.15
format.

$ cat /sys/kernel/debug/dri/0/gt0/gt_ia_bias
0x80004000 (GT: 1.0000, IA: 0.5000)

This interface will allow us to observe power budget changes while
running workloads and also, if needed, tune it. Minimum allowed value
for each of GT/IA bias is 0x10, and max is 0x8000 which corresponds
to a bias ratio of 1.

Bspec: 51878

v3: Add a helper function for U1.15 decode (Michal)
v4: Validate input values (Rodrigo)
v5: Comments (Michal, Rodrigo)
v6: Rename to gt_ia_bias (Anirban), check lower bound (Michal)
v7: Update filename in commit message

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sk Anirban <sk.anirban@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Assisted-by: Copilot:auto
Reviewed-by: Sk Anirban <sk.anirban@intel.com>
Link: https://patch.msgid.link/20260729221629.593195-3-vinay.belgaumkar@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2026-08-03 17:56:54 -04:00
Vinay Belgaumkar
5c45e2dbe6
drm/xe: Use IBC v3 on PTL
Intelligent Bias Control (IBC) v3 algorithm in GuC has PTL specific
optimizations. This version selection param is only available GuC 70.48.0
onwards.

v4: Fix sashiko.dev review issue
v5: Don't cascade return checks (Rodrigo)

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Link: https://patch.msgid.link/20260729221629.593195-2-vinay.belgaumkar@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2026-08-03 17:56:53 -04:00
Piotr Piórkowski
0dcdade947 drm/xe/mert: Rate limit VF LMTT fault debug log
A faulty or malicious VF may repeatedly trigger LMTT faults and
generate many identical CATERR debug messages.

Use xe_sriov_dbg_ratelimited() to reduce log spam while keeping
useful debug information available.

Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
Link: https://patch.msgid.link/20260721093116.4011940-3-piotr.piorkowski@intel.com
Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
2026-08-03 18:13:21 +02:00
Piotr Piórkowski
b5bf339a73 drm/xe: Add dbg_ratelimited printk wrappers
Add dbg_ratelimited() wrappers for Xe logging helpers.

These wrappers provide a debug logging equivalent of the existing
rate-limited error messages and allow callers to limit repeated debug
prints to reduce log spam and makes debugging easier.

Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
Link: https://patch.msgid.link/20260721093116.4011940-2-piotr.piorkowski@intel.com
Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
2026-08-03 18:13:21 +02:00
Raag Jadav
948eee331b drm/xe/ras: Validate sysctrl response
Validate errors raised by sysctrl firmware instead of blindly trusting
them.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Riana Tauro <riana.tauro@intel.com>
Link: https://patch.msgid.link/20260722143142.675658-1-raag.jadav@intel.com
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
2026-08-03 14:36:49 +05:30
Ashutosh Dixit
cffeb4ef6f drm/xe/oa: Extend OAM unit hwe assignment for new dGfx
dGfx vecs hwe's for media version 35.00 and later follow the same
assignment to OAM units as vcs engines.

Bspec: 77977

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patch.msgid.link/20260729230645.3052178-3-ashutosh.dixit@intel.com
2026-08-02 21:56:02 -07:00
Ashutosh Dixit
1dff677209 drm/xe/mcr: Take vcs1/vecs1 into account for first media slice
vcs1 and vecs1 may also be present on the first media slice, so take
vcs1/vecs1 also into account when determining if the first media slice is
absent.

Bspec: 67103, 77977

Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20260729230645.3052178-2-ashutosh.dixit@intel.com
2026-08-02 21:56:01 -07:00
Johan Hovold
99b1947ba2
drm/exynos: hdmi: take i2c adapter module reference
The i2c subsystem currently blocks during adapter deregistration
whenever there are consumers holding a reference.

Switch to using of_get_i2c_adapter_by_node() which also takes a
reference to the adapter module so that an attempt to unload the module
while in use fails gracefully instead of blocking uninterruptibly.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2026-08-02 14:54:06 +09:00
Diogo Silva
51f556d630
drm/exynos: Add error handling to drm_encoder_init()
Not handling the return code on drm_encoder_init can lead to silent
failure and/or a drm_encoder_cleanup on a non-initialized encoder.
This patch adds error handling to the drm_encoder_init calls to prevent
that from happening.

Signed-off-by: Diogo Silva <diogompaissilva@gmail.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2026-08-02 14:42:27 +09:00
Diogo Silva
9377ab1ee7
drm/exynos: Remove dependency on DRM simple helpers
Simple KMS helper are deprecated since they only add an intermediate
layer between drivers and the atomic modesetting.
This patch removes the dependency on drm simple helpers from exynos
DRM drivers.

Signed-off-by: Diogo Silva <diogompaissilva@gmail.com>
Dropped unnecessary blank line and reorder header definition.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2026-08-02 14:41:38 +09:00
Dave Airlie
82cb10c8bc - Wait on external BO kernel fences in exec IOCTL (Brost)
- General clean-up (Anas)
 - Documentation fix (Rafael)
 - Add a debugfs for pcode information (Karthik)
 - Free madvise VMA array on L2 flush failure (Guangshuo)
 - Page Table related fixes (Shuicheng, Zongyao)
 - Improvements GuC error handling and GuC small fixes (Sk, Zhanjun, Arvind)
 - Add new W/As	(Daniele, Harish)
 - GuC paging engine support (Auld)
 - Add and use more KLV helpers (Michal)
 - Balance exec queue suspend/resume (Niranjana, Thomas)
 - Fix BO prefetch with CONSULT_MEM_ADVISE_PREF_LOC (Himal)
 - SRIOV: Disable display in admin only PF mode (Satya)
 - Fix writable override for CRI NVM (Sasha)
 - Fix VF CCS attach/detach race with in-flight BO moves (Brost)
 - Introduce Xe Uncorrectable Error Handling (Riana)
 - Fix WOPCM size for LNL+ (Daniele)
 - Consolidate debugfs fault injection functions (Mallesh)
 - Multi-queue related fixes and improvements (Niranjana, Jagmeet, Shuicheng)
 - Add RAS GPU health indicator (Soham)
 - PAT related improvements (Roper, Sanjay)
 - NULL deref fix on migration on VF (Satya)
 - i2c related fix (Raag)
 - Fix SVM leak and clean up xe_vm_create (Shuicheng)
 - Drop force_probe requirement for NVL-s (Gustavo)
 - Optimise TT population for DONTNEED BOs (Auld)
 - Add page size allocation mode control and coverage (Himal, Nareshkumar)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEbSBwaO7dZQkcLOKj+mJfZA7rE8oFAmprc9AACgkQ+mJfZA7r
 E8q6XQgArSvJu5g1GCkevsb4C8ymY9WyhUfVw2PCxGTqEQkoe7bTZhe9Y6uzUzDU
 uT1+9kt0hjPp6gnyv3GdAcUqfkxzwAb/ZWMiuym8guoeR+KeEUF+uuyFZ0SPb0i9
 7ynT3838Kh0b9R2IT/s6MEadA/Eov0hbJ0//Ky3VZMq6tERDvJ6v2/hy4xSTS+IO
 0cCreG0w/NbSExh9KaP8npERUQ+YLe5ndD8XctyTvb+VQ936FNlOMZbN0TmXRvlZ
 gFWIU6Hy0+XBiavGoOeGzLy/u54ZhlfInHMSveETxF2qGZL1S7verogOCNZHHt4T
 nUA82/ab6Jg0R5zmefOXXJCeYuVvwQ==
 =P46R
 -----END PGP SIGNATURE-----

Merge tag 'drm-xe-next-2026-07-30' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-next

- Wait on external BO kernel fences in exec IOCTL (Brost)
- General clean-up (Anas)
- Documentation fix (Rafael)
- Add a debugfs for pcode information (Karthik)
- Free madvise VMA array on L2 flush failure (Guangshuo)
- Page Table related fixes (Shuicheng, Zongyao)
- Improvements GuC error handling and GuC small fixes (Sk, Zhanjun, Arvind)
- Add new W/As	(Daniele, Harish)
- GuC paging engine support (Auld)
- Add and use more KLV helpers (Michal)
- Balance exec queue suspend/resume (Niranjana, Thomas)
- Fix BO prefetch with CONSULT_MEM_ADVISE_PREF_LOC (Himal)
- SRIOV: Disable display in admin only PF mode (Satya)
- Fix writable override for CRI NVM (Sasha)
- Fix VF CCS attach/detach race with in-flight BO moves (Brost)
- Introduce Xe Uncorrectable Error Handling (Riana)
- Fix WOPCM size for LNL+ (Daniele)
- Consolidate debugfs fault injection functions (Mallesh)
- Multi-queue related fixes and improvements (Niranjana, Jagmeet, Shuicheng)
- Add RAS GPU health indicator (Soham)
- PAT related improvements (Roper, Sanjay)
- NULL deref fix on migration on VF (Satya)
- i2c related fix (Raag)
- Fix SVM leak and clean up xe_vm_create (Shuicheng)
- Drop force_probe requirement for NVL-s (Gustavo)
- Optimise TT population for DONTNEED BOs (Auld)
- Add page size allocation mode control and coverage (Himal, Nareshkumar)

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patch.msgid.link/amt2kDVdyBK6VEyU@intel.com
2026-08-01 07:06:36 +10:00
Dave Airlie
2b3f7c2c8d Merge tag 'drm-intel-next-2026-07-28' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next
drm/i915 feature pull #2 for v7.3:

Features and functionality:
- Enable UHBR link rates on Thunderbolt tunneled links (Imre)
- Reduce Xe3+ PM demand peak bandwidth for power savings (Vinod)
- Add the blend mode property to all planes that support alpha blending (Chaitanya)
- Enable pipe DMC error interrupts for display 30+ (Dibin)
- Add KUnit tests for DP link config selection and fallback (Imre)

Refactoring and cleanups:
- Refactor DP link config selection and unify across use cases (Imre)
- Unify i915 and xe display runtime PM calls (Jani)
- Refactor BIOS framebuffer takeover (Ville)

Fixes:
- Fix HD audio on DP UHBR SST (Kai Vehmanen)
- Fixes to xe driver BIOS framebuffer takeover (Ville)
- Fix 2 pixels-per-clock CDCLK calculation to avoid underruns (Ville)
- Fix incorrectly set VSC SDP Main Stream Attribute (Chaitanya)
- Fix BPC and DSC selection for HDMI sinks (Alexander Kaplan)
- Fix PCON max FRL rate selection (Alexander Kaplan)
- Workaround Xe3P PSR2 screen corruption (Dibin)
- Fix NVL A & B stepping vtotal setting (Suraj)
- Fix xe DPT allocation paths (Maarten)
- Prefer system memory instead of stolen for new framebuffers in xe (Maarten)
- Fix transcoder mask sizes (John Harrison)
- Clear stale UV/Y plane DDB entries on plane disable (Vinod)
- Fix some DP AUX backlight control issues, again (Suraj)
- Fix switching between HDCP 1.4 and 2.2 authentication (Suraj)
- Remove unnecessary Xe2_LPD+ FBC plane width and surface size limits (Vinod)
- Ensure non-zero DSB safe window for PTL+ (Ankit)
- Fix bandwidth calculation to account for 16 DRAM channels (Uma)
- Fix NV12 ceiling division for bigjoiner case (Vidya)

DRM core changes:
- Add Thunderbolt UHBR tunneling support (Imre)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patch.msgid.link/cb1b5a644d75589cbcdcc8ec8160968140426439@intel.com
2026-08-01 06:05:01 +10:00
Dave Airlie
22afd697fb amd-drm-next-7.3-2026-07-29:
amdgpu:
 - VCN 5.3 fix
 - UserQ fixes
 - GEM close optimization
 - HDMI AV mute fix
 - UML build fixes
 - GFXOFF residency metrics fixes
 - SMU 15 fixes
 - debug_vm fix
 - PSP 15 fixes
 - NBIO 7.11.5 fix
 - pptable use after free fix
 - gpu metrics fetch fix
 - DC viewport fix
 - DML2.1 fix
 - i2c retimer spam fix
 - UMD profile pstate fix
 - Power metrics format cleanup
 - GTT size fix on APUs
 - DC context logging fix
 - Misc fixes
 - IB pool clean up and fixes
 - DCN 4.2 updates
 - Old BUG() and BUG_ON() removal
 - RAS updates
 - PASID management updates
 - DC MCIF ARB updates
 - More DC KUNIT tests
 - Refactor dc_validation_set
 - Introduce dc_state_get_status unified status accessor
 - Apple Studio Display fixes
 - DML updates
 - DC writeback fixes
 - MES updates
 - PTL updates
 - DC code restructuring
 - DC FRL fixes
 - Add modifiers for GFX6-8
 - Resume fix for MacBookPro15,1
 
 amdkfd:
 - Various bounds checking fixes
 - Mutex locking fix
 - Clean up debug runlist printing
 - SR-IOV fixes
 - Avoid topology_lock in kfd_mmap
 - Fix signal reset event
 - SVM eviction fixes
 
 radeon:
 - Fix for unset CONFIG_ACPI
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQgO5Idg2tXNTSZAr293/aFa7yZ2AUCampfMAAKCRC93/aFa7yZ
 2La+AQDF6p/uJ4rKQO/NnOLTmdPKKgqIeuYzdbRXq1FGVoTGZwD7BO4JK6I3E6zz
 sgj7+ifZG2zaOhrs0qou8Sm2zak0+gA=
 =+K2n
 -----END PGP SIGNATURE-----

Merge tag 'amd-drm-next-7.3-2026-07-29' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-7.3-2026-07-29:

amdgpu:
- VCN 5.3 fix
- UserQ fixes
- GEM close optimization
- HDMI AV mute fix
- UML build fixes
- GFXOFF residency metrics fixes
- SMU 15 fixes
- debug_vm fix
- PSP 15 fixes
- NBIO 7.11.5 fix
- pptable use after free fix
- gpu metrics fetch fix
- DC viewport fix
- DML2.1 fix
- i2c retimer spam fix
- UMD profile pstate fix
- Power metrics format cleanup
- GTT size fix on APUs
- DC context logging fix
- Misc fixes
- IB pool clean up and fixes
- DCN 4.2 updates
- Old BUG() and BUG_ON() removal
- RAS updates
- PASID management updates
- DC MCIF ARB updates
- More DC KUNIT tests
- Refactor dc_validation_set
- Introduce dc_state_get_status unified status accessor
- Apple Studio Display fixes
- DML updates
- DC writeback fixes
- MES updates
- PTL updates
- DC code restructuring
- DC FRL fixes
- Add modifiers for GFX6-8
- Resume fix for MacBookPro15,1

amdkfd:
- Various bounds checking fixes
- Mutex locking fix
- Clean up debug runlist printing
- SR-IOV fixes
- Avoid topology_lock in kfd_mmap
- Fix signal reset event
- SVM eviction fixes

radeon:
- Fix for unset CONFIG_ACPI

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patch.msgid.link/20260729201801.4073097-1-alexander.deucher@amd.com
2026-07-31 16:23:53 +10:00
Nareshkumar Gollakoti
60693b580a drm/xe/tests: add live KUnit coverage for BO page-size allocation modes
Add live KUnit coverage for the debug-controlled BO
    page-size allocation modes.

    The new tests cover forced 2M mode, forced 1G mode,
    and mixed mode. They verify that user BO creation applies
    the expected NEEDS_* flags, that no unexpected page-size flags are
    added in the forced modes, that BO size is rounded as expected, and
    that page_alignment matches the selected leaf size.

    The mixed-mode test does not assume a strict per-allocation rotation
    sequence, since the device-global mixed-mode index may be perturbed by
    concurrent BO creation on a live system. Instead,
    it validates that each allocation results in
    one valid mixed-mode page-size outcome.

    Treat transient VRAM allocation failures as skipped test cases so the
    tests can run in varying live environments without producing false
    failures.

    v3
    - address review comments
    - rework mixed-mode test to avoid assuming strict rotation order
    - reword commit message
    v4
    - skip VRAM-targeted live tests on non-dGFX devices
    v5
    - advance the mixed-mode index in the test
    v6
    - Gaurd kunit tests under CONFIG_DRM_XE_DEBUG_PAGE_SIZE
    v9
    - consider XE_VRAM_FLAGS_NEED64K in mixed mode for certain
      platoform min alignment expectations.

Signed-off-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patch.msgid.link/20260729121843.1255891-7-naresh.kumar.g@intel.com
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
2026-07-30 08:49:34 +05:30
Nareshkumar Gollakoti
41a74ed31f drm/xe/pt: allow selecting the bind leaf PTE level
Add a target_leaf_level field to the page-table bind walk and use it to
    control the level at which leaf entries are emitted.

    By default, the bind walk emits level-0 leaf PTEs and relies on
    xe_pt_hugepte_possible() to select huge mappings when possible. Add an
    explicit target leaf level so the walk can stop earlier when the VMA
    requests a larger mapping size.

    Use level 1 for 2M PDE mappings and level 2 for 1G PDP mappings, while
    keeping level 0 for normal mappings. The existing huge-page heuristic
    is preserved for the default level-0 path.

    This allows the bind path to emit 2M and 1G leaf entries when requested
    by the VMA, while still validating alignment and size requirements.

    v2
    - avoid using max_level to control walk depth
    - use target_leaf_level to preserve the normal walk behavior
    - keep the default huge-page heuristic only for the level-0 path
    - refine commit message

    v3
    - reword commit message

    v4
    - allow fallback to smaller huge-page levels for non-zero
      target_leaf_level
    - avoid constraining clear_pt walks by target_leaf_level

    v5(Himal)
    - Restrict only intended level in debug page size policy mode
    - Allow the normal path to proceed smoothly when
      no debug page-size mode is selected.
    v8 (Himal)
    - Drop
      https://patchwork.freedesktop.org/patch/740059/?series=168905&rev=5
      patch and populate target_leaf_level from bo flags
    - populate target_leaf_level if it is in debug page size mode
      otherwise fill with 0 which is having no effect on the normal
      flow
    v10 (Himal)
    - use xe_bo_is_vram() instead of raw VRAM flag checks
      so huge-page selection is based on BO VRAM placement.

Signed-off-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patch.msgid.link/20260729121843.1255891-6-naresh.kumar.g@intel.com
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
2026-07-30 08:49:34 +05:30
Nareshkumar Gollakoti
2285c120e1 drm/xe: apply debug page-size allocation policy to user BOs
Apply the debug page-size allocation policy during user BO creation.

When page-size allocation control is enabled, override the user BO
page-size selection flags based on the selected debug mode and round the
requested size up to the corresponding granularity:
  - 2M mode selects 2M handling
  - 1G mode selects 1G handling
  - mixed mode selects the page size from the current mixed-mode index

This is intended for internal debug and validation flows. When the
control mode is left at the default setting, the normal user BO creation
path is unchanged.

v2
- ensure debug page-size allocation does not
  affect the default path (sashiko)
- rework synchronization for concurrent access (sashiko)
- refactor commit message for readability

v3
- update user BO size alignment based on debug policy mode
- reword commit message
- ensure normal user flow is unchanged when debug policy is disabled

v4(sashiko)
- limit debug page-size policy application to VRAM BOs
- do not override preexisting page-size requirement flags
- advance mixed-mode index only after successful
  BO create ioctl completion
- add overflow checks before ALIGN() in debug page-size handling
- ensure CONFIG_DRM_XE_DEBUG_PAGE_SIZE enabled and it is dgfx

v5(Himal)
v5:
- Guard debug page-size policy paths with CONFIG_DRM_XE_DEBUG_PAGE_SIZE
- Leave the normal BO creation path unchanged
  when no debug mode is selected

v8(Himal)
- Avoid current index increment for system BO's
- Simplify mixed mode align logic by changing array to struct array
- Have a inline check if it is on debug mode or not
- Avoid condition compiled debug in function code blocks

Signed-off-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patch.msgid.link/20260729121843.1255891-5-naresh.kumar.g@intel.com
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
2026-07-30 08:49:34 +05:30
Nareshkumar Gollakoti
caf4fd4eb8 drm/xe: add XE_BO_FLAG_NEEDS_1G for minimum page-size sizing
Add XE_BO_FLAG_NEEDS_1G to mark BOs that require 1G minimum page-size
sizing.

Update xe_bo_init_locked() to honor the new flag in the existing
VRAM/stolen-memory minimum page-size sizing path. When
XE_BO_FLAG_NEEDS_1G is set, the BO size is rounded up to 1G. Otherwise,
the existing 2M and 64K sizing behavior is preserved.

If multiple minimum page-size flags are set, the largest requirement
takes precedence: 1G over 2M over 64K.

v3
- commit message reworded

Signed-off-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patch.msgid.link/20260729121843.1255891-4-naresh.kumar.g@intel.com
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
2026-07-30 08:49:34 +05:30
Nareshkumar Gollakoti
ceb4e4f0df drm/xe/debugfs: add page-size allocation mode knob
Expose a debugfs control to override the page-size allocation mode used
for user BOs.

The interface allows switching between the default allocation policy,
forced 2M, forced 1G, and mixed allocation modes at runtime. This
provides a simple way to validate behavior and debug page-size-dependent
allocation flows.

The debugfs entry is built only when CONFIG_DRM_XE_DEBUG_PAGE_SIZE is
enabled.

v2
- update changelog to match mutex-based cur_index handling
- reset cur_index when switching to mixed mode (sashiko)

v3
- add CONFIG guard for page-size allocation debugfs support (Himal)
- create debugfs entry under CONFIG_DRM_XE_DEBUG_PAGE_SIZE

v4
- reorderd this patch with kconfig patch to ensure patch builds
- Gurding this debug knob for only discrete graphics

v5(Himal)
- Guard all page size calls with CONFIG_DRM_XE_DEBUG_PAGE_SIZE

v8(Himal)
- For read/show used READ_ONCE instead lock
- to match Reader used WRITE_ONCE under lock protection
- change modes to string format to read/writer for debugfs

v9(Himal)
- Add an OOB guard for mode in page_size_alloc_mode_show().
  This check makes the function display "unknown" if mode has been
  maliciously altered by KMD, preventing out-of-bounds access.
  Under normal operation, values set through debugfs are validated,
  so OOB values should not occur.
- simplify mode-to-string lookup using page_size_alloc_mode_names[]
- use sysfs_match_string() to parse page_size_alloc_mode writes

Signed-off-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patch.msgid.link/20260729121843.1255891-3-naresh.kumar.g@intel.com
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
2026-07-30 08:49:34 +05:30
Nareshkumar Gollakoti
6bea40fc4c drm/xe: add page size allocation control state to xe_device
Introduce xe_page_size_alloc_ctrl_mode and add page_size_alloc_ctrl
state to struct xe_device along with mutex lock.

The new control supports forcing user BO allocations to 2M pages,
forcing them to 1G pages, or using a mixed round-robin mode across
4K, 64K, 2M, and 1G page sizes. Track the current mixed-mode index
in xe_device so allocation policy can be applied consistently.

v2
- make cur_index to atomic as update need in later patch to
  avoid race/concurency (sashiko)
v3
- reworded comments
- protect mode/index updates with a mutex for proper concurrency handling

v4(sashiko)
- move xe_debug_page_size_alloc_ctrl_init() before drm_dev_register(),
  so mutex and control states are initialized
  before any userspace visibility

v5(Himal)
- Guard all the debug page size policy code under CONFIG
- Squash Kconfig patch to have Kconfig entry for DEBUG_PAGE_SIZE
- Add inline to check debug page size support and exact mode
  configured if it is supported.

v6 (fix CI build)

v8 (Himal)
- use drmm_mutex_init to avoid leak with mutex_init
- call xe_debug_page_size_alloc_ctrl_init unconditionally
- Add missed mixed mode check on xe_debug_page_size_mode_not_none check
- Add xe_debug_page_size_mode_is_mixed() function

v9
- make xe_debug_page_size_alloc_ctrl_init() return int
- fail probe if drmm_mutex_init() for page_size_alloc_ctrl.lock fails

Signed-off-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patch.msgid.link/20260729121843.1255891-2-naresh.kumar.g@intel.com
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
2026-07-30 08:49:34 +05:30
Luca Leonardo Scorcia
4c0ca180a3 dt-bindings: mediatek: cec: Correct the compatibles for mt7623-mt8167
The HDMI CEC driver for both mt7623 and mt8167 is actually the same as
mt8173-cec and the mt7623n.dtsi board include file already uses mt8173-cec
compatible as a fallback, but the documentation lists them as separate
entries. Correct the binding by adding the correct fallback.

This change fixes the following dtbs_check errors:

DTC [C] arch/arm/boot/dts/mediatek/mt7623n-rfb-emmc.dtb
cec@10012000 (mediatek,mt7623-cec): compatible: ['mediatek,mt7623-cec',
  'mediatek,mt8173-cec'] is too long
DTC [C] arch/arm/boot/dts/mediatek/mt7623n-bananapi-bpi-r2.dtb
cec@10012000 (mediatek,mt7623-cec): compatible: ['mediatek,mt7623-cec',
  'mediatek,mt8173-cec'] is too long

Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20260624173627.19785-1-l.scorcia@gmail.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
2026-07-29 23:21:27 +00:00
Ulisses Paixao
9243cf4777 drm/amd/amdgpu: remove duplicated code in gfx_v11 and gfx_v12
The functions gfx_v11_0_handle_priv_fault and
gfx_v12_0_handle_priv_fault share the same logic for searching and
triggering a scheduler fault on a ring. This patch moves the shared
ring-searching logic to a common function, amdgpu_gfx_handle_priv_fault,
in amdgpu_gfx.c. The hardware-specific decoding of ring IDs remains in
the version-specific files to maintain proper architectural separation.

Signed-off-by: Ulisses Paixao <ulissespaixao@usp.br>
Co-developed-by: Felipe Sousa <felipesousa@usp.br>
Signed-off-by: Felipe Sousa <felipesousa@usp.br>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-07-29 17:56:28 -04:00
Timur Kristóf
d8b517d374 drm/amdgpu/gfx7: Enable IP block soft reset as a GPU recovery method
Enable IP block soft reset as a GPU recovery method for GFX7
graphics and compute rings.

This improves current user experience on all GFX7 chips:

* On Kaveri and Kabini there is currently no working
  GPU recovery method so those chips currently require
  the user to manually reset the computer when there
  was a hang.

* On Hawaii and Bonaire, the current GPU recovery method
  always clears the contents of VRAM, which means that
  a buggy (hanging) app can crash the whole graphical
  session, which is less than ideal.

Using GFX IP block soft reset means that we can now
have a working recovery on GFX7 APUs and we can also
move on from GFX hangs on dGPUs without crashing the
whole system.

Tested with the "hard_reset_cp_wait" test case from the
Hang Test Suite created by Natalie Vock and Konstantin Seurer.
This Vulkan testcase waits for an event that never occurs,
effectively a WAIT_REG_MEM packet that intentionally hangs.
IP block soft reset can resolve that hang and allow
the rest of the system to move on and keep functioning
without needing a full ASIC reset.

Tested on the following chips:

Bonaire (Radeon HD 7790)
Hawaii (Radeon R9 390X)
Kaveri (A10-7850K)

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-07-29 17:56:01 -04:00