linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: Add SVM API support capability bits
@ 2022-03-30 21:24 Alex Sierra
  2022-03-30 21:26 ` Sierra Guiza, Alejandro (Alex)
  2022-03-30 21:29 ` Matthew Wilcox
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Sierra @ 2022-03-30 21:24 UTC (permalink / raw)
  To: jgg
  Cc: david, Felix.Kuehling, linux-mm, rcampbell, linux-ext4,
	linux-xfs, amd-gfx, dri-devel, hch, jglisse, apopple, willy,
	akpm

From: Philip Yang <Philip.Yang@amd.com>

SVMAPISupported property added to HSA_CAPABILITY, the value match
HSA_CAPABILITY defined in Thunk spec:

SVMAPISupported: it will not be supported on older kernels that don't
have HMM or on systems with GFXv8 or older GPUs without support for
48-bit virtual addresses.

CoherentHostAccess property added to HSA_MEMORYPROPERTY, the value match
HSA_MEMORYPROPERTY defined in Thunk spec:

CoherentHostAccess: whether or not device memory can be coherently
accessed by the host CPU.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c |  6 ++++++
 drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index cdef608db4f4..083ac9babfa8 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1419,6 +1419,12 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
 		dev->node_props.capability |= (adev->ras_features != 0) ?
 			HSA_CAP_RASEVENTNOTIFY : 0;
 
+	/* SVM API and HMM page migration work together, device memory type
+	 * is initialized to not 0 when page migration register device memory.
+	 */
+	if (adev->kfd.dev->pgmap.type != 0)
+		dev->node_props.capability |= HSA_CAP_SVMAPI_SUPPORTED;
+
 	kfd_debug_print_topology();
 
 	if (!res)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
index b8b68087bd7a..6bd6380b0ee0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
@@ -53,8 +53,9 @@
 #define HSA_CAP_ASIC_REVISION_MASK		0x03c00000
 #define HSA_CAP_ASIC_REVISION_SHIFT		22
 #define HSA_CAP_SRAM_EDCSUPPORTED		0x04000000
+#define HSA_CAP_SVMAPI_SUPPORTED		0x08000000
 
