<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The snoop bit is for snooping the CPU cache by the GPU when doing system memory mappings.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Zeng, Oak <Oak.Zeng@amd.com><br>
<b>Sent:</b> Thursday, August 8, 2019 12:02 PM<br>
<b>To:</b> Koenig, Christian <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Kuehling, Felix <Felix.Kuehling@amd.com>; Keely, Sean <Sean.Keely@amd.com><br>
<b>Subject:</b> RE: [PATCH 1/5] drm/amdgpu: Extends amdgpu vm definitions</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi Christian,<br>
<br>
My understanding of the snoop bit (C bit in the PTE definition) is to probe remote gpu's L2 cache after this gpu write remote gpu's vram. Is this correct? I am still checking this point with HW engineer.<br>
<br>
If this is correct, then the snooping (or probing) is a way to maintain certain cache coherency when one memory is access by two masters (for example two gpu). With existing AMDGPU_VM_ definitions in amdgpu_drm.h, how does a user implement the request like:
 I want a trunk of vram physically in a remote gpu, I want to access it in a uncached way (AMDGPU_VM_MTYPE_UC) but I want to probe remote gpu's cache when I modify this vram.<br>
<br>
>From PTE's definition, both C bit and mtype and R/W/X bits are just flags to enable user to program page access behavior. Any detail reason why we shouldn't expose the snoop bit?<br>
<br>
Regards,<br>
Oak<br>
<br>
-----Original Message-----<br>
From: Christian König <ckoenig.leichtzumerken@gmail.com> <br>
Sent: Wednesday, August 7, 2019 4:42 AM<br>
To: Zeng, Oak <Oak.Zeng@amd.com>; amd-gfx@lists.freedesktop.org<br>
Cc: Kuehling, Felix <Felix.Kuehling@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Keely, Sean <Sean.Keely@amd.com><br>
Subject: Re: [PATCH 1/5] drm/amdgpu: Extends amdgpu vm definitions<br>
<br>
Am 07.08.19 um 04:31 schrieb Zeng, Oak:<br>
> Add definition of all supported mtypes. The RW mtype is recently <br>
> introduced for arcturus. Also add definition for the <br>
> cachable/snoopable bit, which will be used later in this series.<br>
><br>
> Change-Id: I96fc9bb4b6b1e62bdc10b600d8aaa6a802128d6d<br>
> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com><br>
> ---<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 9 +++++++--<br>
>   include/uapi/drm/amdgpu_drm.h          | 4 ++++<br>
>   2 files changed, 11 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h <br>
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> index 2eda3a8..7a77477 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> @@ -80,8 +80,13 @@ struct amdgpu_bo_list_entry;<br>
>   #define AMDGPU_PTE_MTYPE_VG10(a)    ((uint64_t)(a) << 57)<br>
>   #define AMDGPU_PTE_MTYPE_VG10_MASK  AMDGPU_PTE_MTYPE_VG10(3ULL)<br>
>   <br>
> -#define AMDGPU_MTYPE_NC 0<br>
> -#define AMDGPU_MTYPE_CC 2<br>
> +enum amdgpu_mtype {<br>
> +     AMDGPU_MTYPE_NC = 0,<br>
> +     AMDGPU_MTYPE_WC = 1,<br>
> +     AMDGPU_MTYPE_CC = 2,<br>
> +     AMDGPU_MTYPE_UC = 3,<br>
> +     AMDGPU_MTYPE_RW = 4,<br>
> +};<br>
>   <br>
>   #define AMDGPU_PTE_DEFAULT_ATC  (AMDGPU_PTE_SYSTEM      \<br>
>                                   | AMDGPU_PTE_SNOOPED    \<br>
> diff --git a/include/uapi/drm/amdgpu_drm.h <br>
> b/include/uapi/drm/amdgpu_drm.h index ca97b68..2889663 100644<br>
> --- a/include/uapi/drm/amdgpu_drm.h<br>
> +++ b/include/uapi/drm/amdgpu_drm.h<br>
> @@ -503,6 +503,10 @@ struct drm_amdgpu_gem_op {<br>
>   #define AMDGPU_VM_MTYPE_CC          (3 << 5)<br>
>   /* Use UC MTYPE instead of default MTYPE */<br>
>   #define AMDGPU_VM_MTYPE_UC          (4 << 5)<br>
> +/* Use RW MTYPE instead of default MTYPE */<br>
> +#define AMDGPU_VM_MTYPE_RW           (5 << 5)<br>
<br>
> +/* Cacheable/snoopable */<br>
> +#define AMDGPU_VM_PAGE_SNOOPED               (1 << 9)<br>
<br>
That's a rather big NAK. Cache snooping is not something userspace is allowed to be aware of.<br>
<br>
Christian.<br>
<br>
>   <br>
>   struct drm_amdgpu_gem_va {<br>
>        /** GEM object handle */<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>