Re: [PATCH] drm/prime: Support page array >= 4GB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2023-08-22 05:43, Christian König wrote:


Am 21.08.23 um 22:02 schrieb Philip Yang:
Without unsigned long typecast, the size is passed in as zero if page
array size >= 4GB, nr_pages >= 0x100000, then sg list converted will
have the first and the last chunk lost.

Good catch, but I'm not sure if this is enough to make it work.

Additional to that I don't think we have an use case for BOs > 4GiB.

>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.

Regards,

Philip


Christian.


Signed-off-by: Philip Yang <Philip.Yang@xxxxxxx>
---
  drivers/gpu/drm/drm_prime.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index f924b8b4ab6b..2630ad2e504d 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -830,7 +830,7 @@ struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev,
      if (max_segment == 0)
          max_segment = UINT_MAX;
      err = sg_alloc_table_from_pages_segment(sg, pages, nr_pages, 0,
-                        nr_pages << PAGE_SHIFT,
+                        (unsigned long)nr_pages << PAGE_SHIFT,
                          max_segment, GFP_KERNEL);
      if (err) {
          kfree(sg);


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux