<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Thanks. Pushed.</p>
<p><br>
</p>
<p>Yong<br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Christian König <ckoenig.leichtzumerken@gmail.com><br>
<b>Sent:</b> Friday, October 6, 2017 1:16:36 PM<br>
<b>To:</b> Zhao, Yong; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: Set the correct value for PDEs/PTEs of ATC memory on Raven</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Am 06.10.2017 um 17:35 schrieb Yong Zhao:<br>
> From: Yong Zhao <Yong.Zhao@amd.com><br>
><br>
> Without the additional bits set in PDEs/PTEs, the ATC memory access<br>
> would have failed on Raven.<br>
><br>
> Change-Id: I28429ef6d39cdb01dc6f17fea4264ee22d7121d4<br>
> Signed-off-by: Yong Zhao <yong.zhao@amd.com><br>
> Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
<br>
Nice solution for the define. Patch is Reviewed-by: Christian König <br>
<christian.koenig@amd.com>.<br>
<br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++++---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 10 ++++++++++<br>
> 2 files changed, 16 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
> index bca9eeb..d98d58a 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
> @@ -328,9 +328,10 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,<br>
> AMDGPU_GEM_CREATE_SHADOW);<br>
> <br>
> if (vm->pte_support_ats) {<br>
> - init_value = AMDGPU_PTE_SYSTEM;<br>
> + init_value = AMDGPU_PTE_DEFAULT_ATC;<br>
> if (level != adev->vm_manager.num_level - 1)<br>
> init_value |= AMDGPU_PDE_PTE;<br>
> +<br>
> }<br>
> <br>
> /* walk over the address space and allocate the page tables */<br>
> @@ -2017,7 +2018,7 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,<br>
> list_del(&mapping->list);<br>
> <br>
> if (vm->pte_support_ats)<br>
> - init_pte_value = AMDGPU_PTE_SYSTEM;<br>
> + init_pte_value = AMDGPU_PTE_DEFAULT_ATC;<br>
> <br>
> r = amdgpu_vm_bo_update_mapping(adev, NULL, NULL, vm,<br>
> mapping->start, mapping->last,<br>
> @@ -2629,7 +2630,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,<br>
> <br>
> if (adev->asic_type == CHIP_RAVEN) {<br>
> vm->pte_support_ats = true;<br>
> - init_pde_value = AMDGPU_PTE_SYSTEM | AMDGPU_PDE_PTE;<br>
> + init_pde_value = AMDGPU_PTE_DEFAULT_ATC<br>
> + | AMDGPU_PDE_PTE;<br>
> +<br>
> }<br>
> } else<br>
> vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> index 66efbc2..5d0cfc9 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> @@ -73,6 +73,16 @@ struct amdgpu_bo_list_entry;<br>
> #define AMDGPU_PTE_MTYPE(a) ((uint64_t)a << 57)<br>
> #define AMDGPU_PTE_MTYPE_MASK AMDGPU_PTE_MTYPE(3ULL)<br>
> <br>
> +/* For Raven */<br>
> +#define AMDGPU_MTYPE_CC 2<br>
> +<br>
> +#define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \<br>
> + | AMDGPU_PTE_SNOOPED \<br>
> + | AMDGPU_PTE_EXECUTABLE \<br>
> + | AMDGPU_PTE_READABLE \<br>
> + | AMDGPU_PTE_WRITEABLE \<br>
> + | AMDGPU_PTE_MTYPE(AMDGPU_MTYPE_CC))<br>
> +<br>
> /* How to programm VM fault handling */<br>
> #define AMDGPU_VM_FAULT_STOP_NEVER 0<br>
> #define AMDGPU_VM_FAULT_STOP_FIRST 1<br>
<br>
<br>
</div>
</span></font>
</body>
</html>