Skip to content

[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Intel] sync intel i915 drm driver to upstream v6.7 #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

opsiff
Copy link
Member

@opsiff opsiff commented Jun 5, 2025

Summary by Sourcery

Sync the Intel i915 driver to kernel v6.7 by adding GuC-assisted TLB invalidation paths and new ABI actions, integrating GSC firmware support, standardizing GT logging, refining engine list handling, updating reset timing, and applying various bug fixes and selftest adjustments.

New Features:

  • Add GuC-based TLB invalidation path with H2G commands, G2H responses, waiters, and xarray tracking
  • Introduce GSC firmware support definitions and loading paths using compatibility-only major versions
  • Add asynchronous dead GuC worker to handle crash and exception notifications outside G2H context

Bug Fixes:

  • Wake up all pending TLB invalidation waiters on GuC or GT reset/suspend to avoid hung waits
  • Fix out-of-date OA buffer head/tail handling by removing GTT offset miscalculations

Enhancements:

  • Standardize logging with gt_print macros (gt_err, gt_dbg, etc.) to include GT identifier
  • Refactor user engine registration lists to use a unified llist/list/rbtree union in engine structures
  • Adjust GPU reset timings and atomic waits to new microsecond-based wait helpers
  • Add early resume hook to sanitize steer semaphores during driver resume

Tests:

  • Tweak selftest spinner and migration timings (longer msleep for OTHER_CLASS engines)
  • Use memset32 to pad spinner batches and replace strncpy with strscpy in mock_context

Copy link

sourcery-ai bot commented Jun 5, 2025

Reviewer's Guide

Sync Intel i915 driver to v6.7: implements GuC-based TLB invalidation using XArray waitqueues, introduces GT‐aware logging macros, extends GPU reset timeouts, enhances GSC firmware handling, refactors user‐engine data structures, cleans up performance buffer pointer arithmetic, and updates the GEM shrinker to iterate per GT.

Sequence Diagram: GuC-based TLB Invalidation Process

sequenceDiagram
    participant D as Driver
    participant GUC as Intel GuC
    participant TLB_HW as GT TLB Hardware

    D->>D: intel_gt_invalidate_tlb_full() called
    alt GuC TLB Invalidation Path (HAS_GUC_TLB_INVALIDATION and GuC ready)
        D->>D: Chooses intel_guc_invalidate_tlb_engines() or _guc()
        Note right of D: Internally calls guc_send_invalidate_tlb()
        D->>D: Prepares intel_guc_tlb_wait (entry in tlb_lookup or serial_slot)
        D->>GUC: H2G Command: INTEL_GUC_ACTION_TLB_INVALIDATION (with seqno)
        D->>D: Waits on tlb_wait.wq using must_wait_woken()
        GUC->>TLB_HW: Performs TLB invalidation on hardware
        GUC->>D: G2H Message: INTEL_GUC_ACTION_TLB_INVALIDATION_DONE (with seqno)
        D->>D: G2H Handler (ct_process_request -> intel_guc_tlb_invalidation_done)
        Note right of D: Wakes up waiting thread via wait_wake_outstanding_tlb_g2h()
    else Legacy MMIO Invalidation Path
        D->>TLB_HW: Direct MMIO based TLB Invalidation (mmio_invalidate_full)
    end
    D->>D: TLB Invalidation Process Complete
Loading

Sequence Diagram: GuC Crash and Exception Handling via Worker

sequenceDiagram
    participant GUC_HW as Intel GuC (Hardware/Firmware)
    participant DRV_CT as Driver (CT Layer / G2H Handler)
    participant GUC_MOD as Driver (intel_guc module)
    participant WORKER as Driver (dead_guc_worker)
    participant GT_MOD as Driver (Intel GT module)

    GUC_HW->>DRV_CT: G2H Msg (e.g., NOTIFY_CRASH_DUMP_POSTED / NOTIFY_EXCEPTION)
    DRV_CT->>GUC_MOD: ct_process_request() calls intel_guc_crash_process_msg(action)
    GUC_MOD->>WORKER: queue_work(system_unbound_wq, &guc->dead_guc_worker)
    activate WORKER
    WORKER->>WORKER: guc_dead_worker_func() executes
    WORKER->>GUC_MOD: Reads guc.last_dead_guc_jiffies
    alt Short interval since last failure (delta < 500ms)
        WORKER->>GT_MOD: intel_gt_set_wedged(gt)
    else (First failure or longer interval)
        WORKER->>GT_MOD: intel_gt_handle_error(gt, ALL_ENGINES, ..., "dead GuC")
        WORKER->>GUC_MOD: Updates guc.last_dead_guc_jiffies = jiffies
    end
    deactivate WORKER
Loading

Updated Class Diagram for intel_guc and new intel_guc_tlb_wait

classDiagram
    class intel_guc {
        +xarray tlb_lookup
        +u32 serial_slot
        +u32 next_seqno
        +work_struct dead_guc_worker
        +unsigned_long last_dead_guc_jiffies
        +wake_up_all_tlb_invalidate()
        +intel_guc_tlb_invalidation_is_available() bool
        +init_tlb_lookup() int
        +fini_tlb_lookup()
        +wait_wake_outstanding_tlb_g2h(u32 seqno)
        +intel_guc_tlb_invalidation_done(const u32* payload, u32 len) int
        +guc_send_invalidate_tlb(intel_guc_tlb_invalidation_type type) int
        +intel_guc_invalidate_tlb_engines() int
        +intel_guc_invalidate_tlb_guc() int
        +intel_guc_crash_process_msg(u32 action) int
    }

    class intel_guc_tlb_wait {
        +wait_queue_head wq
        +bool busy
    }

    intel_guc "1" -- "*" intel_guc_tlb_wait : Uses via tlb_lookup
Loading

Class Diagram: UABI Engine List Structure Refactoring

classDiagram
    class drm_i915_private {
      +llist_head uabi_engines_llist
      +list_head uabi_engines_list
      +rb_root uabi_engines
      note "Fields are part of a union for UABI engines"
    }

    class intel_engine_cs {
      +llist_node uabi_llist
      +list_head uabi_list
      +rb_node uabi_node
      note "Fields are part of a union for UABI linkage"
    }
Loading

File-Level Changes

Change Details Files
GuC TLB invalidation framework
  • Add XArray "tlb_lookup" with init/fini and cyclic allocation for waiter slots
  • Implement wake_up_all_tlb_invalidate to release blocked waiters on reset or cancellation
  • Introduce guc_send_invalidate_tlb with waitqueues, sequence numbers, retry under memory pressure
  • Handle H2G/G2H actions INTEL_GUC_ACTION_TLB_INVALIDATION and DONE in CT and host message paths
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
drivers/gpu/drm/i915/gt/uc/intel_guc.h
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
drivers/gpu/drm/i915/gt/uc/intel_guc.c
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
drivers/gpu/drm/i915/gt/intel_tlb.c
drivers/gpu/drm/i915/gt/selftest_tlb.c
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h
GT‐aware logging macros
  • Define gt_dbg/gt_err/gt_notice and once variants in intel_gt_print.h
  • Replace drm_dbg/drm_err/drm_notice calls with GT‐context macros across reset, GSC, workarounds modules
drivers/gpu/drm/i915/gt/intel_gt_print.h
drivers/gpu/drm/i915/gt/intel_reset.c
drivers/gpu/drm/i915/gt/uc/intel_gsc.c
Extended GPU reset timeouts
  • Increase PCI reset assertion delays to 50 µs and use _wait_for_atomic with 50 ms timeouts
  • Unify reset polling calls to use _wait_for_atomic for media and render resets
drivers/gpu/drm/i915/gt/intel_reset.c
GSC firmware support enhancements
  • Add INTEL_GSC_FIRMWARE_DEFS and MAKE_GSC_FW_PATH macros
  • Declare GSC blobs in firmware tables and auto‐select lists
  • Use gt_err/gt_dbg in GSC init and IRQ handling
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc.c
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
Engine UABI data structure refactor
  • Change uabi_nodes to a union of llist, list, and rb_node for multi‐stage init
  • Use llist_head for user engine registration and convert to sorted list
  • Update iterators in intel_engine_user.c and i915_drv.h accordingly
drivers/gpu/drm/i915/gt/intel_engine_types.h
drivers/gpu/drm/i915/gt/intel_engine_user.c
drivers/gpu/drm/i915/i915_drv.h
OA buffer pointer arithmetic cleanup
  • Remove manual GTT offset adjustments when reading tail/head
  • Simplify tail comparison logic to use stream->oa_buffer.tail directly
  • Reset head/tail to zero on buffer init
drivers/gpu/drm/i915/i915_perf.c
GEM shrinker multi-GT iteration
  • Loop over all GTs when retiring active contexts under I915_SHRINK_ACTIVE
  • Iterate per‐GT ggtt vm.bound_list to unbind stale IO maps
  • Aggregate freed pages across multiple GTs
drivers/gpu/drm/i915/gem/i915_gem_shrinker.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @opsiff - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -159,6 +159,21 @@ static void gen11_disable_guc_interrupts(struct intel_guc *guc)
gen11_reset_guc_interrupts(guc);
}

static void guc_dead_worker_func(struct work_struct *w)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (complexity): Consider replacing the custom jiffies-based throttling and manual work management with the kernel's delayed_work API for dead GuC handling.

Suggested change
static void guc_dead_worker_func(struct work_struct *w)
Rather than roll your own jiffiesthrottling + plain work_struct + ad hoc flushing everywhere, you can leverage delayed_work to get both throttling and a singleflushablequeue point. This drops the extra `last_dead_guc_jiffies` field, the manual `jiffies_to_msecs()` dance, and scattered `flush_work()` calls.
1. In your struct, switch to delayed_work:
```c
- struct work_struct dead_guc_worker;
+ struct delayed_work dead_guc_dw;
  1. Init it once in init_early:
-   INIT_WORK(&guc->dead_guc_worker, guc_dead_worker_func);
+   INIT_DELAYED_WORK(&guc->dead_guc_dw, guc_dead_worker_fn);
  1. Simplify the worker fn – no timestamps needed:
static void guc_dead_guc_worker_fn(struct work_struct *w)
{
    struct intel_guc *guc =
        container_of(to_delayed_work(w), struct intel_guc, dead_guc_dw);
    struct intel_gt *gt = guc_to_gt(guc);

    /* always capture/reset via the standard path */
    intel_gt_handle_error(gt, ALL_ENGINES, I915_ERROR_CAPTURE, "dead GuC");
}
  1. Centralize scheduling + throttle via delay:
static void guc_schedule_dead_guc(struct intel_guc *guc)
{
    /* schedule only once per 500ms window */
    schedule_delayed_work(&guc->dead_guc_dw,
                          msecs_to_jiffies(500));
}
  1. Replace all queue_work(...) + flush_work(...) or queue_work(system_unbound_wq, ...) calls with:
    guc_schedule_dead_guc(guc);

and remove all last_dead_guc_jiffies and flush_work() invocations.

  1. In fini/_suspend/reset paths, do one final flush:
    cancel_delayed_work_sync(&guc->dead_guc_dw);

This collapses multiple reset paths onto the existing delayed_work API, preserves the 500 ms throttle, and gives you a single point to cancel/flush.

Copilot

This comment was marked as outdated.

shekhar-chauhan and others added 22 commits June 9, 2025 15:39
mainline inclusion
commit d3b0466
from mainline v6.7-rc1
category: bugfix

[ Upstream commit d3b0466 ]

Since this Wa is specific to DirectX, this is not required on Linux.

Signed-off-by: Shekhar Chauhan <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Signed-off-by: Matt Roper <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit d3b0466)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 2eb23c9
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 2eb23c9 ]

Align igt_spinner_create_request with the hang_create_request
implementation in selftest_hangcheck.c.

Signed-off-by: Jonathan Cavitt <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Acked-by: Andi Shyti <[email protected]>
Signed-off-by: Matt Roper <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 2eb23c9)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit b2edc41
from mainline v6.7-rc1
category: bugfix

[ Upstream commit b2edc41 ]

If GuC hits an internal error (and survives long enough to report it
to the KMD), it is basically toast and will stop until a GT reset and
subsequent GuC reload is performed. Previously, the KMD just printed
an error message and then waited for the heartbeat to eventually kick
in and trigger a reset (assuming the heartbeat had not been disabled).
Instead, force the reset immediately to guarantee that it happens and
to eliminate the very long heartbeat delay. The captured error state
is also more likely to be useful if captured at the time of the error
rather than many seconds later.

Note that it is not possible to trigger a reset from with the G2H
handler itself. The reset prepare process involves flushing
outstanding G2H contents. So a deadlock could result. Instead, the G2H
handler queues a worker thread to do the reset asynchronously.

v2: Flush the worker on suspend and shutdown. Add rate limiting to
prevent spam from a totally dead system (review feedback from Daniele).

Signed-off-by: John Harrison <[email protected]>
Reviewed-by: Daniele Ceraolo Spurio <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit b2edc41)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit e427343
from mainline v6.7-rc1
category: bugfix

[ Upstream commit e427343 ]

Add FW definition and the matching override modparam.

The GSC FW has both a release version, based on platform and a rolling
counter, and a compatibility version, which is the one tracking
interface changes. Since what we care about is the interface, we use
the compatibility version in the binary names.

Same as with the GuC, a major version bump indicate a
backward-incompatible change, while a minor version bump indicates a
backward-compatible one, so we use only the former in the file name.

Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Cc: Alan Previn <[email protected]>
Cc: John Harrison <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Cc: Rodrigo Vivi <[email protected]>
Reviewed-by: Alan Previn <[email protected]>
Acked-by: Rodrigo Vivi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit e427343)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit fb4e4c5
from mainline v6.7-rc1
category: bugfix

[ Upstream commit fb4e4c5 ]

The thread_global_copy subtest of the live migrate selftest creates a
large number of threads and waits 10ms for them all to start.  This is
not enough time to wait for the threaded tasks to start, as some may
need to wait for additional ring space to be granted.  Threads that do
so are at risk of getting stopped (signaled) in the middle of waiting
for additional space, which can result in ERESTARTSYS getting reported
erroneously by i915_request_wait.

Instead of waiting a flat 10ms for the threads to start, wait 10ms per
thread.  This grants enough of a buffer for each thread to wait for
additional ring space when needed.

Signed-off-by: Jonathan Cavitt <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit fb4e4c5)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 4632e32
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 4632e32 ]

Disables Atomic-chaining of Typed Writes.

BSpec: 54040
Signed-off-by: Shekhar Chauhan <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Signed-off-by: Matt Roper <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 4632e32)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit c795d2f
from mainline v6.7-rc1
category: bugfix

[ Upstream commit c795d2f ]

Walk all GTs when doing the respective bits of drop_caches work.

Signed-off-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Reviewed-by: Nirmoy Das <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit c795d2f)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 3b2562d
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 3b2562d ]

Some DG2 firmware locks this register for modification. Using wa_add
with read_mask 0 allows to skip checks of such registers.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8945
Signed-off-by: Andrzej Hajda <[email protected]>
Reviewed-by: Nirmoy Das <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 3b2562d)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 98fa06e
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 98fa06e ]

Invalidate instruction and State cache bit using INDIRECT_CTX on
every gpu context switch for gen12.
The goal of this workaround is to actually perform an explicit
invalidation of that cache (by re-writing the register) during every GPU
context switch, which is accomplished via a "workaround batchbuffer"
that's attached to the context via INDIRECT_CTX. (Matt Roper)

Please refer [1] for more reviews and comment on the same patch

[1] https://patchwork.freedesktop.org/series/123377/

v2:
- Remove extra parentheses from the condition (Lucas)
- Align spacing and new line (Lucas)

v3:
- Fix commit message.

v4:
- Only Gen12 changes are kept and Remove DG2+ condition (Matt Roper)
- Fix the commit message for r-b (Matt Roper)
- Rename the register bit in define

v5:
- Move out this workaround from golden context init (Matt Roper)
- Use INDIRECT_CTX to set bit on each GPU context switch (Matt Roper)

v6:
- Change IP Version base condition for Gen12 (Matt Roper)
- Made imperative form of commit version messages (Suraj)
- s/Added/Add in patch header (Suraj)

v7:
- In version descriptions s/Ropper/Roper (Matt Atwood)

BSpec: 11354
Cc: Lucas De Marchi <[email protected]>
Cc: Matt Roper <[email protected]>
Cc: Suraj Kandpal <[email protected]>
Cc: Matt Atwood <[email protected]>
Signed-off-by: Dnyaneshwar Bhadane <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Signed-off-by: Matt Roper <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 98fa06e)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 4d938bb
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 4d938bb ]

If we can't load the HuC due to an injected failure, we don't want
to throw and error and trip CI. Using the gt_probe_error macro for
logging ensure that the error is only printed if it wasn't explicitly
injected.

v2: keep the line to less than 100 characters (checkpatch).

Link: https://gitlab.freedesktop.org/drm/intel/-/issues/7061
Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
Reviewed-by: Andi Shyti <[email protected]> #v1
Reviewed-by: John Harrison <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 4d938bb)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 5642639
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 5642639 ]

`strncpy` is deprecated for use on NUL-terminated destination strings [1].

We should prefer more robust and less ambiguous string interfaces.

A suitable replacement is `strscpy` [2] due to the fact that it
guarantees NUL-termination on the destination buffer without
unnecessarily NUL-padding. `ctx` is zero allocated and as such strncpy's
NUL-padding behavior was strictly a performance hit which is now
resolved.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
Link: KSPP/linux#90
Cc: [email protected]
Signed-off-by: Justin Stitt <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Signed-off-by: Rodrigo Vivi <[email protected]>
(cherry picked from commit 5642639)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 2fc37c0
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 2fc37c0 ]

Just let the compiler decide what's best. Turns out absolutely nothing
changes in the output with the inlines removed.

Signed-off-by: Jani Nikula <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 2fc37c0)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit ae0e5e6
from mainline v6.7-rc1
category: bugfix

[ Upstream commit ae0e5e6 ]

Drop UGM per set fragment threshold to 3

BSpec: 54833
Signed-off-by: Shekhar Chauhan <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
[mattrope: moved above xehpsdv block for consistency]
Signed-off-by: Matt Roper <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit ae0e5e6)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit a383a02
from mainline v6.7-rc1
category: bugfix

[ Upstream commit a383a02 ]

There is no reason to add gtt_offset to the cached head/tail pointers
stream->oa_buffer.head and stream->oa_buffer.tail. This causes the code to
constantly add gtt_offset and subtract gtt_offset and is error
prone.

It is much simpler to maintain stream->oa_buffer.head and
stream->oa_buffer.tail without adding gtt_offset to them and just allow for
the gtt_offset when reading/writing from/to HW registers.

v2: Minor tweak to commit message due to dropping patch in previous series

Signed-off-by: Ashutosh Dixit <[email protected]>
Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit a383a02)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 1e975e5
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 1e975e5 ]

Commit ade8a0f ("drm/i915: Make all GPU resets atomic") added a
preempt disable section over the hardware reset callback to prepare the
driver for being able to reset from atomic contexts.

In retrospect I can see that the work item at a time was about removing
the struct mutex from the reset path. Code base also briefly entertained
the idea of doing the reset under stop_machine in order to serialize
userspace mmap and temporary glitch in the fence registers (see
eb8d0f5 ("drm/i915: Remove GPU reset dependence on struct_mutex"),
but that never materialized and was soon removed in 2caffbf
("drm/i915: Revoke mmaps and prevent access to fence registers across
reset") and replaced with a SRCU based solution.

As such, as far as I can see, today we still have a requirement that
resets must not sleep (invoked from submission tasklets), but no need to
support invoking them from a truly atomic context.

Given that the preemption section is problematic on RT kernels, since the
uncore lock becomes a sleeping lock and so is invalid in such section,
lets try and remove it. Potential downside is that our short waits on GPU
to complete the reset may get extended if CPU scheduling interferes, but
in practice that probably isn't a deal breaker.

In terms of mechanics, since the preemption disabled block is being
removed we just need to replace a few of the wait_for_atomic macros into
busy looping versions which will work (and not complain) when called from
non-atomic sections.

v2:
 * Fix timeouts which are now in us. (Andi)
 * Update one comment as a drive by. (Andi)

Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Chris Wilson <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Cc: Sebastian Andrzej Siewior <[email protected]>
Cc: Andi Shyti <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 1e975e5)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 35ba33f
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 35ba33f ]

Move early resume functions of gt to a proper file.

Signed-off-by: Nirmoy Das <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Reviewed-by: Andrzej Hajda <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 35ba33f)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 37280ef
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 37280ef ]

During resume, the steer semaphore on GT1 was observed to be held. The
hardware team has confirmed the safety of clearing steer semaphores
for all GTs during driver load/resume, as no lock acquisitions can occur
in this process by other agents.

v2: reset on resume not in intel_gt_init().
v3: do the reset on intel_gt_resume_early()
v4: do general sanitization for all GTs(Matt)

Signed-off-by: Nirmoy Das <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 37280ef)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 0951dce
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 0951dce ]

Where applicable, use for_each_gt instead of to_gt in the
i915_gem_shrinker functions to make them apply to more than just the
primary GT.  Specifically, this ensure i915_gem_shrink_all retires all
requests across all GTs, and this makes i915_gem_shrinker_vmap unmap
VMAs from all GTs.

v2: Pass correct GT to intel_gt_retire_requests(Andrzej).
v3: Remove unnecessary braces(Andi)
v4: Undo v3 to fix build failure.

Signed-off-by: Jonathan Cavitt <[email protected]>
Signed-off-by: Nirmoy Das <[email protected]>
Reviewed-by: Andrzej Hajda <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 0951dce)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 9c30343
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 9c30343 ]

Chaining user engines happens in multiple passes during driver
initialization, mutating its type along the way. It starts off with a
simple lock-less linked list (struct llist_node/head) populated by
intel_engine_add_user() which later gets sorted and converted to an
intermediate regular list (struct list_head) just to be converted once
more to its final rb-tree structure (struct rb_node/root) in
intel_engines_driver_register().

All of these types overlay the uabi_node/uabi_engines members which is
unfortunate but safe if one takes care about using the rb-tree based
structure only after the conversion has completed. However, mistakes
happen and commit 1ec23ed ("drm/i915: Use uabi engines for the
default engine map") violated that assumption, as the multiple type
evolution was all to easy hidden behind casts papering over it.

Make the type evolution of uabi_node/uabi_engines more visible by
putting all members into an anonymous union and use the correctly typed
member in its various users. This allows us to drop quite some ugly
casts and, hopefully, make the evolution of the members better
recognisable to avoid future mistakes.

Signed-off-by: Mathias Krause <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 9c30343)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 6a3ecfd
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 6a3ecfd ]

If an active context has been banned (e.g. Ctrl+C killed) then it is
likely to be reset as part of evicting it from the hardware. That
results in a 'ignoring context reset notification: banned = 1'
message at info level. This confuses/concerns people and makes them
think something has gone wrong when it hasn't.

There is already a debug level message with essentially the same
information. So drop the 'ignore' info level one and just add the
'ignore' flag to the debug level one instead (which will therefore not
appear by default but will still show up in CI runs).

Signed-off-by: John Harrison <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 6a3ecfd)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 3e78f77
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 3e78f77 ]

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for
array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct ct_incoming_msg.

Cc: Jani Nikula <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: Rodrigo Vivi <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: "Gustavo A. R. Silva" <[email protected]>
Cc: John Harrison <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Michal Wajdeczko <[email protected]>
Cc: Matt Roper <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1]
Signed-off-by: Kees Cook <[email protected]>
Reviewed-by: Gustavo A. R. Silva <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 3e78f77)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit e96aef0
from mainline v6.7-rc1
category: bugfix

[ Upstream commit e96aef0 ]

A bunch of print messages got missed in the update to using sub-system
specific helpers. So update those.

Signed-off-by: John Harrison <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit e96aef0)
Signed-off-by: Wentao Guan <[email protected]>
johnharr-intel and others added 9 commits June 9, 2025 15:40
mainline inclusion
commit 039adf3
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 039adf3 ]

Update a bunch of GT related print messages in non-GT files to use the
GT specific helpers.

Signed-off-by: John Harrison <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 039adf3)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit d3110f0
from mainline v6.7-rc1
category: bugfix

[ Upstream commit d3110f0 ]

Just use a simple {} to zero initialize arrays/structs instead
of the hodgepodge of stuff we are using currently.

Signed-off-by: Ville Syrjälä <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Jani Nikula <[email protected]>
(cherry picked from commit d3110f0)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 6aa8d50
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 6aa8d50 ]

Just use a simple {} to zero initialize arrays/structs instead
of the hodgepodge of stuff we are using currently.

Signed-off-by: Ville Syrjälä <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Jani Nikula <[email protected]>
(cherry picked from commit 6aa8d50)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit ff0dac0
from mainline v6.7-rc1
category: bugfix

[ Upstream commit ff0dac0 ]

As of now, there is no mechanism for tracking a given request's
progress through the queue.  Instead, add a helper that returns
an estimated maximum time the queue should take to drain if
completely full.

Suggested-by: John Harrison <[email protected]>
Signed-off-by: Jonathan Cavitt <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Acked-by: Tvrtko Ursulin <[email protected]>
Reviewed-by: Nirmoy Das <[email protected]>
Reviewed-by: John Harrison <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit ff0dac0)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit af58ee2
from mainline v6.7-rc1
category: bugfix

[ Upstream commit af58ee2 ]

The GuC firmware had defined the interface for Translation Look-Aside
Buffer (TLB) invalidation.  We should use this interface when
invalidating the engine and GuC TLBs.
Add additional functionality to intel_gt_invalidate_tlb, invalidating
the GuC TLBs and falling back to GT invalidation when the GuC is
disabled.
The invalidation is done by sending a request directly to the GuC
tlb_lookup that invalidates the table.  The invalidation is submitted as
a wait request and is performed in the CT event handler.  This means we
cannot perform this TLB invalidation path if the CT is not enabled.
If the request isn't fulfilled in two seconds, this would constitute
an error in the invalidation as that would constitute either a lost
request or a severe GuC overload.

With this new invalidation routine, we can perform GuC-based GGTT
invalidations.  GuC-based GGTT invalidation is incompatible with
MMIO invalidation so we should not perform MMIO invalidation when
GuC-based GGTT invalidation is expected.

The additional complexity incurred in this patch will be necessary for
range-based tlb invalidations, which will be platformed in the future.

Signed-off-by: Prathap Kumar Valsan <[email protected]>
Signed-off-by: Bruce Chang <[email protected]>
Signed-off-by: Chris Wilson <[email protected]>
Signed-off-by: Umesh Nerlige Ramappa <[email protected]>
Signed-off-by: Jonathan Cavitt <[email protected]>
Signed-off-by: Aravind Iddamsetty <[email protected]>
Signed-off-by: Fei Yang <[email protected]>
CC: Andi Shyti <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Acked-by: Tvrtko Ursulin <[email protected]>
Acked-by: Nirmoy Das <[email protected]>
Reviewed-by: John Harrison <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit af58ee2)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 2202eca
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 2202eca ]

In case of GT is suspended, don't allow submission of new TLB invalidation
request and cancel all pending requests. The TLB entries will be
invalidated either during GuC reload or on system resume.

Signed-off-by: Fei Yang <[email protected]>
Signed-off-by: Jonathan Cavitt <[email protected]>
CC: John Harrison <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Acked-by: Tvrtko Ursulin <[email protected]>
Acked-by: Nirmoy Das <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 2202eca)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit 55ac6ea
from mainline v6.7-rc1
category: bugfix

[ Upstream commit 55ac6ea ]

It is not an error for GuC TLB invalidations to fail when the GT is
wedged or disabled, so do not process a wait failure as one in
guc_send_invalidate_tlb.

Signed-off-by: Fei Yang <[email protected]>
Signed-off-by: Jonathan Cavitt <[email protected]>
CC: John Harrison <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Acked-by: Tvrtko Ursulin <[email protected]>
Acked-by: Nirmoy Das <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 55ac6ea)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit dbe65a3
from mainline v6.7-rc1
category: bugfix

[ Upstream commit dbe65a3 ]

For the gt_tlb live selftest, when operating on the GSC engine,
increase the timeout from 10 ms to 200 ms because the GSC
engine is a bit slower than the rest.

Signed-off-by: Jonathan Cavitt <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Acked-by: Tvrtko Ursulin <[email protected]>
Reviewed-by: Nirmoy Das <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit dbe65a3)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
commit f1cdb59
from mainline v6.7-rc1
category: bugfix

[ Upstream commit f1cdb59 ]

If measure_breadcrumb_dw() returns an error and bce isn't created,
this commit ensures that intel_engine_destroy_pinned_context()
is not called with a NULL bce.

v2: Fix the subject s/UAF/null-ptr-deref(Jani)

Fixes: b352749 ("drm/i915: Create a kernel context for GGTT updates")
Cc: Oak Zeng <[email protected]>
Cc: Andi Shyti <[email protected]>
Cc: Jani Nikula <[email protected]>
Signed-off-by: Nirmoy Das <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit f1cdb59)
Signed-off-by: Wentao Guan <[email protected]>
@opsiff opsiff force-pushed the linux-6.6.y-2025-06-05-i915 branch from 7dfca78 to e66a873 Compare June 9, 2025 07:41
@opsiff opsiff changed the title [wip] sync intel i915 to v6.7 [Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Intel] sync intel i915 drm driver to upstream v6.7 Jun 9, 2025
@Avenger-285714 Avenger-285714 requested a review from Copilot June 10, 2025 02:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR syncs the Intel i915 driver to kernel v6.7 and incorporates several enhancements including GuC-assisted TLB invalidation support, updated firmware ABI actions, refined logging, and adjusted reset timings.

  • Introduces new GuC TLB invalidation actions and associated macros.
  • Updates logging calls to use gt_dbg/gt_err and adjusts GPU reset timing values.
  • Refactors engine user list handling and updates selftest timing and string handling.

Reviewed Changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc.c Replaces drm_* logging calls with gt_* equivalents for consistency.
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h Adds new GuC action codes and macros for TLB invalidation with a comment typo.
drivers/gpu/drm/i915/gt/selftest_tlb.c Adjusts sleep delay for OTHER_CLASS engines with an added FIXME comment.
drivers/gpu/drm/i915/gt/selftest_migrate.c Updates msleep argument to account for the number of CPUs.
drivers/gpu/drm/i915/gt/intel_workarounds.c Replaces some logging calls and refines workaround implementations.
drivers/gpu/drm/i915/gt/intel_tlb.c Adds GuC TLB invalidation path to the full TLB invalidation function.
drivers/gpu/drm/i915/gt/intel_reset.c Increases reset assertion delays and uses _wait_for_atomic instead of wait_for_atomic.
drivers/gpu/drm/i915/gt/intel_engine_user.c, intel_engine_types.h Updates list handling for engine registration via union of list types.
drivers/gpu/drm/i915/gt/intel_engine_cs.c Minor logging updates and safety checks in context initialization.
drivers/gpu/drm/i915/gem/selftests/mock_context.c Uses strscpy in place of strncpy for safe string copy.
drivers/gpu/drm/i915/gem/i915_gem_shrinker.c, i915_gem_execbuffer.c Removes inline qualifiers from several helper routines for clarity.
Comments suppressed due to low confidence (2)

drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h:210

  • There is a typo in the comment: 'GOd' should be corrected to 'gone'.
 * in-flight transactions are GOd.

drivers/gpu/drm/i915/gt/intel_reset.c:168

  • Verify that the increased timeout value (50000 microseconds) and use of _wait_for_atomic align with hardware requirements and expected reset behavior.
err = _wait_for_atomic(i915_in_reset(pdev), 50000, 0);

@Avenger-285714
Copy link
Collaborator

/lgtm

@Avenger-285714
Copy link
Collaborator

/approve

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Avenger-285714

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Avenger-285714 Avenger-285714 merged commit fd8a57d into deepin-community:linux-6.6.y Jun 10, 2025
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.