mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Yangyu Chen <cyy@cyyself.name>, dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, Huang Rui <ray.huang@amd.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Jiuyang Liu <liu@jiuyang.me>, Yichuan Gao <i@gycis.me>,
	Icenowy Zheng <uwu@icenowy.me>
Subject: Re: [PATCH v2 1/1] drm/ttm: allocate dummy_read_page without DMA32 on fail
Date: Wed, 17 Jan 2024 09:39:42 +0100	[thread overview]
Message-ID: <ea56ce2f-c86a-4a87-ba37-19079713cc2d@amd.com> (raw)
In-Reply-To: <tencent_8637383EE0A2C7CC870036AAF01909B26A0A@qq.com>

Am 16.01.24 um 19:50 schrieb Yangyu Chen:
> 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>

Reviewed and pushed to drm-misc-fixes. That patch should show up in the 
next rc and stable kernels next week or so.

Thanks,
Christian.


> ---
>   drivers/gpu/drm/ttm/ttm_device.c | 12 +++++++++---
>   1 file 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);


      reply	other threads:[~2024-01-17  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 18:49 [PATCH v2 0/1] " Yangyu Chen
2024-01-16 18:50 ` [PATCH v2 1/1] " Yangyu Chen
2024-01-17  8:39   ` Christian König [this message]

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=ea56ce2f-c86a-4a87-ba37-19079713cc2d@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@gmail.com \
    --cc=cyy@cyyself.name \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=i@gycis.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liu@jiuyang.me \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=tzimmermann@suse.de \
    --cc=uwu@icenowy.me \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®