public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/7] drm/amdgpu: put GART away from VRAM v2
Date: Thu, 30 Aug 2018 10:51:15 +0800	[thread overview]
Message-ID: <5B875BA3.8030709@amd.com> (raw)
In-Reply-To: <20180829140809.1812-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>

On 08/29/2018 10:08 PM, Christian König wrote:
> Always try to put the GART away from where VRAM is.
>
> v2: correctly handle the 4GB limitation
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Fix my concern :)

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 265ec6807130..c6bcc4715373 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -116,6 +116,7 @@ void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,
>    */
>   void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
>   {
> +	const uint64_t four_gb = 0x100000000ULL;
>   	u64 size_af, size_bf;
>
>   	mc->gart_size += adev->pm.smu_prv_buffer_size;
> @@ -124,8 +125,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
>   	 * the GART base on a 4GB boundary as well.
>   	 */
>   	size_bf = mc->vram_start;
> -	size_af = adev->gmc.mc_mask + 1 -
> -		ALIGN(mc->vram_end + 1, 0x100000000ULL);
> +	size_af = adev->gmc.mc_mask + 1 - ALIGN(mc->vram_end + 1, four_gb);
>
>   	if (mc->gart_size > max(size_bf, size_af)) {
>   		dev_warn(adev->dev, "limiting GART\n");
> @@ -136,7 +136,9 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
>   	    (size_af < mc->gart_size))
>   		mc->gart_start = 0;
>   	else
> -		mc->gart_start = ALIGN(mc->vram_end + 1, 0x100000000ULL);
> +		mc->gart_start = mc->mc_mask - mc->gart_size + 1;
> +
> +	mc->gart_start &= four_gb - 1;
>   	mc->gart_end = mc->gart_start + mc->gart_size - 1;
>   	dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n",
>   			mc->gart_size >> 20, mc->gart_start, mc->gart_end);
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-08-30  2:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 14:08 [PATCH 1/7] drm/amdgpu: correctly sign extend 48bit addresses v3 Christian König
     [not found] ` <20180829140809.1812-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-29 14:08   ` [PATCH 2/7] drm/amdgpu: put GART away from VRAM v2 Christian König
     [not found]     ` <20180829140809.1812-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-30  2:51       ` Zhang, Jerry (Junwei) [this message]
2018-08-29 14:08   ` [PATCH 3/7] drm/amdgpu: add amdgpu_gmc_agp_location v2 Christian König
     [not found]     ` <20180829140809.1812-3-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-30  3:08       ` Zhang, Jerry (Junwei)
2018-08-29 14:08   ` [PATCH 4/7] drm/amdgpu: use the AGP aperture for system memory access v2 Christian König
     [not found]     ` <20180829140809.1812-4-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-30  3:20       ` Zhang, Jerry (Junwei)
     [not found]         ` <5B87627D.9050601-5C7GfCeVMHo@public.gmane.org>
2018-08-30 12:15           ` Christian König
     [not found]             ` <b7100847-7afc-5665-6752-99173e03934a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-31  1:39               ` Zhang, Jerry (Junwei)
2018-08-29 14:08   ` [PATCH 5/7] drm/amdgpu: manually map the shadow BOs again Christian König
     [not found]     ` <20180829140809.1812-5-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-30  3:29       ` Zhang, Jerry (Junwei)
     [not found]         ` <5B876486.2060401-5C7GfCeVMHo@public.gmane.org>
2018-08-30 12:16           ` Christian König
2018-08-29 14:08   ` [PATCH 6/7] drm/amdgpu: enable AGP aperture for GMC9 Christian König
     [not found]     ` <20180829140809.1812-6-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-30  4:13       ` Zhang, Jerry (Junwei)
2018-08-29 14:08   ` [PATCH 7/7] drm/amdgpu: try to make kernel allocations USWC Christian König

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=5B875BA3.8030709@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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