-#define HSA_CAP_RESERVED			0xf80f8000
+#define HSA_CAP_RESERVED			0xf00f8000
 
 struct kfd_node_properties {
 	uint64_t hive_id;
@@ -98,9 +99,10 @@ struct kfd_node_properties {
 #define HSA_MEM_HEAP_TYPE_GPU_LDS	4
 #define HSA_MEM_HEAP_TYPE_GPU_SCRATCH	5
 
-#define HSA_MEM_FLAGS_HOT_PLUGGABLE	0x00000001
-#define HSA_MEM_FLAGS_NON_VOLATILE	0x00000002
-#define HSA_MEM_FLAGS_RESERVED		0xfffffffc
+#define HSA_MEM_FLAGS_HOT_PLUGGABLE		0x00000001
+#define HSA_MEM_FLAGS_NON_VOLATILE		0x00000002
+#define HSA_MEM_FLAGS_COHERENTHOSTACCESS	0x00000004
+#define HSA_MEM_FLAGS_RESERVED			0xfffffff8
 
 struct kfd_mem_properties {
 	struct list_head	list;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] drm/amdkfd: Add SVM API support capability bits
  2022-03-30 21:24 [PATCH] drm/amdkfd: Add SVM API support capability bits Alex Sierra
@ 2022-03-30 21:26 ` Sierra Guiza, Alejandro (Alex)
  2022-03-30 21:29 ` Matthew Wilcox
  1 sibling, 0 replies; 4+ messages in thread
From: Sierra Guiza, Alejandro (Alex) @ 2022-03-30 21:26 UTC (permalink / raw)
  To: Sierra Guiza, Alejandro (Alex), jgg
  Cc: rcampbell, willy, david, Kuehling, Felix, apopple, amd-gfx,
	linux-xfs, linux-mm, jglisse, dri-devel, akpm, linux-ext4, hch

Please ignore this patch.

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex
> Sierra
> Sent: Wednesday, March 30, 2022 4:24 PM
> To: jgg@nvidia.com
> Cc: rcampbell@nvidia.com; willy@infradead.org; david@redhat.com;
> Kuehling, Felix <Felix.Kuehling@amd.com>; apopple@nvidia.com; amd-
> gfx@lists.freedesktop.org; linux-xfs@vger.kernel.org; linux-mm@kvack.org;
> jglisse@redhat.com; dri-devel@lists.freedesktop.org; akpm@linux-
> foundation.org; linux-ext4@vger.kernel.org; hch@lst.de
> Subject: [PATCH] drm/amdkfd: Add SVM API support capability bits
> 
> From: Philip Yang <Philip.Yang@amd.com>
> 
> SVMAPISupported property added to HSA_CAPABILITY, the value match
> HSA_CAPABILITY defined in Thunk spec:
> 
> SVMAPISupported: it will not be supported on older kernels that don't have
> HMM or on systems with GFXv8 or older GPUs without support for 48-bit
> virtual addresses.
> 
> CoherentHostAccess property added to HSA_MEMORYPROPERTY, the value
> match HSA_MEMORYPROPERTY defined in Thunk spec:
> 
> CoherentHostAccess: whether or not device memory can be coherently
> accessed by the host CPU.
> 
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_topology.c |  6 ++++++
> drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 10 ++++++----
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> index cdef608db4f4..083ac9babfa8 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> @@ -1419,6 +1419,12 @@ int kfd_topology_add_device(struct kfd_dev
> *gpu)
>  		dev->node_props.capability |= (adev->ras_features != 0) ?
>  			HSA_CAP_RASEVENTNOTIFY : 0;
> 
> +	/* SVM API and HMM page migration work together, device memory
> type
> +	 * is initialized to not 0 when page migration register device memory.
> +	 */
> +	if (adev->kfd.dev->pgmap.type != 0)
> +		dev->node_props.capability |=
> HSA_CAP_SVMAPI_SUPPORTED;
> +
>  	kfd_debug_print_topology();
> 
>  	if (!res)
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
> b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
> index b8b68087bd7a..6bd6380b0ee0 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
> @@ -53,8 +53,9 @@
>  #define HSA_CAP_ASIC_REVISION_MASK		0x03c00000
>  #define HSA_CAP_ASIC_REVISION_SHIFT		22
>  #define HSA_CAP_SRAM_EDCSUPPORTED		0x04000000
> +#define HSA_CAP_SVMAPI_SUPPORTED		0x08000000
> 
> -#define HSA_CAP_RESERVED			0xf80f8000
> +#define HSA_CAP_RESERVED			0xf00f8000
> 
>  struct kfd_node_properties {
>  	uint64_t hive_id;
> @@ -98,9 +99,10 @@ struct kfd_node_properties {
>  #define HSA_MEM_HEAP_TYPE_GPU_LDS	4
>  #define HSA_MEM_HEAP_TYPE_GPU_SCRATCH	5
> 
> -#define HSA_MEM_FLAGS_HOT_PLUGGABLE	0x00000001
> -#define HSA_MEM_FLAGS_NON_VOLATILE	0x00000002
> -#define HSA_MEM_FLAGS_RESERVED		0xfffffffc
> +#define HSA_MEM_FLAGS_HOT_PLUGGABLE		0x00000001
> +#define HSA_MEM_FLAGS_NON_VOLATILE		0x00000002
> +#define HSA_MEM_FLAGS_COHERENTHOSTACCESS	0x00000004
> +#define HSA_MEM_FLAGS_RESERVED			0xfffffff8
> 
>  struct kfd_mem_properties {
>  	struct list_head	list;
> --
> 2.32.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amdkfd: Add SVM API support capability bits
  2022-03-30 21:24 [PATCH] drm/amdkfd: Add SVM API support capability bits Alex Sierra
  2022-03-30 21:26 ` Sierra Guiza, Alejandro (Alex)
@ 2022-03-30 21:29 ` Matthew Wilcox
  2022-03-30 22:04   ` Sierra Guiza, Alejandro (Alex)
  1 sibling, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2022-03-30 21:29 UTC (permalink / raw)
  To: Alex Sierra
  Cc: jgg, david, Felix.Kuehling, linux-mm, rcampbell, linux-ext4,
	linux-xfs, amd-gfx, dri-devel, hch, jglisse, apopple, akpm

On Wed, Mar 30, 2022 at 04:24:20PM -0500, Alex Sierra wrote:
> From: Philip Yang <Philip.Yang@amd.com>
> 
> SVMAPISupported property added to HSA_CAPABILITY, the value match
> HSA_CAPABILITY defined in Thunk spec:
> 
> SVMAPISupported: it will not be supported on older kernels that don't
> have HMM or on systems with GFXv8 or older GPUs without support for
> 48-bit virtual addresses.
> 
> CoherentHostAccess property added to HSA_MEMORYPROPERTY, the value match
> HSA_MEMORYPROPERTY defined in Thunk spec:
> 
> CoherentHostAccess: whether or not device memory can be coherently
> accessed by the host CPU.

Could you translate this commit message into English?  Reviewing
Documentation/process/5.Posting.rst might be helpful.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] drm/amdkfd: Add SVM API support capability bits
  2022-03-30 21:29 ` Matthew Wilcox
@ 2022-03-30 22:04   ` Sierra Guiza, Alejandro (Alex)
  0 siblings, 0 replies; 4+ messages in thread
From: Sierra Guiza, Alejandro (Alex) @ 2022-03-30 22:04 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: jgg, david, Kuehling, Felix, linux-mm, rcampbell, linux-ext4,
	linux-xfs, amd-gfx, dri-devel, hch, jglisse, apopple, akpm

Hi Matthew,
I sent this patch by accident. Please ignore it.

Regards,
Alex Sierra

> -----Original Message-----
> From: Matthew Wilcox <willy@infradead.org>
> Sent: Wednesday, March 30, 2022 4:29 PM
> To: Sierra Guiza, Alejandro (Alex) <Alex.Sierra@amd.com>
> Cc: jgg@nvidia.com; david@redhat.com; Kuehling, Felix
> <Felix.Kuehling@amd.com>; linux-mm@kvack.org; rcampbell@nvidia.com;
> linux-ext4@vger.kernel.org; linux-xfs@vger.kernel.org; amd-
> gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; hch@lst.de;
> jglisse@redhat.com; apopple@nvidia.com; akpm@linux-foundation.org
> Subject: Re: [PATCH] drm/amdkfd: Add SVM API support capability bits
> 
> On Wed, Mar 30, 2022 at 04:24:20PM -0500, Alex Sierra wrote:
> > From: Philip Yang <Philip.Yang@amd.com>
> >
> > SVMAPISupported property added to HSA_CAPABILITY, the value match
> > HSA_CAPABILITY defined in Thunk spec:
> >
> > SVMAPISupported: it will not be supported on older kernels that don't
> > have HMM or on systems with GFXv8 or older GPUs without support for
> > 48-bit virtual addresses.
> >
> > CoherentHostAccess property added to HSA_MEMORYPROPERTY, the
> value
> > match HSA_MEMORYPROPERTY defined in Thunk spec:
> >
> > CoherentHostAccess: whether or not device memory can be coherently
> > accessed by the host CPU.
> 
> Could you translate this commit message into English?  Reviewing
> Documentation/process/5.Posting.rst might be helpful.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-30 22:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 21:24 [PATCH] drm/amdkfd: Add SVM API support capability bits Alex Sierra
2022-03-30 21:26 ` Sierra Guiza, Alejandro (Alex)
2022-03-30 21:29 ` Matthew Wilcox
2022-03-30 22:04   ` Sierra Guiza, Alejandro (Alex)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).