diff options
author | Yangyu Chen <cyy@cyyself.name> | 2024-01-17 02:50:34 +0800 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2024-01-17 09:25:56 +0100 |
commit | 0a8c1feed387f8460b8b65fc46fb3608afa7512e (patch) | |
tree | 6e193cdec1ec7c0408c5e0e1cd52614d2e253f50 /drivers/gpu/drm/ttm | |
parent | 3fc6c76a8d208d3955c9e64b382d0ff370bc61fc (diff) | |
download | linux-stable-0a8c1feed387f8460b8b65fc46fb3608afa7512e.tar.gz linux-stable-0a8c1feed387f8460b8b65fc46fb3608afa7512e.tar.bz2 linux-stable-0a8c1feed387f8460b8b65fc46fb3608afa7512e.zip |
drm/ttm: allocate dummy_read_page without DMA32 on fail
Some platforms may not have any memory in ZONE_DMA32 and use IOMMU to allow
32-bit-DMA-only device to work. Forcing GFP_DMA32 on dummy_read_page will
fail on such platforms. Retry after fail will get this works on such
platforms.
Signed-off-by: Yangyu Chen <cyy@cyyself.name>
Link: https://patchwork.freedesktop.org/patch/msgid/tencent_8637383EE0A2C7CC870036AAF01909B26A0A@qq.com
Signed-off-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_device.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index d48b39132b32..c9fa8561f71f 100644 --- a/drivers/gpu/drm/ttm/ttm_device.c +++ b/drivers/gpu/drm/ttm/ttm_device.c @@ -95,11 +95,17 @@ static int ttm_global_init(void) ttm_pool_mgr_init(num_pages); ttm_tt_mgr_init(num_pages, num_dma32); - glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32); + glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32 | + __GFP_NOWARN); + /* Retry without GFP_DMA32 for platforms DMA32 is not available */ if (unlikely(glob->dummy_read_page == NULL)) { - ret = -ENOMEM; - goto out; + glob->dummy_read_page = alloc_page(__GFP_ZERO); + if (unlikely(glob->dummy_read_page == NULL)) { + ret = -ENOMEM; + goto out; + } + pr_warn("Using GFP_DMA32 fallback for dummy_read_page\n"); } INIT_LIST_HEAD(&glob->device_list); |