Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Nirmoy Das <nirmoy.das@intel.com>
Subject: [PATCH i-g-t 2/2] tests/intel/xe_exec_atomic: Use new vm bind flag
Date: Wed, 10 Apr 2024 19:00:41 +0200	[thread overview]
Message-ID: <20240410170041.24963-2-nirmoy.das@intel.com> (raw)
In-Reply-To: <20240410170041.24963-1-nirmoy.das@intel.com>

Use new vm bind flag to probe device atomics support.

Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 tests/intel/xe_exec_atomic.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/tests/intel/xe_exec_atomic.c b/tests/intel/xe_exec_atomic.c
index d9790da78..051f47a09 100644
--- a/tests/intel/xe_exec_atomic.c
+++ b/tests/intel/xe_exec_atomic.c
@@ -8,6 +8,7 @@
 
 #include "igt.h"
 #include "lib/igt_syncobj.h"
+#include "lib/intel_pat.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 #include "xe_drm.h"
@@ -85,7 +86,8 @@ static void basic_inst(int fd, int inst_type, struct drm_xe_engine_class_instanc
 
 	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
 	bind_engine = xe_bind_exec_queue_create(fd, vm, 0);
-	xe_vm_bind_async(fd, vm, bind_engine, bo, 0, addr, bo_size, &sync, 1);
+	xe_vm_bind_async_flags(fd, vm, bind_engine, bo, 0, addr, bo_size,
+			       &sync, 1, DRM_XE_VM_BIND_FLAG_DEVICE_ATOMICS);
 	data = xe_bo_mmap_ext(fd, bo, bo_size, PROT_READ|PROT_WRITE);
 	data->data = value;
 
@@ -112,11 +114,21 @@ static void basic_inst(int fd, int inst_type, struct drm_xe_engine_class_instanc
 
 static bool has_atomics(int fd, uint32_t region)
 {
-	/* System memory atomics on dGPU is not functional as of now */
-	if (region == system_memory(fd) && xe_has_vram(fd))
-		return false;
+	uint32_t vm;
+	size_t size = xe_bb_size(fd, 4096);
+	uint32_t bo = 0;
+	int ret;
+
+	vm = xe_vm_create(fd, 0, 0);
+	bo = xe_bo_create(fd, vm, size, region, 0);
+	ret = __xe_vm_bind(fd, vm, 0, bo, 0, 0x40000, size,
+			   DRM_XE_VM_BIND_OP_MAP,
+			   DRM_XE_VM_BIND_FLAG_DEVICE_ATOMICS, NULL, 0, 0,
+			   DEFAULT_PAT_INDEX, 0);
+	gem_close(fd, bo);
+	xe_vm_destroy(fd, vm);
 
-	return true;
+	return ret != -EINVAL;
 }
 
 igt_main
-- 
2.42.0


  reply	other threads:[~2024-04-10 17:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 17:00 [PATCH i-g-t 1/2] drm-uapi/xe: Add device atomics vm bind flags Nirmoy Das
2024-04-10 17:00 ` Nirmoy Das [this message]
2024-04-11  0:26 ` ✗ CI.xeBAT: failure for series starting with [i-g-t,1/2] " Patchwork
2024-04-11  0:50 ` ✗ Fi.CI.BAT: " Patchwork
2024-04-11 11:24 ` ✗ CI.xeFULL: " 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=20240410170041.24963-2-nirmoy.das@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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