All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: Alex Deucher
	<alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH 1/4] drm/amdgpu/gmc9: rework stolen vga memory handling
Date: Fri, 31 Aug 2018 10:03:06 +0800	[thread overview]
Message-ID: <5B88A1DA.5070400@amd.com> (raw)
In-Reply-To: <20180830145339.5162-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>

On 08/30/2018 10:53 PM, Alex Deucher wrote:
> No functional change, just rework it in order to adjust the
> behavior on a per asic level.  The problem is that on vega10,
> something corrupts the lower 8 MB of vram on the second
> resume from S3.  This does not seem to affect Raven, other
> gmc9 based asics need testing.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

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

> ---
>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 48 +++++++++++++++++++++--------------
>   1 file changed, 29 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 04d50893a6f2..46cff7d8b375 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -692,6 +692,28 @@ static int gmc_v9_0_ecc_available(struct amdgpu_device *adev)
>   	return lost_sheep == 0;
>   }
>
> +static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
> +{
> +
> +	/*
> +	 * TODO:
> +	 * Currently there is a bug where some memory client outside
> +	 * of the driver writes to first 8M of VRAM on S3 resume,
> +	 * this overrides GART which by default gets placed in first 8M and
> +	 * causes VM_FAULTS once GTT is accessed.
> +	 * Keep the stolen memory reservation until the while this is not solved.
> +	 * Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
> +	 */
> +	switch (adev->asic_type) {
> +	case CHIP_RAVEN:
> +	case CHIP_VEGA10:
> +	case CHIP_VEGA12:
> +	case CHIP_VEGA20:
> +	default:
> +		return true;
> +	}
> +}
> +
>   static int gmc_v9_0_late_init(void *handle)
>   {
>   	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> @@ -708,10 +730,8 @@ static int gmc_v9_0_late_init(void *handle)
>   	unsigned i;
>   	int r;
>
> -	/*
> -	 * TODO - Uncomment once GART corruption issue is fixed.
> -	 */
> -	/* amdgpu_bo_late_init(adev); */
> +	if (!gmc_v9_0_keep_stolen_memory(adev))
> +		amdgpu_bo_late_init(adev);
>
>   	for(i = 0; i < adev->num_rings; ++i) {
>   		struct amdgpu_ring *ring = adev->rings[i];
> @@ -848,18 +868,16 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)
>
>   static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
>   {
> -#if 0
>   	u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL);
> -#endif
>   	unsigned size;
>
>   	/*
>   	 * TODO Remove once GART corruption is resolved
>   	 * Check related code in gmc_v9_0_sw_fini
>   	 * */
> -	size = 9 * 1024 * 1024;
> +	if (gmc_v9_0_keep_stolen_memory(adev))
> +		return 9 * 1024 * 1024;
>
> -#if 0
>   	if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
>   		size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
>   	} else {
> @@ -876,6 +894,7 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
>   			break;
>   		case CHIP_VEGA10:
>   		case CHIP_VEGA12:
> +		case CHIP_VEGA20:
>   		default:
>   			viewport = RREG32_SOC15(DCE, 0, mmSCL0_VIEWPORT_SIZE);
>   			size = (REG_GET_FIELD(viewport, SCL0_VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
> @@ -888,7 +907,6 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
>   	if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
>   		return 0;
>
> -#endif
>   	return size;
>   }
>
> @@ -1000,16 +1018,8 @@ static int gmc_v9_0_sw_fini(void *handle)
>   	amdgpu_gem_force_release(adev);
>   	amdgpu_vm_manager_fini(adev);
>
> -	/*
> -	* TODO:
> -	* Currently there is a bug where some memory client outside
> -	* of the driver writes to first 8M of VRAM on S3 resume,
> -	* this overrides GART which by default gets placed in first 8M and
> -	* causes VM_FAULTS once GTT is accessed.
> -	* Keep the stolen memory reservation until the while this is not solved.
> -	* Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
> -	*/
> -	amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
> +	if (gmc_v9_0_keep_stolen_memory(adev))
> +		amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
>
>   	amdgpu_gart_table_vram_free(adev);
>   	amdgpu_bo_fini(adev);
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-08-31  2:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30 14:53 [PATCH 1/4] drm/amdgpu/gmc9: rework stolen vga memory handling Alex Deucher
     [not found] ` <20180830145339.5162-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2018-08-30 14:53   ` [PATCH 2/4] drm/amdgpu/gmc9: don't keep stolen memory on Raven Alex Deucher
     [not found]     ` <20180830145339.5162-2-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2018-08-31  2:03       ` Zhang, Jerry (Junwei)
2018-08-30 14:53   ` [PATCH 3/4] drm/amdgpu/gmc9: don't keep stolen memory on vega12 Alex Deucher
2018-08-30 14:53   ` [PATCH 4/4] drm/amdgpu/gmc9: don't keep stolen memory on vega20 Alex Deucher
2018-08-31  2:03   ` Zhang, Jerry (Junwei) [this message]
2018-08-31  8:20   ` [PATCH 1/4] drm/amdgpu/gmc9: rework stolen vga memory handling Christian König
     [not found]     ` <9e88efe2-029e-1b98-2362-8ff5cc400ad1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-09-02 14:56       ` Alex Deucher

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=5B88A1DA.5070400@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.