Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sunil Khatri <sunil.khatri@amd.com>
To: igt-dev@lists.freedesktop.org
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Vitaly Prosyak" <vitaly.prosyak@amd.com>,
	"Shashank Sharma" <shashank.sharma@amd.com>,
	Strawbridge@rtg-sunil-navi33.amd.com,
	Michael <Michael.Strawbridge@amd.com>,
	"Sunil Khatri" <sunil.khatri@amd.com>
Subject: [PATCH 5/8] lib/amdgpu: add func amdgpu_bo_alloc_and_map_sync
Date: Thu, 16 Jan 2025 12:22:08 +0530	[thread overview]
Message-ID: <20250116065211.1882469-6-sunil.khatri@amd.com> (raw)
In-Reply-To: <20250116065211.1882469-1-sunil.khatri@amd.com>

Add amdgpu_bo_alloc_and_map_sync func which
is synchronised version of amdgpu_bo_alloc_and_map.
It wait till the timeline is signaled and page tables
are updated for the bo.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Vitaly Prosyak vitaly.prosyak@amd.com>
---
 lib/amdgpu/amd_memory.c | 19 +++++++++++++++++++
 lib/amdgpu/amd_memory.h |  8 ++++++++
 2 files changed, 27 insertions(+)

diff --git a/lib/amdgpu/amd_memory.c b/lib/amdgpu/amd_memory.c
index 92ddc9fe2..d1ff57085 100644
--- a/lib/amdgpu/amd_memory.c
+++ b/lib/amdgpu/amd_memory.c
@@ -25,6 +25,8 @@
 
 #include "amd_memory.h"
 #include "amd_PM4.h"
+#include "amd_user_queue.h"
+
 /**
  *
  * @param device_handle
@@ -193,6 +195,23 @@ error_va_alloc:
 	return r;
 }
 
+int
+amdgpu_bo_alloc_and_map_sync(amdgpu_device_handle dev, unsigned int size,
+			     unsigned int alignment, unsigned int heap, uint64_t flags,
+			     uint64_t mapping_flags, amdgpu_bo_handle *bo, void **cpu,
+			     uint64_t *mc_address, amdgpu_va_handle *va_handle,
+			     uint32_t timeline_syncobj_handle, uint64_t point, bool sync)
+{
+	if (sync)
+		return amdgpu_bo_alloc_and_map_uq(dev, size, alignment, heap, flags,
+						  mapping_flags, bo, cpu,
+						  mc_address, va_handle,
+						  timeline_syncobj_handle, point);
+	else
+		return amdgpu_bo_alloc_and_map(dev, size, alignment, heap, flags,
+					       bo, cpu, mc_address, va_handle);
+}
+
 int
 amdgpu_bo_alloc_and_map_raw(amdgpu_device_handle dev, unsigned size,
 			unsigned alignment, unsigned heap, uint64_t alloc_flags,
diff --git a/lib/amdgpu/amd_memory.h b/lib/amdgpu/amd_memory.h
index a06f88923..9b0e3f392 100644
--- a/lib/amdgpu/amd_memory.h
+++ b/lib/amdgpu/amd_memory.h
@@ -55,6 +55,14 @@ amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
 			amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address,
 			amdgpu_va_handle *va_handle);
 
+int
+amdgpu_bo_alloc_and_map_sync(amdgpu_device_handle dev, unsigned int size,
+			     unsigned int alignment, unsigned int heap, uint64_t flags,
+			     uint64_t mapping_flags, amdgpu_bo_handle *bo, void **cpu,
+			     uint64_t *mc_address, amdgpu_va_handle *va_handle,
+			     uint32_t timeline_syncobj_handle, uint64_t point,
+			     bool sync);
+
 int
 amdgpu_bo_alloc_and_map_raw(amdgpu_device_handle dev, unsigned size,
 			unsigned alignment, unsigned heap, uint64_t alloc_flags,
-- 
2.34.1


  parent reply	other threads:[~2025-01-16  7:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-16  6:52 [PATCH 0/8] The series add support for UMQ submission Sunil Khatri
2025-01-16  6:52 ` [PATCH 1/8] drm-uapi/amdgpu: sync with drm-next Sunil Khatri
2025-01-16  6:52 ` [PATCH 2/8] " Sunil Khatri
2025-01-16  6:52 ` [PATCH 3/8] lib/amdgpu: Add user mode queue support in ring context Sunil Khatri
2025-01-16 11:51   ` Kamil Konieczny
2025-01-16 15:43     ` vitaly prosyak
2025-01-16 16:28       ` Khatri, Sunil
2025-01-16  6:52 ` [PATCH 4/8] lib/amdgpu: Add support of amd user queues Sunil Khatri
2025-01-16  6:52 ` Sunil Khatri [this message]
2025-01-16  6:52 ` [PATCH 6/8] tests/amdgpu: Add user queue support for gfx and compute Sunil Khatri
2025-01-16  6:52 ` [PATCH 7/8] tests/amdgpu: Add UMQ submission tests " Sunil Khatri
2025-01-16  6:52 ` [PATCH 8/8] tests/amdgpu: Add amdgpu_sync_dependency_test with UMQ Sunil Khatri
2025-01-16  7:29 ` ✗ GitLab.Pipeline: warning for The series add support for UMQ submission Patchwork
2025-01-16  8:33 ` ✓ Xe.CI.BAT: success " Patchwork
2025-01-16  8:41 ` ✓ i915.CI.BAT: " Patchwork
2025-01-16 12:23 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-17 10:44 ` ✗ i915.CI.Full: " Patchwork

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=20250116065211.1882469-6-sunil.khatri@amd.com \
    --to=sunil.khatri@amd.com \
    --cc=Michael.Strawbridge@amd.com \
    --cc=Strawbridge@rtg-sunil-navi33.amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=shashank.sharma@amd.com \
    --cc=vitaly.prosyak@amd.com \
    /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