<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2025-01-30 15:51, Alex Deucher
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20250130205110.811511-2-alexander.deucher@amd.com">
      <pre class="moz-quote-pre" wrap="">If the user has configured a large carveout on a small APU,
only use GTT for VRAM allocations if GTT is larger than
VRAM.

Signed-off-by: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 9d2a3e2ad9df5..96ec26946db60 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1985,8 +1985,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
        DRM_INFO("amdgpu: %uM of GTT memory ready.\n",
                 (unsigned int)(gtt_size / (1024 * 1024)));
 
-       if (adev->flags & AMD_IS_APU)
-               adev->apu_prefer_gtt = true;
+       if (adev->flags & AMD_IS_APU) {
+               if (adev->gmc.real_vram_size >= gtt_size)</pre>
    </blockquote>
    <p>This will not work for MI300 large APU, maybe the condition
      should be reversed</p>
    <pre class="moz-quote-pre" wrap="">+              if (adev->gmc.real_vram_size < gtt_size)

Regards,
Philip
</pre>
    <p></p>
    <blockquote type="cite" cite="mid:20250130205110.811511-2-alexander.deucher@amd.com">
      <pre class="moz-quote-pre" wrap="">
+                       adev->apu_prefer_gtt = true;
+       }
 
        /* Initialize doorbell pool on PCI BAR */
        r = amdgpu_ttm_init_on_chip(adev, AMDGPU_PL_DOORBELL, adev->doorbell.size / PAGE_SIZE);
</pre>
    </blockquote>
  </body>
</html>