amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Li Zetao <lizetao1@huawei.com>,
	alexander.deucher@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com,
	daniel@ffwll.ch, kherbst@redhat.com, lyude@redhat.com,
	dakr@redhat.com, felix.kuehling@amd.com, zhenguo.yin@amd.com,
	srinivasan.shanmugam@amd.com, shashank.sharma@amd.com,
	Jesse.Zhang@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	nouveau@lists.freedesktop.org
Subject: Re: [PATCH -next 2/3] drm/amdgpu: use clamp() in amdgpu_vm_adjust_size()
Date: Fri, 30 Aug 2024 16:19:09 +0200	[thread overview]
Message-ID: <64f6b72e-dd00-47e1-bd06-0cd3ef972f8b@amd.com> (raw)
In-Reply-To: <20240830012216.603623-3-lizetao1@huawei.com>

Am 30.08.24 um 03:22 schrieb Li Zetao:
> When it needs to get a value within a certain interval, using clamp()
> makes the code easier to understand than min(max()).
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>

This patch and #1 is a nice cleanup and Reviewed-by: Christian König 
<christian.koenig@amd.com>

But as Alex also pointed out patch #3 is for Nouveau and not amdgpu.

Regards,
Christian.


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index e20d19ae01b2..40f9a5d4f3c0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2224,7 +2224,7 @@ void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t min_vm_size,
>   		phys_ram_gb = ((uint64_t)si.totalram * si.mem_unit +
>   			       (1 << 30) - 1) >> 30;
>   		vm_size = roundup_pow_of_two(
> -			min(max(phys_ram_gb * 3, min_vm_size), max_size));
> +			clamp(phys_ram_gb * 3, min_vm_size, max_size));
>   	}
>   
>   	adev->vm_manager.max_pfn = (uint64_t)vm_size << 18;


  reply	other threads:[~2024-08-30 14:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-30  1:22 [PATCH -next 0/3] drm: use clamp() instead of min(max()) Li Zetao
2024-08-30  1:22 ` [PATCH -next 1/3] drm/amd: use clamp() in amdgpu_pll_get_fb_ref_div() Li Zetao
2024-08-30  1:22 ` [PATCH -next 2/3] drm/amdgpu: use clamp() in amdgpu_vm_adjust_size() Li Zetao
2024-08-30 14:19   ` Christian König [this message]
2024-09-02 17:49     ` Alex Deucher
2024-08-30  1:22 ` [PATCH -next 3/3] drm/amdgpu: use clamp() in nvkm_volt_map() Li Zetao
2024-08-30 13:45   ` Alex Deucher
2024-08-30 20:24   ` Lyude Paul

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=64f6b72e-dd00-47e1-bd06-0cd3ef972f8b@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dakr@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=kherbst@redhat.com \
    --cc=lizetao1@huawei.com \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=shashank.sharma@amd.com \
    --cc=srinivasan.shanmugam@amd.com \
    --cc=zhenguo.yin@amd.com \
    /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;
as well as URLs for NNTP newsgroup(s).