Add UALink infrastructure series 2
Subsystems (7)
Alex Deucher
maintainerv2 cover Add UALink infrastructure series 2
This adds the core infrastructure for supporting UALink (Ultra Accelerator Link) connected scale up pods. I've split this into two series, one to add the core infrastructure, and one to expose the new IOCTL interface and add the documentation to avoid spamming the larger audience with the implemenation defails. This is the second series.
The first series can be found here:
V2: https://lists.freedesktop.org/archives/amd-gfx/2026-August/151914.html
V1: https://lists.freedesktop.org/archives/amd-gfx/2026-August/151200.html
Both series can be accessed via this git branch:
https://gitlab.freedesktop.org/agd5f/linux/-/commits/ualink?ref_type=heads
This implements UALoE (UALink over Ethernet). An overview of the complete solution can be found here:
https://www.amd.com/en/products/rackscale-solutions/helios.html
Overview
Connected GPUs in a pod can directly access the remove memory on another GPU over UALink. Unlike RMDA, there is no copy involved; it is direct loads/stores over the fabric. Shared memory can only be accessed by a remote GPU if the memory was exported and the importer has been authorized. For the memory to be shared, it must be part of a unified physical address space shared between nodes. This address space is called NPA (Nework Physical Address) space. This address space is partitioned between the GPUs so that each GPU has it's own segment of the address space in which to export its memory. Each GPU maintains a dedicated set of page tables for their NPA space similar to GPUVM.
Exported memory is pinned. This is similar to how dma-bufs in VRAM are pinned for P2P access. Remote TLB shootdowns from the exporter are used when the exported memory is freed in order to remove access by remote GPUs
To access remote memory, the driver can map NPA addresses into its per process GPUVM page tables just like local memory. Applications use opaque handles to represent remote memory. GPUs in a pod communicate with eachother directly to exchange NPA addresses between importers and exporters. If a node goes offline or is reset, their peers will clean up any remaining refrences that are lost when that happens.
User interface
Export Memory
To export memory, a handle must be created for an allocation that can be shared with another node in the pod. To do this the exporter calls the GEM UALink IOCTL with the GEM handle to the buffer it wants to export. The IOCTL returns a unique handle which can be shared with the remote host.
Import Memory
To import the memory, the handle from the remote node must be converted from a unique handle to a local GEM object which represents the local reference to the NPA space on the importer. If the memory has already been imported, it just returns a new reference to the existing object. If not, the importer queries the exporter to get the NPA address. Once it has that the importer can create a dma-buf to represent the NPA space used by the allocation and that is returned to the application.
Proposed Userspace
https://github.com/ROCm/rocm-systems/blob/35959f8e1260c7cee3e51a740e320be3856ee4ff/projects/rocr-runtime/libhsakmt/src/memory.c#L971
https://github.com/ROCm/rocm-systems/blob/35959f8e1260c7cee3e51a740e320be3856ee4ff/projects/rocr-runtime/libhsakmt/src/memory.c#L1036
v2:
- Update the Documentation based on review feedback
Alex Deucher (1):
Documentation: add initial UALink Documentation
Mukul Joshi (2):
drm/gem: Add callback for when handle count goes to 0 drm/amdgpu: Add ioctl infra for exporting/importing UALink handles
Documentation/gpu/amdgpu/index.rst | 1 + Documentation/gpu/amdgpu/ualink.rst | 75 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 9 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 44 +++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.h | 2 + drivers/gpu/drm/drm_gem.c | 5 +- include/drm/drm_gem.h | 11 ++++ include/uapi/drm/amdgpu_drm.h | 30 +++++++++ 9 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 Documentation/gpu/amdgpu/ualink.rst
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH v2 1/3 drm/gem: Add callback for when handle count goes to 0
From: Mukul Joshi <[email protected]>
Add an optional callback for driver-specific cleanup when the GEM handle of an object is freed. This will be used by AMDGPU to enable freeing of memory exported to other nodes in a UALink pod once all user mode references are gone.
The callback is called outside the object_name_lock and before releasing the reference count on the GEM object
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 9 +++++++++ drivers/gpu/drm/drm_gem.c | 5 ++++- include/drm/drm_gem.h | 11 +++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +9 -0
@@ -386,6 +386,14 @@ static int amdgpu_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_strreturn drm_gem_ttm_mmap (obj, vma); } +static void amdgpu_gem_object_handle_free (struct drm_gem_object *gobj) +{ +struct amdgpu_bo *aobj =gem_to_amdgpu_bo (gobj); + +amdgpu_ualink_revoke_exported_memory (aobj); + +} +const struct drm_gem_object_funcs amdgpu_gem_object_funcs = { .free = amdgpu_gem_object_free, .open = amdgpu_gem_object_open,
@@ -395,6 +403,7 @@ const struct drm_gem_object_funcs amdgpu_gem_object_funcs = { .vunmap = drm_gem_ttm_vunmap, .mmap = amdgpu_gem_object_mmap, .vm_ops = &amdgpu_gem_vm_ops, + .handle_free = amdgpu_gem_object_handle_free };static bool amdgpu_gem_are_domains_valid (u32 domains)
drivers/gpu/drm/drm_gem.c +4 -1
@@ -354,8 +354,11 @@ void drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj) }mutex_unlock (&dev->object_name_lock); -if (final) +if (final) { +if (obj->funcs->handle_free) + obj->funcs->handle_free (obj);drm_gem_object_put (obj); + } }/*
include/drm/drm_gem.h +11 -0
@@ -227,6 +227,17 @@ struct drm_gem_object_funcs {*/ size_t (*rss)(struct drm_gem_object *obj); +/** +* @handle_free: +* +* This callback is called when the GEM handle count goes down to 0. +* It is currently used by AMDGPU driver to release their exported BO +* handles. +* +* This callback is optional. +*/ +void (*handle_free)(struct drm_gem_object *obj); +/** * @vm_ops: *
Signature · 1 line
2.55.0
Re: [PATCH 1/3] drm/gem: Add callback for when handle count goes to 0
Quoted 9 lines · Alex Deucher
From: Mukul Joshi <[email protected]>
Add an optional callback for driver-specific cleanup when the GEM handle of an object is freed. This will be used by AMDGPU to enable freeing of memory exported to other nodes in a UALink pod once all user mode references are gone.
The callback is called outside the
object_name_lockand before releasing the reference count on the GEM object
This showed up in -next yesterday and afaics broke build on arm64 and x86_64 for me with the following error from rust:
"""
Quoted 6 lines
Quoted 6 lines
error[E0063]: missing field
handle_freein initializer ofdrm_gem_object_funcs
-->rust/kernel/drm/gem/mod.rs:265:58| 265 | const OBJECT_FUNCS: bindings::drm_gem_object_funcs = bindings::drm_gem_object_funcs { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `handle_free`
Quoted 6 lines
Quoted 6 lines
error: aborting due to 1 previous error
For more information about this error, try
rustc --explain E0063.
make[2]: *** [rust/Makefile:799:rust/kernel.o] Error 1
make[1]: *** [/builddir/build/BUILD/kernel-7.3.0-build/kernel-next-20260904/linux-7.3.0-0.0.next.20260904.221.vanilla.fc43.aarch64/Makefile:1442: prepare] Error 2
make: *** [Makefile:256: __sub-make] Error 2
Reverting this change and 2/3 from this set fixed the problem for me.
Ciao, Thorsten
Quoted 76 lines
Suggested-by Christian König <[email protected]>Signed-off-by Mukul Joshi <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 9 +++++++++ drivers/gpu/drm/drm_gem.c | 5 ++++- include/drm/drm_gem.h | 11 +++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +9
-0@@ -386,6 +386,14 @@ static int amdgpu_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_strreturn drm_gem_ttm_mmap (obj, vma); } +static void amdgpu_gem_object_handle_free (struct drm_gem_object *gobj) +{ +struct amdgpu_bo *aobj =gem_to_amdgpu_bo (gobj); + +amdgpu_ualink_revoke_exported_memory (aobj); + +} +const struct drm_gem_object_funcs amdgpu_gem_object_funcs = { .free = amdgpu_gem_object_free, .open = amdgpu_gem_object_open,@@ -395,6 +403,7 @@ const struct drm_gem_object_funcs amdgpu_gem_object_funcs = { .vunmap = drm_gem_ttm_vunmap, .mmap = amdgpu_gem_object_mmap, .vm_ops = &amdgpu_gem_vm_ops, + .handle_free = amdgpu_gem_object_handle_free };static bool amdgpu_gem_are_domains_valid (u32 domains)drivers/gpu/drm/drm_gem.c +4
-1@@ -354,8 +354,11 @@ void drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj) }mutex_unlock (&dev->object_name_lock); -if (final) +if (final) { +if (obj->funcs->handle_free) + obj->funcs->handle_free (obj);drm_gem_object_put (obj); + } }/* include/drm/drm_gem.h +11
-0@@ -227,6 +227,17 @@ struct drm_gem_object_funcs {*/ size_t (*rss)(struct drm_gem_object *obj); +/** +* @handle_free: +* +* This callback is called when the GEM handle count goes down to 0. +* It is currently used by AMDGPU driver to release their exported BO +* handles. +* +* This callback is optional. +*/ +void (*handle_free)(struct drm_gem_object *obj); +/** * @vm_ops: *
Re: [PATCH 1/3] drm/gem: Add callback for when handle count goes to 0
Quoted 17 lines · Thorsten Leemhuis
Quoted 2 lines · Alex Deucher
From: Mukul Joshi <[email protected]>
......
Quoted 6 lines
Quoted 6 lines
error[E0063]: missing field
handle_freein initializer ofdrm_gem_object_funcs
-->rust/kernel/drm/gem/mod.rs:265:58
|
265 | constOBJECT_FUNCS:bindings::drm_gem_object_funcs=bindings::drm_gem_object_funcs{ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missinghandle_freeQuoted 6 lines
Quoted 6 lines
error: aborting due to 1 previous error
For more information about this error, try
rustc --explain E0063.
make[2]: *** [rust/Makefile:799:rust/kernel.o] Error 1
make[1]: *** [/builddir/build/BUILD/kernel-7.3.0-build/kernel-next-20260904/linux-7.3.0-0.0.next.20260904.221.vanilla.fc43.aarch64/Makefile:1442: prepare] Error 2
make: *** [Makefile:256: __sub-make] Error 2
Quoted 5 lines
Reverting this change and 2/3 from this set fixed the problem for me.
Verified.
Thanks
Manuel
Quoted 3 lines
Ciao, Thorsten
Quoted 1 line
...
Re: [PATCH 1/3] drm/gem: Add callback for when handle count goes to 0
Quoted 18 lines · Manuel Ebner
Quoted 17 lines · Thorsten Leemhuis
Quoted 2 lines · Alex Deucher
From: Mukul Joshi <[email protected]>
......
Quoted 12 lines
Quoted 12 lines
error[E0063]: missing field
handle_freein initializer ofdrm_gem_object_funcs
-->rust/kernel/drm/gem/mod.rs:265:58
|
265 | constOBJECT_FUNCS:bindings::drm_gem_object_funcs=bindings::drm_gem_object_funcs{ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missinghandle_freeerror: aborting due to 1 previous error
For more information about this error, try
rustc --explain E0063.
make[2]: *** [rust/Makefile:799:rust/kernel.o] Error 1
make[1]: *** [/builddir/build/BUILD/kernel-7.3.0-build/kernel-next-20260904/linux-7.3.0-0.0.next.20260904.221.vanilla.fc43.aarch64/Makefile:1442: prepare] Error 2
make: *** [Makefile:256: __sub-make] Error 2
Quoted 5 lines
Quoted 5 lines
Reverting this change and 2/3 from this set fixed the problem for me.
That leaves only the documentation without the feature so might as well drop 3/3 too in that case?
Otherwise, the following also fixes it for me:
rust/kernel/drm/gem/mod.rs +1 -0
@@ -278,6 +278,7 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> { vm_ops: core::ptr::null_mut(), evict: None, rss: None, + handle_free: None, };/// Returns the `Device` that owns this GEM object.
Quoted 8 lines
Verified.
Thanks
ManuelQuoted 3 lines
Ciao, Thorsten
Quoted 1 line
...
Regards,
Klara Modin
Gary Guo
reviewerRe: [PATCH 1/3] drm/gem: Add callback for when handle count goes to 0
Quoted 35 lines · Klara Modin
Quoted 18 lines · Manuel Ebner
Quoted 17 lines · Thorsten Leemhuis
Quoted 2 lines · Alex Deucher
From: Mukul Joshi <[email protected]>
......
Quoted 12 lines
Quoted 12 lines
error[E0063]: missing field
handle_freein initializer ofdrm_gem_object_funcs
-->rust/kernel/drm/gem/mod.rs:265:58
|
265 | constOBJECT_FUNCS:bindings::drm_gem_object_funcs=bindings::drm_gem_object_funcs{ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missinghandle_freeerror: aborting due to 1 previous error
For more information about this error, try
rustc --explain E0063.
make[2]: *** [rust/Makefile:799:rust/kernel.o] Error 1
make[1]: *** [/builddir/build/BUILD/kernel-7.3.0-build/kernel-next-20260904/linux-7.3.0-0.0.next.20260904.221.vanilla.fc43.aarch64/Makefile:1442: prepare] Error 2
make: *** [Makefile:256: __sub-make] Error 2Quoted 5 lines
Quoted 5 lines
Reverting this change and 2/3 from this set fixed the problem for me.
That leaves only the documentation without the feature so might as well drop 3/3 too in that case?
Otherwise, the following also fixes it for me:
rust/kernel/drm/gem/mod.rs +0
-0
rust/kernel/drm/gem/mod.rs impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> { · line 281
Quoted 4 lines
rust/kernel/drm/gem/mod.rs +1
-0@@ -278,6 +278,7 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> { vm_ops: core::ptr::null_mut(), evict: None, rss: None, + handle_free: None,
IMO this should use
..pin_init::zeroed()
to set all other fields as zero rather than explicitly listing all of them.
Best,
Gary
Quoted 15 lines
rust/kernel/drm/gem/mod.rs +0
-0};/// Returns the `Device` that owns this GEM object. Quoted 9 lines
Verified.
Thanks
ManuelQuoted 3 lines
Ciao, Thorsten
Quoted 1 line
...
Regards,
Klara Modin
Re: [PATCH 1/3] drm/gem: Add callback for when handle count goes to 0
In reply to Klara ModinQuoted 17 lines · Klara Modin
Quoted 16 lines · Manuel Ebner
Quoted 15 lines · Thorsten Leemhuis
Quoted 14 lines · Alex Deucher
From: Mukul Joshi <[email protected]>
Quoted 12 lines
error[E0063]: missing field
handle_freein initializer ofdrm_gem_object_funcs
-->rust/kernel/drm/gem/mod.rs:265:58
|
265 | constOBJECT_FUNCS:bindings::drm_gem_object_funcs=bindings::drm_gem_object_funcs{ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missinghandle_freeerror: aborting due to 1 previous error
For more information about this error, try
rustc --explain E0063.
make[2]: *** [rust/Makefile:799:rust/kernel.o] Error 1
make[1]: *** [/builddir/build/BUILD/kernel-7.3.0-build/kernel-next-20260904/linux-7.3.0-0.0.next.20260904.221.vanilla.fc43.aarch64/Makefile:1442: prepare] Error 2
make: *** [Makefile:256: __sub-make] Error 2
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Reverting this change and 2/3 from this set fixed the problem for me.
That leaves only the documentation without the feature so might as well drop 3/3 too in that case?
My intention was just to confirm that these patches are the problem, not suggest this as a solution, so I didn't bother about the docs. :-D
Quoted 1 line
Otherwise, the following also fixes it for me:
Thx, for me, too.
Ciao, Thorsten
Quoted 12 lines
rust/kernel/drm/gem/mod.rs +1
-0@@ -278,6 +278,7 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> { vm_ops: core::ptr::null_mut(), evict: None, rss: None, + handle_free: None, };/// Returns the `Device` that owns this GEM object.
Re: [PATCH 1/3] drm/gem: Add callback for when handle count goes to 0
In reply to Klara ModinQuoted 37 lines · Klara Modin
Quoted 18 lines · Manuel Ebner
Quoted 17 lines · Thorsten Leemhuis
Quoted 2 lines · Alex Deucher
From: Mukul Joshi <[email protected]>
......
Quoted 12 lines
Quoted 12 lines
error[E0063]: missing field
handle_freein initializer ofdrm_gem_object_funcs
-->rust/kernel/drm/gem/mod.rs:265:58| 265 | const OBJECT_FUNCS: bindings::drm_gem_object_funcs = bindings::drm_gem_object_funcs { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `handle_free`error: aborting due to 1 previous error
For more information about this error, try
rustc --explain E0063.
make[2]: *** [rust/Makefile:799:rust/kernel.o] Error 1
make[1]: *** [/builddir/build/BUILD/kernel-7.3.0-build/kernel-next-20260904/linux-7.3.0-0.0.next.20260904.221.vanilla.fc43.aarch64/Makefile:1442: prepare] Error 2
make: *** [Makefile:256: __sub-make] Error 2Quoted 5 lines
Quoted 5 lines
Reverting this change and 2/3 from this set fixed the problem for me.
That leaves only the documentation without the feature so might as well drop 3/3 too in that case?
Otherwise, the following also fixes it for me:
rust/kernel/drm/gem/mod.rs +0
-0
rust/kernel/drm/gem/mod.rs impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> { · line 284
Quoted 7 lines
rust/kernel/drm/gem/mod.rs +1
-0@@ -278,6 +278,7 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> { vm_ops: core::ptr::null_mut(), evict: None, rss: None, + handle_free: None, };/// Returns the `Device` that owns this GEM object.
Can you send this as a proper patch?
Thanks,
Alex
Quoted 11 lines
Quoted 8 lines
Verified.
Thanks
ManuelQuoted 3 lines
Ciao, Thorsten
Quoted 1 line
...
Regards,
Klara Modin
Re: [PATCH 1/3] drm/gem: Add callback for when handle count goes to 0
Quoted 43 lines · Alex Deucher
Quoted 42 lines · Klara Modin
Quoted 18 lines · Manuel Ebner
Quoted 17 lines · Thorsten Leemhuis
Quoted 2 lines · Alex Deucher
From: Mukul Joshi <[email protected]>
......
Quoted 12 lines
Quoted 12 lines
error[E0063]: missing field
handle_freein initializer ofdrm_gem_object_funcs
-->rust/kernel/drm/gem/mod.rs:265:58| 265 | const OBJECT_FUNCS: bindings::drm_gem_object_funcs = bindings::drm_gem_object_funcs { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `handle_free`error: aborting due to 1 previous error
For more information about this error, try
rustc --explain E0063.
make[2]: *** [rust/Makefile:799:rust/kernel.o] Error 1
make[1]: *** [/builddir/build/BUILD/kernel-7.3.0-build/kernel-next-20260904/linux-7.3.0-0.0.next.20260904.221.vanilla.fc43.aarch64/Makefile:1442: prepare] Error 2
make: *** [Makefile:256: __sub-make] Error 2Quoted 5 lines
Quoted 5 lines
Reverting this change and 2/3 from this set fixed the problem for me.
That leaves only the documentation without the feature so might as well drop 3/3 too in that case?
Otherwise, the following also fixes it for me:
rust/kernel/drm/gem/mod.rs +1
-0@@ -278,6 +278,7 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> { vm_ops: core::ptr::null_mut(), evict: None, rss: None, + handle_free: None, };
Quoted 4 lines
rust/kernel/drm/gem/mod.rs impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> { · line 284
Quoted 2 lines
rust/kernel/drm/gem/mod.rs +0
-0/// Returns the `Device` that owns this GEM object. Can you send this as a proper patch?
Here: https://lore.kernel.org/lkml/[email protected]
I liked Gary's suggestion so went with that instead.
Quoted 4 lines
Thanks,
Alex
Regards,
Klara Modin
Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Verified.
Thanks
ManuelQuoted 3 lines
Ciao, Thorsten
Quoted 1 line
...
Regards,
Klara Modin
Alex Deucher
maintainerPATCH v2 2/3 drm/amdgpu: Add ioctl infra for exporting/importing UALink handles
In reply to Alex DeucherFrom: Mukul Joshi <[email protected]>
Add the ioctl infrastructure to support exporting and importing BOs to facilitate NPA based memory sharing across GPUs in a rack scale setup.
Proposed userspace:
https://github.com/ROCm/rocm-systems/blob/35959f8e1260c7cee3e51a740e320be3856ee4ff/projects/rocr-runtime/libhsakmt/src/memory.c#L971
https://github.com/ROCm/rocm-systems/blob/35959f8e1260c7cee3e51a740e320be3856ee4ff/projects/rocr-runtime/libhsakmt/src/memory.c#L1036
v2: Move the ioctl wire-up to the end of the series.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 44 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.h | 2 + include/uapi/drm/amdgpu_drm.h | 30 +++++++++++++++ 4 files changed, 78 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
@@ -54,6 +54,7 @@#include "amdgpu_userq.h" #include "amdgpu_userq_fence.h" #include "../amdxcp/amdgpu_xcp_drv.h" +#include "amdgpu_ualink.h" /* * KMS wrapper.
@@ -3120,6 +3121,7 @@ const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {DRM_IOCTL_DEF_DRV (AMDGPU_USERQ_WAIT , amdgpu_userq_wait_ioctl,DRM_AUTH |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (AMDGPU_GEM_LIST_HANDLES , amdgpu_gem_list_handles_ioctl,DRM_AUTH |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (AMDGPU_PROC_OPTIONS , amdgpu_proc_options_ioctl,DRM_AUTH |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF_DRV (AMDGPU_UALINK_HANDLE , amdgpu_gem_ualink_handle_ioctl,DRM_AUTH |DRM_RENDER_ALLOW ) }; static const struct drm_driver amdgpu_kms_driver = {
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +44 -0
50 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.h +2 -0
@@ -413,6 +413,8 @@ int amdgpu_ualink_export_handle(struct drm_device *dev, struct drm_file *filp,int amdgpu_ualink_import_handle (struct drm_device *dev,const struct amdgpu_ualink_handle *ualink_handle,int *fd_out); +int amdgpu_gem_ualink_handle_ioctl (struct drm_device *dev,void *data, +struct drm_file *filp);void amdgpu_ualink_revoke_exported_memory (struct amdgpu_bo *bo);int ualink_ip_hw_init (struct amdgpu_ip_block *ip_block);
include/uapi/drm/amdgpu_drm.h +30 -0
@@ -59,6 +59,7 @@ extern "C" {#define DRM_AMDGPU_USERQ_WAIT 0x18#define DRM_AMDGPU_GEM_LIST_HANDLES 0x19#define DRM_AMDGPU_PROC_OPTIONS 0x1A +#define DRM_AMDGPU_UALINK_HANDLE 0x1B#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
@@ -81,6 +82,7 @@ extern "C" {#define DRM_IOCTL_AMDGPU_USERQ_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ_WAIT, struct drm_amdgpu_userq_wait)#define DRM_IOCTL_AMDGPU_GEM_LIST_HANDLES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_LIST_HANDLES, struct drm_amdgpu_gem_list_handles)#define DRM_IOCTL_AMDGPU_PROC_OPTIONS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_PROC_OPTIONS, struct drm_amdgpu_proc_options) +#define DRM_IOCTL_AMDGPU_UALINK_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_UALINK_HANDLE, union drm_amdgpu_ualink_handle)/** * DOC: memory domains
@@ -1705,6 +1707,34 @@ struct drm_amdgpu_proc_options { } kfd_sigbus_delay; }; +#define DRM_AMDGPU_UALINK_HANDLE_OP_EXPORT 0 +#define DRM_AMDGPU_UALINK_HANDLE_OP_IMPORT 1 + +struct drm_amdgpu_ualink_handle_in { +/* Export or import */ +__u32 op; +/* For future use, no flags defined so far */ +__u32 flags; +union { +/* GEM handle of the BO to export */ +__u32 gem_handle; +/* UALink handle to import */ +__u64 import_ualink_handle[2 ]; + }; +}; + +union drm_amdgpu_ualink_handle_out { +/* Exported UALink handle */ +__u64 export_ualink_handle[2 ]; +/** DMABuf representing the imported UALink handle */ +__u32 import_dmabuf_handle; +}; + +union drm_amdgpu_ualink_handle { +struct drm_amdgpu_ualink_handle_in in; +union drm_amdgpu_ualink_handle_out out; +}; +#if defined(__cplusplus) }#endif
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH v2 3/3 Documentation: add initial UALink Documentation
In reply to Alex DeucherDocument the details of UALink on the GPU.
v2: add updates from Felix
--- Documentation/gpu/amdgpu/index.rst | 1 + Documentation/gpu/amdgpu/ualink.rst | 75 +++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 Documentation/gpu/amdgpu/ualink.rst
Documentation/gpu/amdgpu/index.rst +1 -0
@@ -23,4 +23,5 @@ Next (GCN), Radeon DNA (RDNA), and Compute DNA (CDNA) architectures. debugfs process-isolation amdgpu-glossary + ualink ptl
Documentation/gpu/amdgpu/ualink.rst new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
2.55.0