AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: Yong Zhao <yong.zhao-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/amdgpu: Set the correct value for PDEs/PTEs of ATC memory on Raven
Date: Mon, 9 Oct 2017 14:34:12 +0800	[thread overview]
Message-ID: <59DB1864.1000202@amd.com> (raw)
In-Reply-To: <1507304133-21510-1-git-send-email-yong.zhao-5C7GfCeVMHo@public.gmane.org>

On 10/06/2017 11:35 PM, Yong Zhao wrote:
> From: Yong Zhao <Yong.Zhao@amd.com>
>
> Without the additional bits set in PDEs/PTEs, the ATC memory access
> would have failed on Raven.
>
> Change-Id: I28429ef6d39cdb01dc6f17fea4264ee22d7121d4
> Signed-off-by: Yong Zhao <yong.zhao@amd.com>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |  9 ++++++---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 10 ++++++++++
>   2 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index bca9eeb..d98d58a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -328,9 +328,10 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
>   				AMDGPU_GEM_CREATE_SHADOW);
>
>   	if (vm->pte_support_ats) {
> -		init_value = AMDGPU_PTE_SYSTEM;
> +		init_value = AMDGPU_PTE_DEFAULT_ATC;
>   		if (level != adev->vm_manager.num_level - 1)
>   			init_value |= AMDGPU_PDE_PTE;
> +
>   	}
>
>   	/* walk over the address space and allocate the page tables */
> @@ -2017,7 +2018,7 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
>   		list_del(&mapping->list);
>
>   		if (vm->pte_support_ats)
> -			init_pte_value = AMDGPU_PTE_SYSTEM;
> +			init_pte_value = AMDGPU_PTE_DEFAULT_ATC;
>
>   		r = amdgpu_vm_bo_update_mapping(adev, NULL, NULL, vm,
>   						mapping->start, mapping->last,
> @@ -2629,7 +2630,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>
>   		if (adev->asic_type == CHIP_RAVEN) {
>   			vm->pte_support_ats = true;
> -			init_pde_value = AMDGPU_PTE_SYSTEM | AMDGPU_PDE_PTE;
> +			init_pde_value = AMDGPU_PTE_DEFAULT_ATC
> +					| AMDGPU_PDE_PTE;
> +
>   		}
>   	} else
>   		vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 66efbc2..5d0cfc9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -73,6 +73,16 @@ struct amdgpu_bo_list_entry;
>   #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57)
>   #define AMDGPU_PTE_MTYPE_MASK	AMDGPU_PTE_MTYPE(3ULL)
>
> +/* For Raven */
> +#define AMDGPU_MTYPE_CC 2

We may use MTYPE_CC directly.

Jerry

> +
> +#define AMDGPU_PTE_DEFAULT_ATC  (AMDGPU_PTE_SYSTEM      \
> +                                | AMDGPU_PTE_SNOOPED    \
> +                                | AMDGPU_PTE_EXECUTABLE \
> +                                | AMDGPU_PTE_READABLE   \
> +                                | AMDGPU_PTE_WRITEABLE  \
> +                                | AMDGPU_PTE_MTYPE(AMDGPU_MTYPE_CC))
> +
>   /* How to programm VM fault handling */
>   #define AMDGPU_VM_FAULT_STOP_NEVER	0
>   #define AMDGPU_VM_FAULT_STOP_FIRST	1
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2017-10-09  6:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 15:35 [PATCH] drm/amdgpu: Set the correct value for PDEs/PTEs of ATC memory on Raven Yong Zhao
     [not found] ` <1507304133-21510-1-git-send-email-yong.zhao-5C7GfCeVMHo@public.gmane.org>
2017-10-06 17:16   ` Christian König
     [not found]     ` <ff321dde-dac3-9f51-266a-bca5ada11e5c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06 19:02       ` Zhao, Yong
2017-10-09  6:34   ` Zhang, Jerry (Junwei) [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=59DB1864.1000202@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=yong.zhao-5C7GfCeVMHo@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