From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH v4 1/2] drm/xe: Add support larger CPU pages to build_pt_update_batch_sram
Date: Fri, 29 Aug 2025 11:00:17 -0700 [thread overview]
Message-ID: <20250829180018.1333174-2-matthew.brost@intel.com> (raw)
In-Reply-To: <20250829180018.1333174-1-matthew.brost@intel.com>
If the GPU page size is smaller than the CPU page size,
build_pt_update_batch_sram breaks. Fix by supporting writes of multiple
GPU pages per CPU page.
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
drivers/gpu/drm/xe/xe_migrate.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index 57e6d5a8ac39..72f53e304873 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -1751,6 +1751,8 @@ static void build_pt_update_batch_sram(struct xe_migrate *m,
while (ptes) {
u32 chunk = min(MAX_PTE_PER_SDI, ptes);
+ chunk = ALIGN_DOWN(chunk, PAGE_SIZE / XE_PAGE_SIZE);
+
bb->cs[bb->len++] = MI_STORE_DATA_IMM | MI_SDI_NUM_QW(chunk);
bb->cs[bb->len++] = pt_offset;
bb->cs[bb->len++] = 0;
@@ -1764,12 +1766,21 @@ static void build_pt_update_batch_sram(struct xe_migrate *m,
xe_tile_assert(m->tile, sram_addr[i].proto ==
DRM_INTERCONNECT_SYSTEM);
xe_tile_assert(m->tile, addr);
+
+again:
addr = m->q->vm->pt_ops->pte_encode_addr(m->tile->xe,
addr, pat_index,
0, false, 0);
bb->cs[bb->len++] = lower_32_bits(addr);
bb->cs[bb->len++] = upper_32_bits(addr);
+ if (XE_PAGE_SIZE < PAGE_SIZE) {
+ addr += XE_PAGE_SIZE;
+ if (sram_addr[i].addr + PAGE_SIZE != addr) {
+ chunk--;
+ goto again;
+ }
+ }
i++;
}
}
--
2.34.1
next prev parent reply other threads:[~2025-08-29 18:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 18:00 [PATCH v4 0/2] Different sized pages support in migrate layer Matthew Brost
2025-08-29 18:00 ` Matthew Brost [this message]
2025-08-29 18:00 ` [PATCH v4 2/2] drm/xe: Enable 2M pages in xe_migrate_vram Matthew Brost
2025-08-29 20:26 ` ✗ CI.checkpatch: warning for Different sized pages support in migrate layer Patchwork
2025-08-29 20:28 ` ✓ CI.KUnit: success " Patchwork
2025-08-29 21:37 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-30 11: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=20250829180018.1333174-2-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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