From: fei.yang@intel.com
To: intel-xe@lists.freedesktop.org
Subject: [PATCH 1/1] drm/xe: correct the calculation of remaining size
Date: Tue, 16 Jan 2024 11:52:51 -0800 [thread overview]
Message-ID: <20240116195251.651321-2-fei.yang@intel.com> (raw)
In-Reply-To: <20240116195251.651321-1-fei.yang@intel.com>
From: Fei Yang <fei.yang@intel.com>
In function write_pgtable, the calculation of chunk in the do-while
loop is wrong, we should always compare against remaining size instead
of the total size update->qwords.
Also, when performing dword writes, dword length can be any value
from 2 to 3fe, always adding 1 is wrong.
Signed-off-by: Fei Yang <fei.yang@intel.com>
---
drivers/gpu/drm/xe/instructions/xe_mi_commands.h | 2 +-
drivers/gpu/drm/xe/xe_migrate.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/instructions/xe_mi_commands.h b/drivers/gpu/drm/xe/instructions/xe_mi_commands.h
index c74ceb550dce..8058eb090e5d 100644
--- a/drivers/gpu/drm/xe/instructions/xe_mi_commands.h
+++ b/drivers/gpu/drm/xe/instructions/xe_mi_commands.h
@@ -36,7 +36,7 @@
#define MI_STORE_DATA_IMM __MI_INSTR(0x20)
#define MI_SDI_GGTT REG_BIT(22)
#define MI_SDI_LEN_DW GENMASK(9, 0)
-#define MI_SDI_NUM_DW(x) REG_FIELD_PREP(MI_SDI_LEN_DW, (x) + 3 - 2)
+#define MI_SDI_NUM_DW(x) REG_FIELD_PREP(MI_SDI_LEN_DW, (x > 1)? x : 2)
#define MI_SDI_NUM_QW(x) (REG_FIELD_PREP(MI_SDI_LEN_DW, 2 * (x) + 3 - 2) | \
REG_BIT(21))
diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index 44725f978f3e..d5392cbbdb49 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -1116,7 +1116,7 @@ static void write_pgtable(struct xe_tile *tile, struct xe_bb *bb, u64 ppgtt_ofs,
do {
u64 addr = ppgtt_ofs + ofs * 8;
- chunk = min(update->qwords, MAX_PTE_PER_SDI);
+ chunk = min(size, MAX_PTE_PER_SDI);
/* Ensure populatefn can do memset64 by aligning bb->cs */
if (!(bb->len & 1))
--
2.25.1
next prev parent reply other threads:[~2024-01-16 19:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 19:52 [PATCH 0/1] drm/xe: correct the calculation of remaining size fei.yang
2024-01-16 19:52 ` fei.yang [this message]
2024-01-16 19:53 ` ✓ CI.Patch_applied: success for " Patchwork
2024-01-16 19:53 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-16 19:54 ` ✓ CI.KUnit: success " Patchwork
2024-01-16 20:01 ` ✓ CI.Build: " Patchwork
2024-01-16 20:01 ` ✓ CI.Hooks: " Patchwork
2024-01-16 20:03 ` ✓ CI.checksparse: " Patchwork
2024-01-17 21:37 ` ✓ CI.Patch_applied: " Patchwork
2024-01-17 21:37 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-17 21:38 ` ✓ CI.KUnit: success " Patchwork
2024-01-17 21:45 ` ✓ CI.Build: " Patchwork
2024-01-17 21:46 ` ✓ CI.Hooks: " Patchwork
2024-01-17 21:47 ` ✓ CI.checksparse: " Patchwork
2024-01-17 22:11 ` ✗ CI.BAT: 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=20240116195251.651321-2-fei.yang@intel.com \
--to=fei.yang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.