Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/migrate: fix pte_update_cmd_size() for non-4K PAGE_SIZE
@ 2026-11-30 10:45 Matthew Auld
  2026-11-30 11:27 ` ✓ CI.KUnit: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Matthew Auld @ 2026-11-30 10:45 UTC (permalink / raw)
  To: intel-xe
  Cc: sashiko-bot, Thomas Hellström, Matthew Brost, Jan Maslak,
	Matthew Auld

Fix the bb sizing in pte_update_cmd_size() to match what we emit in
build_pt_update_batch_sram() on non-4K PAGE_SIZE hosts. For example,
with 64K PAGE_SIZE we round down the number of GPU PTEs per SDI to
be naturally aligned to 16, but that means we don't get the full
MAX_PTE_PER_SDI (510) per packet, so we might need more SDI packets than
we sized for in the bb.

Reported-by: sashiko-bot@kernel.org
Closes: https://sashiko.dev/#/message/sashiko-outbox-237412%40kernel.org
Fixes: 55991d854f65 ("drm/xe: Fix build_pt_update_batch_sram for non-4K PAGE_SIZE")
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Jan Maslak <jan.maslak@intel.com>
Cc: stable@vger.kernel.org # v6.19+
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/xe/xe_migrate.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index 68a8107c2cb4..178750f49464 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -2185,21 +2185,23 @@ void xe_migrate_wait(struct xe_migrate *m)
 
 static u32 pte_update_cmd_size(u64 size)
 {
-	u32 num_dword;
+	u32 max_pte_per_sdi = ALIGN_DOWN(MAX_PTE_PER_SDI,
+					 PAGE_SIZE / XE_PAGE_SIZE);
 	u64 entries = DIV_U64_ROUND_UP(size, XE_PAGE_SIZE);
+	u32 num_dword;
 
 	XE_WARN_ON(size > MAX_PREEMPTDISABLE_TRANSFER);
 
 	/*
 	 * MI_STORE_DATA_IMM command is used to update page table. Each
-	 * instruction can update maximumly MAX_PTE_PER_SDI pte entries. To
-	 * update n (n <= MAX_PTE_PER_SDI) pte entries, we need:
+	 * instruction can update at most max_pte_per_sdi pte entries. To
+	 * update n (n <= max_pte_per_sdi) pte entries, we need:
 	 *
 	 * - 1 dword for the MI_STORE_DATA_IMM command header (opcode etc)
 	 * - 2 dword for the page table's physical location
 	 * - 2*n dword for value of pte to fill (each pte entry is 2 dwords)
 	 */
-	num_dword = (1 + 2) * DIV_U64_ROUND_UP(entries, MAX_PTE_PER_SDI);
+	num_dword = (1 + 2) * DIV_U64_ROUND_UP(entries, max_pte_per_sdi);
 	num_dword += entries * 2;
 
 	return num_dword;

---
base-commit: 0b5346358f32a8db281b9cb68e953dda79c9c1b0
change-id: 20261127-migrate-sram-pt-size-81c96ec96306


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-30 17:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 10:45 [PATCH] drm/xe/migrate: fix pte_update_cmd_size() for non-4K PAGE_SIZE Matthew Auld
2026-11-30 11:27 ` ✓ CI.KUnit: success for " Patchwork
2026-11-30 12:03 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-30 16:36 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-30 17:05 ` [PATCH] " Matthew Brost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox