Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: [PATCH v3 1/7] drm/xe/migrate: fix offset and len check
Date: Wed, 22 Oct 2025 17:38:30 +0100	[thread overview]
Message-ID: <20251022163836.191405-2-matthew.auld@intel.com> (raw)
In-Reply-To: <20251022163836.191405-1-matthew.auld@intel.com>

Restriction here is pitch of 4bytes to match pixel width (32b), and hw
restriction where src and dst must be aligned to 64bytes. If any of that
is not possible then we need a bounce buffer.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_migrate.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index 3112c966c67d..ce2ad876586c 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -1883,7 +1883,7 @@ static struct dma_fence *xe_migrate_vram(struct xe_migrate *m,
 	unsigned long i, j;
 	bool use_pde = xe_migrate_vram_use_pde(sram_addr, len + sram_offset);
 
-	if (drm_WARN_ON(&xe->drm, (len & XE_CACHELINE_MASK) ||
+	if (drm_WARN_ON(&xe->drm, (!IS_ALIGNED(len, pitch)) ||
 			(sram_offset | vram_addr) & XE_CACHELINE_MASK))
 		return ERR_PTR(-EOPNOTSUPP);
 
@@ -2103,8 +2103,9 @@ int xe_migrate_access_memory(struct xe_migrate *m, struct xe_bo *bo,
 	xe_bo_assert_held(bo);
 
 	/* Use bounce buffer for small access and unaligned access */
-	if (!IS_ALIGNED(len, XE_CACHELINE_BYTES) ||
-	    !IS_ALIGNED((unsigned long)buf + offset, XE_CACHELINE_BYTES)) {
+	if (!IS_ALIGNED(len, 4) ||
+	    !IS_ALIGNED(page_offset, XE_CACHELINE_BYTES) ||
+	    !IS_ALIGNED(offset, XE_CACHELINE_BYTES)) {
 		int buf_offset = 0;
 		void *bounce;
 		int err;
-- 
2.51.0


  reply	other threads:[~2025-10-22 16:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 16:38 [PATCH v3 0/7] Some migration fixes/improvements Matthew Auld
2025-10-22 16:38 ` Matthew Auld [this message]
2025-10-22 17:33   ` [PATCH v3 1/7] drm/xe/migrate: fix offset and len check Matthew Brost
2025-10-22 16:38 ` [PATCH v3 2/7] drm/xe/migrate: rework size restrictions for sram pte emit Matthew Auld
2025-10-22 16:38 ` [PATCH v3 3/7] drm/xe/migrate: fix chunk handling for 2M page emit Matthew Auld
2025-10-22 16:38 ` [PATCH v3 4/7] drm/xe/migrate: fix batch buffer sizing Matthew Auld
2025-10-22 16:38 ` [PATCH v3 5/7] drm/xe/migrate: trim " Matthew Auld
2025-10-22 16:38 ` [PATCH v3 6/7] drm/xe/migrate: support MEM_COPY instruction Matthew Auld
2025-10-22 17:53   ` Matthew Brost
2025-10-22 16:38 ` [PATCH v3 7/7] drm/xe/migrate: skip bounce buffer path on xe2 Matthew Auld
2025-10-22 17:59   ` Matthew Brost
2025-10-23  0:16 ` ✓ CI.KUnit: success for Some migration fixes/improvements (rev3) Patchwork
2025-10-23  0:58 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-23  7:31 ` ✗ Xe.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251022163836.191405-2-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox