<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 2023-08-22 05:43, Christian König
wrote:<br>
</div>
<blockquote type="cite" cite="mid:690278ed-1f89-2380-c105-1c85f8da5ab9@amd.com">
<br>
<br>
Am 21.08.23 um 22:02 schrieb Philip Yang:
<br>
<blockquote type="cite">Without unsigned long typecast, the size
is passed in as zero if page
<br>
array size >= 4GB, nr_pages >= 0x100000, then sg list
converted will
<br>
have the first and the last chunk lost.
<br>
</blockquote>
<br>
Good catch, but I'm not sure if this is enough to make it work.
<br>
<br>
Additional to that I don't think we have an use case for BOs >
4GiB.
<br>
</blockquote>
<p>>4GB buffer is normal for compute applications, the issue is
reported by "Maelstrom generated exerciser detects micompares when
GPU accesses larger remote GPU memory." on GFX 9.4.3 APU, which
uses GTT domain to allocate VRAM, and trigger the bug in this drm
prime helper. With this fix, the test passed.<br>
</p>
<p>Regards,</p>
<p>Philip<br>
</p>
<blockquote type="cite" cite="mid:690278ed-1f89-2380-c105-1c85f8da5ab9@amd.com">
<br>
Christian.
<br>
<br>
<blockquote type="cite">
<br>
Signed-off-by: Philip Yang <a class="moz-txt-link-rfc2396E" href="mailto:Philip.Yang@amd.com"><Philip.Yang@amd.com></a>
<br>
---
<br>
drivers/gpu/drm/drm_prime.c | 2 +-
<br>
1 file changed, 1 insertion(+), 1 deletion(-)
<br>
<br>
diff --git a/drivers/gpu/drm/drm_prime.c
b/drivers/gpu/drm/drm_prime.c
<br>
index f924b8b4ab6b..2630ad2e504d 100644
<br>
--- a/drivers/gpu/drm/drm_prime.c
<br>
+++ b/drivers/gpu/drm/drm_prime.c
<br>
@@ -830,7 +830,7 @@ struct sg_table
*drm_prime_pages_to_sg(struct drm_device *dev,
<br>
if (max_segment == 0)
<br>
max_segment = UINT_MAX;
<br>
err = sg_alloc_table_from_pages_segment(sg, pages,
nr_pages, 0,
<br>
- nr_pages << PAGE_SHIFT,
<br>
+ (unsigned long)nr_pages <<
PAGE_SHIFT,
<br>
max_segment, GFP_KERNEL);
<br>
if (err) {
<br>
kfree(sg);
<br>
</blockquote>
<br>
</blockquote>
</body>
</html>