<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/drivers/gpu/drm/xe/xe_migrate.c, branch master</title>
<subtitle>Linux kernel source tree.</subtitle>
<id>https://git.ilvokhin.com/linux.git/atom/drivers/gpu/drm/xe/xe_migrate.c?h=master</id>
<link rel='self' href='https://git.ilvokhin.com/linux.git/atom/drivers/gpu/drm/xe/xe_migrate.c?h=master'/>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/'/>
<updated>2026-07-22T06:59:26Z</updated>
<entry>
<title>drm/xe/vf: Add drm_dev guards when detaching CCS read/write buffers</title>
<updated>2026-07-22T06:59:26Z</updated>
<author>
<name>Satyanarayana K V P</name>
<email>satyanarayana.k.v.p@intel.com</email>
</author>
<published>2026-07-21T05:22:14Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=4c92afb4c143526d340545ca581e88e6952ea511'/>
<id>urn:sha1:4c92afb4c143526d340545ca581e88e6952ea511</id>
<content type='text'>
CCS read/write buffers are freed during BO destruction. In some cases,
BOs may be destroyed after the device is unbound but while the DRM
structure remains valid, leading to NULL pointer dereferences when
accessing device resources.

BUG: kernel NULL pointer dereference, address: 0000000000000000
PGD 0 P4D 0
Oops: Oops: 0000 [#1] SMP NOPTI
CPU: 0 UID: 0 PID: 9376 Comm: xe_pat Not tainted 7.2.0-rc2+ #1 PREEMPT(lazy)
RIP: 0010:xe_sriov_vf_ccs_rw_update_bb_addr+0x4d/0xa0 [xe]
RSP: 0018:ffffcf304110b9c8 EFLAGS: 00010246
RAX: ffff8a85c38a0a00 RBX: 00000000810ef000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8a85c39c1888
RBP: ffffcf304110b9e8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8a85c39c1888
R13: 0000000000000000 R14: ffff8a85c39b4f28 R15: ffff8a85c3885000
FS:  0000000000000000(0000) GS:ffff8a878b809000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000010314a002 CR4: 0000000000772ef0
PKRU: 55555554
Call Trace:
 &lt;TASK&gt;
 xe_migrate_ccs_rw_copy_clear+0x98/0x120 [xe]
 xe_sriov_vf_ccs_detach_bo+0x2c/0x60 [xe]
 xe_ttm_bo_delete_mem_notify+0xc8/0xe0 [xe]
 ttm_bo_cleanup_memtype_use+0x26/0x80 [ttm]
 ttm_bo_release+0x29e/0x2d0 [ttm]
 ttm_bo_fini+0x39/0x70 [ttm]
 xe_gem_object_free+0x1f/0x30 [xe]
 drm_gem_object_free+0x1d/0x40
 ttm_bo_vm_close+0x5f/0x90 [ttm]
 remove_vma+0x2c/0x70
 tear_down_vmas+0x63/0xf0
 exit_mmap+0x20d/0x3f0
 __mmput+0x45/0x170
 mmput+0x31/0x40
 do_exit+0x2ba/0xac0
 do_group_exit+0x2d/0xb0
 __x64_sys_exit_group+0x18/0x20
 x64_sys_call+0x14a0/0x2390
 do_syscall_64+0xdd/0x640
 ? count_memcg_events+0xea/0x240
 ? handle_mm_fault+0x1ec/0x2f0

Fixes: 864690cf4dd6 ("drm/xe/vf: Attach and detach CCS copy commands with BO")
Signed-off-by: Satyanarayana K V P &lt;satyanarayana.k.v.p@intel.com&gt;
Cc: Matthew Brost &lt;matthew.brost@intel.com&gt;
Cc: Michal Wajdeczko &lt;michal.wajdeczko@intel.com&gt;
Reviewed-by: Matthew Brost &lt;matthew.brost@intel.com&gt;
Signed-off-by: Matthew Brost &lt;matthew.brost@intel.com&gt;
Link: https://patch.msgid.link/20260721052215.2267228-2-satyanarayana.k.v.p@intel.com
(cherry picked from commit 1ae415a6eefe5004954a1d352b1718faca8844ef)
Signed-off-by: Thomas Hellström &lt;thomas.hellstrom@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>drm/xe/vf: Fix VF CCS attach/detach race with in-flight BO moves</title>
<updated>2026-07-16T14:32:45Z</updated>
<author>
<name>Matthew Brost</name>
<email>matthew.brost@intel.com</email>
</author>
<published>2026-07-14T06:24:40Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=56441f9e08ad68697295b8835266d2bc48ab59b5'/>
<id>urn:sha1:56441f9e08ad68697295b8835266d2bc48ab59b5</id>
<content type='text'>
xe_bo_move() attaches VF CCS read/write batch buffers (BBs) to a BO
after it transitions NULL/SYSTEM -&gt; TT, and detaches them after it
transitions TT -&gt; SYSTEM. Both operations were done synchronously on
the CPU immediately after building the move's copy/clear fence,
without waiting for that fence to signal. This creates two races with
VF migration:

- Attach happens too late relative to the copy job it is meant to
  protect. If the copy job is submitted before the CCS BBs are
  attached, a VF migration event that pauses execution mid-copy can
  observe partially copied CCS metadata without the attach state
  needed to correctly save/restore it.

- Detach happens too early relative to the copy job that moves data
  out of TT. The CCS BBs are torn down right after the copy fence is
  obtained, while the actual blit may still be in flight. A VF
  migration event that pauses execution mid-copy can then race the
  save/restore path against the still-running blit, and the CCS BBs
  it would need to make sense of the paused state have already been
  removed.

Fix both races:

- Move the attach call to before the copy/clear job is submitted, so
  the CCS BBs are already registered by the time the copy runs. On
  attach failure, unwind and bail out of the move. xe_migrate_ccs_rw_copy()
  now takes the destination resource explicitly, since bo-&gt;ttm.resource
  is not updated to the new resource until after the move commits.

- Detach only after explicitly waiting for the copy fence to signal,
  instead of tearing down the CCS BBs immediately after obtaining it.

While here, also fix xe_sriov_vf_ccs_attach_bo() to properly unwind and
propagate errors: the per-context loop previously never broke out on
error, silently discarding earlier failures. Unwind by clearing each
attached context directly via xe_migrate_ccs_rw_copy_clear() instead of
reusing xe_sriov_vf_ccs_detach_bo(), which requires both contexts to be
attached before it will clean up either one.

Fixes: 864690cf4dd6 ("drm/xe/vf: Attach and detach CCS copy commands with BO")
Cc: Michal Wajdeczko &lt;michal.wajdeczko@intel.com&gt;
Cc: Matthew Auld &lt;matthew.auld@intel.com&gt;
Cc: Michał Winiarski &lt;michal.winiarski@intel.com&gt;
Cc: Satyanarayana K V P &lt;satyanarayana.k.v.p@intel.com&gt;
Assisted-by: GitHub_Copilot:claude-sonnet-5
Signed-off-by: Matthew Brost &lt;matthew.brost@intel.com&gt;
Acked-by: Satyanarayana K V P &lt;satyanarayana.k.v.p@intel.com&gt;
Reviewed-by: Matthew Auld &lt;matthew.auld@intel.com&gt;
Link: https://patch.msgid.link/20260714062440.3421225-1-matthew.brost@intel.com
(cherry picked from commit d45ad0aa7a1eb5d7288b5ed948b05695611dc39e)
Signed-off-by: Thomas Hellström &lt;thomas.hellstrom@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>drm/xe: Refactor emit_xy_fast_copy and emit_mem_copy functions</title>
<updated>2026-05-13T06:51:12Z</updated>
<author>
<name>Balasubramani Vivekanandan</name>
<email>balasubramani.vivekanandan@intel.com</email>
</author>
<published>2026-05-11T12:37:50Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=66cbb3c856bc67be893f81961e1b671dc102f19b'/>
<id>urn:sha1:66cbb3c856bc67be893f81961e1b671dc102f19b</id>
<content type='text'>
To perform copy, based on whether the platform supports service copy
engines, either MEM_COPY or XY_FAST_COPY_BLT instruction is used.
Length of both the instructions is same today and so they use a common
define EMIT_COPY_DW.
This is not true for the future platforms. Implement separate functions
which return the length of the instruction to help in preparing for it.

Reviewed-by: Matt Roper &lt;matthew.d.roper@intel.com&gt;
Link: https://patch.msgid.link/20260511123746.616662-8-balasubramani.vivekanandan@intel.com
Signed-off-by: Balasubramani Vivekanandan &lt;balasubramani.vivekanandan@intel.com&gt;
</content>
</entry>
<entry>
<title>drm/xe: Refactor emit_clear_link_copy</title>
<updated>2026-05-13T06:51:12Z</updated>
<author>
<name>Balasubramani Vivekanandan</name>
<email>balasubramani.vivekanandan@intel.com</email>
</author>
<published>2026-05-11T12:37:49Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=65be72013baf9c9bbaa859b659269b31deccc8c9'/>
<id>urn:sha1:65be72013baf9c9bbaa859b659269b31deccc8c9</id>
<content type='text'>
Implement a function to return the length of the MEM_SET instruction.
This is to prepare for future platforms where the length of MEM_SET
instruction is expected to change.

Reviewed-by: Matt Roper &lt;matthew.d.roper@intel.com&gt;
Link: https://patch.msgid.link/20260511123746.616662-7-balasubramani.vivekanandan@intel.com
Signed-off-by: Balasubramani Vivekanandan &lt;balasubramani.vivekanandan@intel.com&gt;
</content>
</entry>
<entry>
<title>drm/xe: Refactor emit_clear_main_copy</title>
<updated>2026-05-13T06:51:12Z</updated>
<author>
<name>Balasubramani Vivekanandan</name>
<email>balasubramani.vivekanandan@intel.com</email>
</author>
<published>2026-05-11T12:37:48Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=388768fe17386fe82ebac1869a2e084380b6d2c7'/>
<id>urn:sha1:388768fe17386fe82ebac1869a2e084380b6d2c7</id>
<content type='text'>
Implement a function which returns the length of XY_FAST_COLOR_BLT
instruction instead of hardcoding it inside the emit_clear_main_copy.
In future platforms, the length of this instruction is expected to
change and this patch helps in preparing for it.

Reviewed-by: Matt Roper &lt;matthew.d.roper@intel.com&gt;
Link: https://patch.msgid.link/20260511123746.616662-6-balasubramani.vivekanandan@intel.com
Signed-off-by: Balasubramani Vivekanandan &lt;balasubramani.vivekanandan@intel.com&gt;
</content>
</entry>
<entry>
<title>drm/xe: Make decision to use Xe2-style blitter instructions a feature flag</title>
<updated>2026-05-08T16:48:10Z</updated>
<author>
<name>Matt Roper</name>
<email>matthew.d.roper@intel.com</email>
</author>
<published>2026-05-07T21:00:15Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=09b399842907565a64e351fb22da790b4c673ffb'/>
<id>urn:sha1:09b399842907565a64e351fb22da790b4c673ffb</id>
<content type='text'>
The blitter engines' MEM_COPY and MEM_SET instructions were added as
part of the same hardware change that introduced service copy engines
(i.e., BCS1-BCS8) which is why the driver checks for service copy engine
presence when deciding whether to use these instructions or the older
XY_* instructions.  However when making this decision the driver should
consider which engines are part of the hardware architecture, not which
engines are present/usable on the current device.  For graphics IP
versions that architecturally include service copy engines (i.e.,
everything Xe2 and later, plus PVC's Xe_HPC) we should use MEM_SET and
MEM_COPY even in if all of the service copy engines wind up getting
fused off.  I.e., we need to decide based on whether the platform's
graphics descriptor contains these engines, rather than whether the
usable engine mask contains them.  This logic got broken when
gt-&gt;info.__engine_mask was removed, although in practice that mistake
has been harmless so far because there haven't been any hardware
SKUs that fuse off all of the service copy engines yet.

Replace the incorrect has_service_copy_support() function with a GT
feature flag that tracks more accurately whether the new blitter
instructions are usable.  In addition to fixing incorrect logic if all
service copies are fused off, the flag also makes it more obvious what
the calling code is trying to do; previously it wasn't terribly obvious
why "has service copy engines" was being used as the condition for using
different instructions on all copy engine types.

The new feature flag is named 'has_xe2_blt_instructions' because we
expect this flag to be set for all Xe2 and later platforms (i.e.,
everything officially supported by the Xe driver).  Technically there's
also one Xe1-era platform (PVC) that supports these engines/instructions
and will set this flag, but this still seems to be the most clear and
understandable name for the flag.

Fixes: 61549a2ee594 ("drm/xe: Drop __engine_mask")
Cc: Balasubramani Vivekanandan &lt;balasubramani.vivekanandan@intel.com&gt;
Reviewed-by: Balasubramani Vivekanandan &lt;balasubramani.vivekanandan@intel.com&gt;
Link: https://patch.msgid.link/20260507-xe2_copy-v1-1-26506381b821@intel.com
Signed-off-by: Matt Roper &lt;matthew.d.roper@intel.com&gt;
</content>
</entry>
<entry>
<title>drm/xe/pat: Introduce xe_cache_pat_idx() macro helper</title>
<updated>2026-04-21T17:20:17Z</updated>
<author>
<name>Xin Wang</name>
<email>x.wang@intel.com</email>
</author>
<published>2026-04-16T04:55:26Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=dc9ccf14dc2ad44e3df4928015923735f0101bfd'/>
<id>urn:sha1:dc9ccf14dc2ad44e3df4928015923735f0101bfd</id>
<content type='text'>
Wrap pat.idx[] reads with xe_cache_pat_idx() so invalid PAT index use
is caught by xe_assert() in debug builds.

Suggested-by: Matthew Auld &lt;matthew.auld@intel.com&gt;
Reviewed-by: Matthew Auld &lt;matthew.auld@intel.com&gt;
Signed-off-by: Xin Wang &lt;x.wang@intel.com&gt;
Link: https://patch.msgid.link/20260416045526.536497-4-x.wang@intel.com
Signed-off-by: Matt Roper &lt;matthew.d.roper@intel.com&gt;
</content>
</entry>
<entry>
<title>drm/xe/vf: Use drm mm instead of drm sa for CCS read/write</title>
<updated>2026-04-14T06:45:37Z</updated>
<author>
<name>Satyanarayana K V P</name>
<email>satyanarayana.k.v.p@intel.com</email>
</author>
<published>2026-04-08T11:01:48Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=6c84b493012aeb05dec29c709377bf0e17ac6815'/>
<id>urn:sha1:6c84b493012aeb05dec29c709377bf0e17ac6815</id>
<content type='text'>
The suballocator algorithm tracks a hole cursor at the last allocation
and tries to allocate after it. This is optimized for fence-ordered
progress, where older allocations are expected to become reusable first.

In fence-enabled mode, that ordering assumption holds. In fence-disabled
mode, allocations may be freed in arbitrary order, so limiting allocation
to the current hole window can miss valid free space and fail allocations
despite sufficient total space.

Use DRM memory manager instead of sub-allocator to get rid of this issue
as CCS read/write operations do not use fences.

Fixes: 864690cf4dd6 ("drm/xe/vf: Attach and detach CCS copy commands with BO")
Signed-off-by: Satyanarayana K V P &lt;satyanarayana.k.v.p@intel.com&gt;
Cc: Matthew Brost &lt;matthew.brost@intel.com&gt;
Cc: Thomas Hellström &lt;thomas.hellstrom@linux.intel.com&gt;
Cc: Maarten Lankhorst &lt;dev@lankhorst.se&gt;
Cc: Michal Wajdeczko &lt;michal.wajdeczko@intel.com&gt;
Reviewed-by: Matthew Brost &lt;matthew.brost@intel.com&gt;
Signed-off-by: Matthew Brost &lt;matthew.brost@intel.com&gt;
Link: https://patch.msgid.link/20260408110145.1639937-6-satyanarayana.k.v.p@intel.com
</content>
</entry>
<entry>
<title>Merge drm/drm-next into drm-xe-next</title>
<updated>2026-03-12T14:23:23Z</updated>
<author>
<name>Matthew Brost</name>
<email>matthew.brost@intel.com</email>
</author>
<published>2026-03-12T14:17:56Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=42d3b66d4cdbacfc9d120d2301b8de89cc29a914'/>
<id>urn:sha1:42d3b66d4cdbacfc9d120d2301b8de89cc29a914</id>
<content type='text'>
Backmerging to bring in 7.00-rc3. Important ahead GPU SVM merging THP
support.

Signed-off-by: Matthew Brost &lt;matthew.brost@intel.com&gt;
</content>
</entry>
<entry>
<title>drm/xe: add xe_migrate_resolve wrapper and is_vram_resolve support</title>
<updated>2026-03-12T09:37:40Z</updated>
<author>
<name>Nitin Gote</name>
<email>nitin.r.gote@intel.com</email>
</author>
<published>2026-03-04T12:38:01Z</published>
<link rel='alternate' type='text/html' href='https://git.ilvokhin.com/linux.git/commit/?id=be97fd06458d66a53aefb6d9429db0df734c81c0'/>
<id>urn:sha1:be97fd06458d66a53aefb6d9429db0df734c81c0</id>
<content type='text'>
Introduce an internal __xe_migrate_copy(..., is_vram_resolve) path and
expose a small wrapper xe_migrate_resolve() that calls it with
is_vram_resolve=true.

For resolve/decompression operations we must ensure the copy code uses
the compression PAT index when appropriate; this change centralizes that
behavior and allows callers to schedule a resolve (decompress) operation
via the migrate API.

v3: Fix kernel-doc warnings

v2: (Matt)
  - Simplify xe_migrate_resolve(), use single BO/resource;
    remove copy_only_ccs argument as it's always false.

Cc: Matthew Brost &lt;matthew.brost@intel.com&gt;
Cc: Matthew Auld &lt;matthew.auld@intel.com&gt;
Reviewed-by: Matthew Brost &lt;matthew.brost@intel.com&gt;
Signed-off-by: Nitin Gote &lt;nitin.r.gote@intel.com&gt;
Signed-off-by: Matthew Auld &lt;matthew.auld@intel.com&gt;
Link: https://patch.msgid.link/20260304123758.3050386-7-nitin.r.gote@intel.com
</content>
</entry>
</feed>
