All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
@ 2023-06-15  2:12 vitaly.prosyak
  2023-06-15  2:12 ` [igt-dev] [PATCH 2/2] tests/amdgpu: add sync object tests vitaly.prosyak
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: vitaly.prosyak @ 2023-06-15  2:12 UTC (permalink / raw)
  To: igt-dev; +Cc: alexander.deucher, michael.strawbridge, christian.koenig

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

The tests do the validation the following bo features:
 - export/import
 - write/read metadata and then compare with original
 - map/unmap
 - alloc/free
 - find bo mapping

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Change-Id: Ica91b4bbc345c4760323b5c177c873129534b663
---
 meson.build              |   2 +-
 tests/amdgpu/amd_bo.c    | 291 +++++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build |   1 +
 3 files changed, 293 insertions(+), 1 deletion(-)
 create mode 100644 tests/amdgpu/amd_bo.c

diff --git a/meson.build b/meson.build
index 0487158dc..12269370a 100644
--- a/meson.build
+++ b/meson.build
@@ -4,7 +4,7 @@ project('igt-gpu-tools', 'c',
           'warning_level=2',
           'c_std=gnu11',
           'b_ndebug=false',
-          'buildtype=debugoptimized',
+          'buildtype=debug',
         ],
 	license : 'MIT',
 	meson_version : '>=0.47.2')
diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
new file mode 100644
index 000000000..9a95da237
--- /dev/null
+++ b/tests/amdgpu/amd_bo.c
@@ -0,0 +1,291 @@
+// SPDX-License-Identifier: MIT
+
+#include <stdio.h>
+#include <amdgpu.h>
+#include <amdgpu_drm.h>
+#include "igt.h"
+#include "lib/amdgpu/amd_memory.h"
+
+
+#define BUFFER_SIZE (4*1024)
+#define BUFFER_ALIGN (4*1024)
+
+struct bo_data {
+	amdgpu_bo_handle buffer_handle;
+	uint64_t virtual_mc_base_address;
+	amdgpu_va_handle va_handle;
+};
+
+static int
+amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	struct amdgpu_bo_alloc_request req = {0};
+	int r;
+
+	req.alloc_size = BUFFER_SIZE;
+	req.phys_alignment = BUFFER_ALIGN;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
+	if (r)
+		return r;
+
+	r = amdgpu_va_range_alloc(device_handle,
+				  amdgpu_gpu_va_range_general,
+				  BUFFER_SIZE, BUFFER_ALIGN, 0,
+				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
+	if (r)
+		goto error_va_alloc;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
+	if (r)
+		goto error_va_map;
+
+
+	return 0;
+
+error_va_map:
+	amdgpu_va_range_free(bo->va_handle);
+
+error_va_alloc:
+	amdgpu_bo_free(bo->buffer_handle);
+	return 1;
+}
+
+static void
+amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	int r;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			    bo->virtual_mc_base_address, 0,
+			    AMDGPU_VA_OP_UNMAP);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_va_range_free(bo->va_handle);
+	igt_assert_eq(r, 0);
+	r = amdgpu_bo_free(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
+		struct bo_data *bo, enum amdgpu_bo_handle_type type)
+{
+	struct amdgpu_bo_import_result res = {0};
+	uint32_t shared_handle;
+	int r;
+
+	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
+	igt_assert_eq(r, 0);
+
+	igt_assert(res.buf_handle == bo->buffer_handle);
+	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
+
+	r = amdgpu_bo_free(res.buf_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
+{
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_gem_flink_name);
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_dma_buf_fd);
+}
+
+static void
+amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
+{
+	struct amdgpu_bo_metadata meta = {0};
+	struct amdgpu_bo_info info = {0};
+	int r;
+
+	meta.size_metadata = 4;
+	meta.umd_metadata[0] = 0xdeadbeef;
+
+	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
+	igt_assert_eq(r, 0);
+
+	igt_assert_eq(info.metadata.size_metadata, 4);
+	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
+}
+
+static void
+amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
+{
+	uint32_t *ptr;
+	int i, r;
+
+	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
+	igt_assert_eq(r, 0);
+
+	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
+		ptr[i] = 0xdeadbeef;
+
+	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_memory_alloc(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo;
+	amdgpu_va_handle va_handle;
+	uint64_t bo_mc;
+
+	/* Test visible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test invisible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART cacheable */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			0, &bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART USWC */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GDS */
+	bo = gpu_mem_alloc(device_handle, 1024, 0,
+			AMDGPU_GEM_DOMAIN_GDS, 0,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test GWS */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_GWS, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test OA */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_OA, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+}
+
+static void
+amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
+{
+	int r;
+	struct amdgpu_bo_alloc_request req = {0};
+	amdgpu_bo_handle buf_handle;
+
+	/* Test impossible mem allocation, 1TB */
+	req.alloc_size = 0xE8D4A51000;
+	req.phys_alignment = 4096;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
+	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
+	igt_assert_eq(r, -ENOMEM);
+
+	if (!r) {
+		r = amdgpu_bo_free(buf_handle);
+		igt_assert_eq(r, 0);
+	}
+}
+
+static void
+amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo_handle, find_bo_handle;
+	amdgpu_va_handle va_handle;
+	void *bo_cpu;
+	uint64_t bo_mc_address;
+	uint64_t offset;
+	int r;
+
+	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
+				    AMDGPU_GEM_DOMAIN_GTT, 0,
+				    &bo_handle, &bo_cpu,
+				    &bo_mc_address, &va_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
+					  bo_cpu,
+					  4096,
+					  &find_bo_handle,
+					  &offset);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(offset, 0);
+
+	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
+				     bo_mc_address, 4096);
+}
+
+igt_main
+{
+	amdgpu_device_handle device;
+	struct bo_data bo;
+	int fd = -1;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+		err = amdgpu_device_initialize(fd, &major, &minor, &device);
+		igt_require(err == 0);
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+
+		amdgpu_bo_init(device, &bo);
+	}
+
+	igt_subtest("amdgpu_bo_export_import")
+	amdgpu_bo_export_import(device, &bo);
+
+	igt_subtest("amdgpu_bo_metadata")
+	amdgpu_bo_metadata(device, &bo);
+
+	igt_subtest("amdgpu_bo_map_unmap")
+	amdgpu_bo_map_unmap(device, &bo);
+
+	igt_subtest("amdgpu_memory_alloc")
+	amdgpu_memory_alloc(device);
+
+	igt_subtest("amdgpu_mem_fail_alloc")
+	amdgpu_mem_fail_alloc(device);
+
+	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
+	amdgpu_bo_find_by_cpu_mapping(device);
+
+	igt_fixture {
+		amdgpu_bo_clean(device, &bo);
+		amdgpu_device_deinitialize(device);
+		close(fd);
+	}
+}
+
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index 7fff7602f..43326a7c4 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
 	amdgpu_progs += [ 'amd_abm',
 			  'amd_assr',
 			  'amd_basic',
+			  'amd_bo',
 			  'amd_bypass',
 			  'amd_deadlock',
 			  'amd_pci_unplug',
-- 
2.25.1

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

* [igt-dev] [PATCH 2/2] tests/amdgpu: add sync object tests
  2023-06-15  2:12 [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests vitaly.prosyak
@ 2023-06-15  2:12 ` vitaly.prosyak
  2023-06-15  2:38 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [1/2] tests/amdgpu: add bo tests Patchwork
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: vitaly.prosyak @ 2023-06-15  2:12 UTC (permalink / raw)
  To: igt-dev; +Cc: alexander.deucher, michael.strawbridge, christian.koenig

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

Using worker thread to wait on point and then signal point on other thread.
Another test uses a worker thread to signal point and wait on the main
thread using amdgpu_cs_syncobj_timeline_wait.

The command consists of two chunks :
1. AMDGPU_CHUNK_ID_IB uses GFX_COMPUTE_NOP  or SDMA_NOP.
2. The second chunk is AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT
   or AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL which has the
   point number .

v1->v2. Fixed style issues - Christian.
        Fixed formatting issues - Kamil.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Acked-by Christian Koenig <christian.koenig@amd.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Change-Id: I766a36d4e9a416784960f0100683ce014f8bfa14
---
 tests/amdgpu/amd_syncobj.c | 266 +++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build   |   1 +
 2 files changed, 267 insertions(+)
 create mode 100644 tests/amdgpu/amd_syncobj.c

diff --git a/tests/amdgpu/amd_syncobj.c b/tests/amdgpu/amd_syncobj.c
new file mode 100644
index 000000000..df22eeee3
--- /dev/null
+++ b/tests/amdgpu/amd_syncobj.c
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: MIT
+
+#include <pthread.h>
+#include <amdgpu.h>
+#include <amdgpu_drm.h>
+
+#include "igt.h"
+#include "lib/amdgpu/amd_PM4.h"
+#include "lib/amdgpu/amd_sdma.h"
+#include "lib/amdgpu/amd_memory.h"
+
+struct syncobj_point {
+	amdgpu_device_handle device;
+	uint32_t syncobj_handle;
+	uint64_t point;
+};
+
+
+static bool
+syncobj_timeline_enable(int fd)
+{
+	int r;
+	bool ret = false;
+	uint64_t cap = 0;
+
+	r = drmGetCap(fd, DRM_CAP_SYNCOBJ_TIMELINE, &cap);
+	if (r || cap == 0)
+		return ret;
+	ret = true;
+
+	return ret;
+}
+
+static void
+syncobj_command_submission_helper(amdgpu_device_handle device_handle,
+		uint32_t syncobj_handle, bool wait_or_signal, uint64_t point)
+{
+	amdgpu_context_handle context_handle;
+	amdgpu_bo_handle ib_result_handle;
+	void *ib_result_cpu;
+	uint64_t ib_result_mc_address;
+	struct drm_amdgpu_cs_chunk chunks[2];
+	struct drm_amdgpu_cs_chunk_data chunk_data;
+	struct drm_amdgpu_cs_chunk_syncobj syncobj_data;
+	struct amdgpu_cs_fence fence_status;
+	amdgpu_bo_list_handle bo_list;
+	amdgpu_va_handle va_handle;
+	uint32_t expired;
+	int i, r;
+	uint64_t seq_no;
+	uint32_t *ptr;
+
+	r = amdgpu_cs_ctx_create(device_handle, &context_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
+				    AMDGPU_GEM_DOMAIN_GTT, 0,
+				    &ib_result_handle, &ib_result_cpu,
+				    &ib_result_mc_address, &va_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_get_bo_list(device_handle, ib_result_handle, NULL, &bo_list);
+	igt_assert_eq(r, 0);
+
+	ptr = ib_result_cpu;
+
+	for (i = 0; i < 16; ++i)
+		ptr[i] = wait_or_signal ? GFX_COMPUTE_NOP : SDMA_NOP;
+
+	chunks[0].chunk_id = AMDGPU_CHUNK_ID_IB;
+	chunks[0].length_dw = sizeof(struct drm_amdgpu_cs_chunk_ib) / 4;
+	chunks[0].chunk_data = (uint64_t)(uintptr_t)&chunk_data;
+	chunk_data.ib_data._pad = 0;
+	chunk_data.ib_data.va_start = ib_result_mc_address;
+	chunk_data.ib_data.ib_bytes = 16 * 4;
+	chunk_data.ib_data.ip_type = wait_or_signal ? AMDGPU_HW_IP_GFX : AMDGPU_HW_IP_DMA;
+	chunk_data.ib_data.ip_instance = 0;
+	chunk_data.ib_data.ring = 0;
+	chunk_data.ib_data.flags = 0;
+
+	chunks[1].chunk_id = wait_or_signal ?
+		AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT :
+		AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL;
+	chunks[1].length_dw = sizeof(struct drm_amdgpu_cs_chunk_syncobj) / 4;
+	chunks[1].chunk_data = (uint64_t)(uintptr_t)&syncobj_data;
+	syncobj_data.handle = syncobj_handle;
+	syncobj_data.point = point;
+	syncobj_data.flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
+
+	r = amdgpu_cs_submit_raw(device_handle,
+				 context_handle,
+				 bo_list,
+				 2,
+				 chunks,
+				 &seq_no);
+	igt_assert_eq(r, 0);
+
+	memset(&fence_status, 0, sizeof(struct amdgpu_cs_fence));
+	fence_status.context = context_handle;
+	fence_status.ip_type = wait_or_signal ? AMDGPU_HW_IP_GFX : AMDGPU_HW_IP_DMA;
+	fence_status.ip_instance = 0;
+	fence_status.ring = 0;
+	fence_status.fence = seq_no;
+
+	r = amdgpu_cs_query_fence_status(&fence_status,
+			AMDGPU_TIMEOUT_INFINITE, 0, &expired);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_list_destroy(bo_list);
+	igt_assert_eq(r, 0);
+
+	amdgpu_bo_unmap_and_free(ib_result_handle, va_handle,
+				     ib_result_mc_address, 4096);
+
+	r = amdgpu_cs_ctx_free(context_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void *
+syncobj_wait(void *data)
+{
+	struct syncobj_point *sp = (struct syncobj_point *)data;
+	int r;
+
+	r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, true,
+					      sp->point);
+	igt_assert_eq(r, 0);
+
+	return (void *)(long)r;
+}
+
+static void *
+syncobj_signal(void *data)
+{
+	struct syncobj_point *sp = (struct syncobj_point *)data;
+	int r;
+
+	r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, false,
+			sp->point);
+	igt_assert_eq(r, 0);
+
+	return (void *)(long)r;
+}
+
+static void
+amdgpu_syncobj_timeline(amdgpu_device_handle device_handle)
+{
+	static pthread_t wait_thread;
+	static pthread_t signal_thread;
+	static pthread_t c_thread;
+	struct syncobj_point sp1, sp2, sp3;
+	uint32_t syncobj_handle;
+	uint64_t payload;
+	uint64_t wait_point, signal_point;
+	uint64_t timeout;
+	struct timespec tp;
+	int r, sync_fd;
+	void *tmp, *tmp2;
+
+	r =  amdgpu_cs_create_syncobj2(device_handle, 0, &syncobj_handle);
+	igt_assert_eq(r, 0);
+
+	// wait on point 5
+	sp1.syncobj_handle = syncobj_handle;
+	sp1.device = device_handle;
+	sp1.point = 5;
+	r = pthread_create(&wait_thread, NULL, syncobj_wait, &sp1);
+	igt_assert_eq(r, 0);
+
+	// signal on point 10
+	sp2.syncobj_handle = syncobj_handle;
+	sp2.device = device_handle;
+	sp2.point = 10;
+	r = pthread_create(&signal_thread, NULL, syncobj_signal, &sp2);
+	igt_assert_eq(r, 0);
+
+	r = pthread_join(signal_thread, &tmp);
+	igt_assert_eq(r, 0);
+
+	r = pthread_join(wait_thread, &tmp2);
+	igt_assert_eq(r, 0);
+
+	//query timeline payload
+	r = amdgpu_cs_syncobj_query(device_handle, &syncobj_handle,
+				    &payload, 1);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(payload, 10);
+
+	//signal on point 16
+	sp3.syncobj_handle = syncobj_handle;
+	sp3.device = device_handle;
+	sp3.point = 16;
+	r = pthread_create(&c_thread, NULL, syncobj_signal, &sp3);
+	igt_assert_eq(r, 0);
+
+	//CPU wait on point 16
+	wait_point = 16;
+	timeout = 0;
+	clock_gettime(CLOCK_MONOTONIC, &tp);
+	timeout = tp.tv_sec * 1000000000ULL + tp.tv_nsec;
+	timeout += 10000000000; //10s
+	r = amdgpu_cs_syncobj_timeline_wait(device_handle, &syncobj_handle,
+					    &wait_point, 1, timeout,
+					    DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |
+					    DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT,
+					    NULL);
+
+	igt_assert_eq(r, 0);
+	r = pthread_join(c_thread, &tmp);
+	igt_assert_eq(r, 0);
+
+	// export point 16 and import to point 18
+	r = amdgpu_cs_syncobj_export_sync_file2(device_handle, syncobj_handle,
+						16,
+						DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT,
+						&sync_fd);
+	igt_assert_eq(r, 0);
+	r = amdgpu_cs_syncobj_import_sync_file2(device_handle, syncobj_handle,
+						18, sync_fd);
+	igt_assert_eq(r, 0);
+	r = amdgpu_cs_syncobj_query(device_handle, &syncobj_handle,
+				    &payload, 1);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(payload, 18);
+
+	// CPU signal on point 20
+	signal_point = 20;
+	r = amdgpu_cs_syncobj_timeline_signal(device_handle, &syncobj_handle,
+					      &signal_point, 1);
+	igt_assert_eq(r, 0);
+	r = amdgpu_cs_syncobj_query(device_handle, &syncobj_handle,
+				    &payload, 1);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(payload, 20);
+
+	r = amdgpu_cs_destroy_syncobj(device_handle, syncobj_handle);
+	igt_assert_eq(r, 0);
+
+}
+
+igt_main
+{
+	amdgpu_device_handle device;
+	int fd = -1;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+		err = amdgpu_device_initialize(fd, &major, &minor, &device);
+		igt_require(err == 0);
+		igt_require(syncobj_timeline_enable(fd));
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+
+	}
+
+	igt_subtest("amdgpu_syncobj_timeline")
+	amdgpu_syncobj_timeline(device);
+
+	igt_fixture {
+		amdgpu_device_deinitialize(device);
+		close(fd);
+	}
+}
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index 43326a7c4..576d242c5 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -6,6 +6,7 @@ if libdrm_amdgpu.found()
 			  'amd_assr',
 			  'amd_basic',
 			  'amd_bo',
+			  'amd_syncobj',
 			  'amd_bypass',
 			  'amd_deadlock',
 			  'amd_pci_unplug',
-- 
2.25.1

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

* [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [1/2] tests/amdgpu: add bo tests
  2023-06-15  2:12 [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests vitaly.prosyak
  2023-06-15  2:12 ` [igt-dev] [PATCH 2/2] tests/amdgpu: add sync object tests vitaly.prosyak
@ 2023-06-15  2:38 ` Patchwork
  2023-06-15  7:53 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
  2023-06-28 21:07 ` [igt-dev] [PATCH 1/2] " Kamil Konieczny
  3 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2023-06-15  2:38 UTC (permalink / raw)
  To: vitaly.prosyak; +Cc: igt-dev

== Series Details ==

Series: series starting with [1/2] tests/amdgpu: add bo tests
URL   : https://patchwork.freedesktop.org/series/119357/
State : warning

== Summary ==

Pipeline status: FAILED.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/909493 for the overview.

build:tests-debian-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43797037):
        amdgpu_cs_syncobj_export_sync_file
  ../tests/amdgpu/amd_syncobj.c:213:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_export_sync_file2’ [-Wnested-externs]
  ../tests/amdgpu/amd_syncobj.c:218:6: error: implicit declaration of function ‘amdgpu_cs_syncobj_import_sync_file2’; did you mean ‘amdgpu_cs_syncobj_import_sync_file’? [-Werror=implicit-function-declaration]
    r = amdgpu_cs_syncobj_import_sync_file2(device_handle, syncobj_handle,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        amdgpu_cs_syncobj_import_sync_file
  ../tests/amdgpu/amd_syncobj.c:218:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_import_sync_file2’ [-Wnested-externs]
  ../tests/amdgpu/amd_syncobj.c:228:6: error: implicit declaration of function ‘amdgpu_cs_syncobj_timeline_signal’; did you mean ‘amdgpu_cs_syncobj_signal’? [-Werror=implicit-function-declaration]
    r = amdgpu_cs_syncobj_timeline_signal(device_handle, &syncobj_handle,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        amdgpu_cs_syncobj_signal
  ../tests/amdgpu/amd_syncobj.c:228:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_timeline_signal’ [-Wnested-externs]
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1686796480:step_script
  section_start:1686796480:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1686796481:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-debian-meson-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43797040):
        amdgpu_cs_syncobj_export_sync_file
  ../tests/amdgpu/amd_syncobj.c:213:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_export_sync_file2’ [-Wnested-externs]
  ../tests/amdgpu/amd_syncobj.c:218:6: error: implicit declaration of function ‘amdgpu_cs_syncobj_import_sync_file2’; did you mean ‘amdgpu_cs_syncobj_import_sync_file’? [-Werror=implicit-function-declaration]
    r = amdgpu_cs_syncobj_import_sync_file2(device_handle, syncobj_handle,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        amdgpu_cs_syncobj_import_sync_file
  ../tests/amdgpu/amd_syncobj.c:218:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_import_sync_file2’ [-Wnested-externs]
  ../tests/amdgpu/amd_syncobj.c:228:6: error: implicit declaration of function ‘amdgpu_cs_syncobj_timeline_signal’; did you mean ‘amdgpu_cs_syncobj_signal’? [-Werror=implicit-function-declaration]
    r = amdgpu_cs_syncobj_timeline_signal(device_handle, &syncobj_handle,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        amdgpu_cs_syncobj_signal
  ../tests/amdgpu/amd_syncobj.c:228:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_timeline_signal’ [-Wnested-externs]
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1686796487:step_script
  section_start:1686796487:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1686796490:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-debian-meson-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43797039):
        amdgpu_cs_syncobj_export_sync_file
  ../tests/amdgpu/amd_syncobj.c:213:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_export_sync_file2’ [-Wnested-externs]
  ../tests/amdgpu/amd_syncobj.c:218:6: error: implicit declaration of function ‘amdgpu_cs_syncobj_import_sync_file2’; did you mean ‘amdgpu_cs_syncobj_import_sync_file’? [-Werror=implicit-function-declaration]
    r = amdgpu_cs_syncobj_import_sync_file2(device_handle, syncobj_handle,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        amdgpu_cs_syncobj_import_sync_file
  ../tests/amdgpu/amd_syncobj.c:218:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_import_sync_file2’ [-Wnested-externs]
  ../tests/amdgpu/amd_syncobj.c:228:6: error: implicit declaration of function ‘amdgpu_cs_syncobj_timeline_signal’; did you mean ‘amdgpu_cs_syncobj_signal’? [-Werror=implicit-function-declaration]
    r = amdgpu_cs_syncobj_timeline_signal(device_handle, &syncobj_handle,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        amdgpu_cs_syncobj_signal
  ../tests/amdgpu/amd_syncobj.c:228:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_timeline_signal’ [-Wnested-externs]
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1686796496:step_script
  section_start:1686796496:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1686796497:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-debian-meson-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43797041):
        amdgpu_cs_syncobj_export_sync_file
  ../tests/amdgpu/amd_syncobj.c:213:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_export_sync_file2’ [-Wnested-externs]
  ../tests/amdgpu/amd_syncobj.c:218:6: error: implicit declaration of function ‘amdgpu_cs_syncobj_import_sync_file2’; did you mean ‘amdgpu_cs_syncobj_import_sync_file’? [-Werror=implicit-function-declaration]
    r = amdgpu_cs_syncobj_import_sync_file2(device_handle, syncobj_handle,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        amdgpu_cs_syncobj_import_sync_file
  ../tests/amdgpu/amd_syncobj.c:218:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_import_sync_file2’ [-Wnested-externs]
  ../tests/amdgpu/amd_syncobj.c:228:6: error: implicit declaration of function ‘amdgpu_cs_syncobj_timeline_signal’; did you mean ‘amdgpu_cs_syncobj_signal’? [-Werror=implicit-function-declaration]
    r = amdgpu_cs_syncobj_timeline_signal(device_handle, &syncobj_handle,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        amdgpu_cs_syncobj_signal
  ../tests/amdgpu/amd_syncobj.c:228:6: warning: nested extern declaration of ‘amdgpu_cs_syncobj_timeline_signal’ [-Wnested-externs]
  cc1: some warnings being treated as errors
  ninja: build stopped: subcommand failed.
  section_end:1686796495:step_script
  section_start:1686796495:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1686796496:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43797032):
  ninja: Entering directory `build'
  [1/665] Generating version.h with a custom command.
  [2/329] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o'.
  FAILED: tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o 
  cc -Itests/amdgpu/b9f2b1d@@amd_syncobj@exe -Itests/amdgpu -I../tests/amdgpu -I../include -I../include/drm-uapi -I../include/linux-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -g -D_GNU_SOURCE -include config.h -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o' -c ../tests/amdgpu/amd_syncobj.c
  ../tests/amdgpu/amd_syncobj.c: In function ‘syncobj_wait’:
  ../tests/amdgpu/amd_syncobj.c:125:4: error: void value not ignored as it ought to be
    125 |  r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, true,
        |    ^
  ../tests/amdgpu/amd_syncobj.c: In function ‘syncobj_signal’:
  ../tests/amdgpu/amd_syncobj.c:138:4: error: void value not ignored as it ought to be
    138 |  r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, false,
        |    ^
  ninja: build stopped: subcommand failed.
  section_end:1686796479:step_script
  section_start:1686796479:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1686796481:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43797036):
  ninja: build stopped: subcommand failed.
  ninja: Entering directory `build'
  [1/667] Generating version.h with a custom command.
  [2/331] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o'.
  FAILED: tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o 
  clang -Itests/amdgpu/b9f2b1d@@amd_syncobj@exe -Itests/amdgpu -I../tests/amdgpu -I../include -I../include/drm-uapi -I../include/linux-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -g -D_GNU_SOURCE -include config.h -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o' -c ../tests/amdgpu/amd_syncobj.c
  ../tests/amdgpu/amd_syncobj.c:125:4: error: assigning to 'int' from incompatible type 'void'
          r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, true,
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../tests/amdgpu/amd_syncobj.c:138:4: error: assigning to 'int' from incompatible type 'void'
          r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, false,
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2 errors generated.
  ninja: build stopped: subcommand failed.
  section_end:1686796489:step_script
  section_start:1686796489:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1686796492:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-no-libunwind has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43797033):
  ninja: Entering directory `build'
  [1/668] Generating version.h with a custom command.
  [2/333] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o'.
  FAILED: tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o 
  cc -Itests/amdgpu/b9f2b1d@@amd_syncobj@exe -Itests/amdgpu -I../tests/amdgpu -I../include -I../include/drm-uapi -I../include/linux-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I../lib/stubs/libunwind -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -g -D_GNU_SOURCE -include config.h -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_syncobj@exe/amd_syncobj.c.o' -c ../tests/amdgpu/amd_syncobj.c
  ../tests/amdgpu/amd_syncobj.c: In function ‘syncobj_wait’:
  ../tests/amdgpu/amd_syncobj.c:125:4: error: void value not ignored as it ought to be
    125 |  r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, true,
        |    ^
  ../tests/amdgpu/amd_syncobj.c: In function ‘syncobj_signal’:
  ../tests/amdgpu/amd_syncobj.c:138:4: error: void value not ignored as it ought to be
    138 |  r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, false,
        |    ^
  ninja: build stopped: subcommand failed.
  section_end:1686796479:step_script
  section_start:1686796479:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1686796481:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-oldest-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43797034):
  ninja: Entering directory `build'
  [1/664] Generating version.h with a custom command.
  [2/329] Compiling C object 'tests/amdgpu/tests@amdgpu@@amd_syncobj@exe/amd_syncobj.c.o'.
  FAILED: tests/amdgpu/tests@amdgpu@@amd_syncobj@exe/amd_syncobj.c.o 
  cc -Itests/amdgpu/tests@amdgpu@@amd_syncobj@exe -Itests/amdgpu -I../tests/amdgpu -I../include -I../include/drm-uapi -I../include/linux-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -D_GNU_SOURCE -include config.h -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -pthread  -MD -MQ 'tests/amdgpu/tests@amdgpu@@amd_syncobj@exe/amd_syncobj.c.o' -MF 'tests/amdgpu/tests@amdgpu@@amd_syncobj@exe/amd_syncobj.c.o.d' -o 'tests/amdgpu/tests@amdgpu@@amd_syncobj@exe/amd_syncobj.c.o' -c ../tests/amdgpu/amd_syncobj.c
  ../tests/amdgpu/amd_syncobj.c: In function ‘syncobj_wait’:
  ../tests/amdgpu/amd_syncobj.c:125:4: error: void value not ignored as it ought to be
    125 |  r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, true,
        |    ^
  ../tests/amdgpu/amd_syncobj.c: In function ‘syncobj_signal’:
  ../tests/amdgpu/amd_syncobj.c:138:4: error: void value not ignored as it ought to be
    138 |  r = syncobj_command_submission_helper(sp->device, sp->syncobj_handle, false,
        |    ^
  ninja: build stopped: subcommand failed.
  section_end:1686796477:step_script
  section_start:1686796477:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1686796479:cleanup_file_variables
  ERROR: Job failed: exit code 1

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/909493

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

* [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/2] tests/amdgpu: add bo tests
  2023-06-15  2:12 [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests vitaly.prosyak
  2023-06-15  2:12 ` [igt-dev] [PATCH 2/2] tests/amdgpu: add sync object tests vitaly.prosyak
  2023-06-15  2:38 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [1/2] tests/amdgpu: add bo tests Patchwork
@ 2023-06-15  7:53 ` Patchwork
  2023-06-28 21:07 ` [igt-dev] [PATCH 1/2] " Kamil Konieczny
  3 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2023-06-15  7:53 UTC (permalink / raw)
  To: vitaly.prosyak; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 32103 bytes --]

== Series Details ==

Series: series starting with [1/2] tests/amdgpu: add bo tests
URL   : https://patchwork.freedesktop.org/series/119357/
State : failure

== Summary ==

CI Bug Log - changes from IGT_7330 -> IGTPW_9173
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_9173 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_9173, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/index.html

Participating hosts (43 -> 42)
------------------------------

  Missing    (1): fi-snb-2520m 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_9173:

### IGT changes ###

#### Possible regressions ####

  * igt@core_hotunplug@unbind-rebind:
    - fi-cfl-guc:         [PASS][1] -> [WARN][2] +1 similar issue
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-cfl-guc/igt@core_hotunplug@unbind-rebind.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-cfl-guc/igt@core_hotunplug@unbind-rebind.html
    - bat-mtlp-6:         [PASS][3] -> [WARN][4] +1 similar issue
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-6/igt@core_hotunplug@unbind-rebind.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-6/igt@core_hotunplug@unbind-rebind.html
    - fi-kbl-x1275:       [PASS][5] -> [WARN][6] +1 similar issue
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-x1275/igt@core_hotunplug@unbind-rebind.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-x1275/igt@core_hotunplug@unbind-rebind.html
    - fi-skl-guc:         [PASS][7] -> [WARN][8] +1 similar issue
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-skl-guc/igt@core_hotunplug@unbind-rebind.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-skl-guc/igt@core_hotunplug@unbind-rebind.html
    - fi-kbl-guc:         [PASS][9] -> [WARN][10] +1 similar issue
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-guc/igt@core_hotunplug@unbind-rebind.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-guc/igt@core_hotunplug@unbind-rebind.html
    - bat-adlm-1:         [PASS][11] -> [WARN][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adlm-1/igt@core_hotunplug@unbind-rebind.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adlm-1/igt@core_hotunplug@unbind-rebind.html
    - bat-mtlp-8:         [PASS][13] -> [WARN][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-8/igt@core_hotunplug@unbind-rebind.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-8/igt@core_hotunplug@unbind-rebind.html
    - bat-rpls-1:         [PASS][15] -> [WARN][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-rpls-1/igt@core_hotunplug@unbind-rebind.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-1/igt@core_hotunplug@unbind-rebind.html
    - fi-rkl-11600:       [PASS][17] -> [WARN][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-rkl-11600/igt@core_hotunplug@unbind-rebind.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-rkl-11600/igt@core_hotunplug@unbind-rebind.html
    - bat-dg1-5:          [PASS][19] -> [WARN][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg1-5/igt@core_hotunplug@unbind-rebind.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg1-5/igt@core_hotunplug@unbind-rebind.html
    - bat-dg1-7:          [PASS][21] -> [WARN][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg1-7/igt@core_hotunplug@unbind-rebind.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg1-7/igt@core_hotunplug@unbind-rebind.html

  * igt@gem_lmem_swapping@basic:
    - bat-atsm-1:         NOTRUN -> [FAIL][23] +2 similar issues
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-atsm-1/igt@gem_lmem_swapping@basic.html
    - bat-dg2-11:         NOTRUN -> [FAIL][24] +1 similar issue
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-11/igt@gem_lmem_swapping@basic.html
    - bat-dg2-8:          NOTRUN -> [FAIL][25] +3 similar issues
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-8/igt@gem_lmem_swapping@basic.html
    - bat-dg1-7:          NOTRUN -> [FAIL][26]
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg1-7/igt@gem_lmem_swapping@basic.html

  * igt@gem_lmem_swapping@random-engines:
    - bat-dg1-5:          NOTRUN -> [FAIL][27] +1 similar issue
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg1-5/igt@gem_lmem_swapping@random-engines.html

  * igt@i915_module_load@reload:
    - bat-adlp-9:         [PASS][28] -> [WARN][29]
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adlp-9/igt@i915_module_load@reload.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adlp-9/igt@i915_module_load@reload.html
    - fi-kbl-7567u:       [PASS][30] -> [WARN][31]
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-7567u/igt@i915_module_load@reload.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-7567u/igt@i915_module_load@reload.html
    - bat-adls-5:         [PASS][32] -> [WARN][33]
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adls-5/igt@i915_module_load@reload.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adls-5/igt@i915_module_load@reload.html
    - fi-cfl-8109u:       [PASS][34] -> [WARN][35] +1 similar issue
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-cfl-8109u/igt@i915_module_load@reload.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-cfl-8109u/igt@i915_module_load@reload.html
    - fi-tgl-1115g4:      [PASS][36] -> [WARN][37]
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-tgl-1115g4/igt@i915_module_load@reload.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-tgl-1115g4/igt@i915_module_load@reload.html
    - bat-kbl-2:          [PASS][38] -> [WARN][39]
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-kbl-2/igt@i915_module_load@reload.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-kbl-2/igt@i915_module_load@reload.html
    - bat-atsm-1:         [PASS][40] -> [WARN][41]
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-atsm-1/igt@i915_module_load@reload.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-atsm-1/igt@i915_module_load@reload.html
    - fi-hsw-4770:        [PASS][42] -> [WARN][43]
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-hsw-4770/igt@i915_module_load@reload.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-hsw-4770/igt@i915_module_load@reload.html
    - fi-ivb-3770:        [PASS][44] -> [WARN][45]
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-ivb-3770/igt@i915_module_load@reload.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-ivb-3770/igt@i915_module_load@reload.html
    - bat-dg2-8:          [PASS][46] -> [WARN][47]
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-8/igt@i915_module_load@reload.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-8/igt@i915_module_load@reload.html

  * igt@i915_pm_rpm@module-reload:
    - fi-bsw-nick:        [PASS][48] -> [FAIL][49]
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-bsw-nick/igt@i915_pm_rpm@module-reload.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-bsw-nick/igt@i915_pm_rpm@module-reload.html
    - fi-apl-guc:         [PASS][50] -> [FAIL][51] +1 similar issue
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-apl-guc/igt@i915_pm_rpm@module-reload.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-apl-guc/igt@i915_pm_rpm@module-reload.html
    - bat-jsl-3:          [PASS][52] -> [FAIL][53]
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-jsl-3/igt@i915_pm_rpm@module-reload.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-jsl-3/igt@i915_pm_rpm@module-reload.html
    - fi-kbl-soraka:      [PASS][54] -> [FAIL][55]
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-soraka/igt@i915_pm_rpm@module-reload.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-soraka/igt@i915_pm_rpm@module-reload.html
    - bat-mtlp-8:         [PASS][56] -> [FAIL][57]
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-8/igt@i915_pm_rpm@module-reload.html
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-8/igt@i915_pm_rpm@module-reload.html
    - bat-dg2-8:          [PASS][58] -> [FAIL][59]
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-8/igt@i915_pm_rpm@module-reload.html
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-8/igt@i915_pm_rpm@module-reload.html
    - bat-adlm-1:         [PASS][60] -> [FAIL][61] +1 similar issue
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adlm-1/igt@i915_pm_rpm@module-reload.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adlm-1/igt@i915_pm_rpm@module-reload.html
    - bat-jsl-1:          [PASS][62] -> [FAIL][63]
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-jsl-1/igt@i915_pm_rpm@module-reload.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-jsl-1/igt@i915_pm_rpm@module-reload.html
    - fi-bsw-n3050:       [PASS][64] -> [WARN][65]
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-bsw-n3050/igt@i915_pm_rpm@module-reload.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-bsw-n3050/igt@i915_pm_rpm@module-reload.html
    - bat-dg2-9:          [PASS][66] -> [FAIL][67]
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-9/igt@i915_pm_rpm@module-reload.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-9/igt@i915_pm_rpm@module-reload.html
    - fi-kbl-x1275:       [PASS][68] -> [FAIL][69]
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
    - fi-cfl-8109u:       [PASS][70] -> [FAIL][71]
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-cfl-8109u/igt@i915_pm_rpm@module-reload.html
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-cfl-8109u/igt@i915_pm_rpm@module-reload.html
    - fi-kbl-7567u:       [PASS][72] -> [FAIL][73]
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-7567u/igt@i915_pm_rpm@module-reload.html
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-7567u/igt@i915_pm_rpm@module-reload.html
    - bat-mtlp-6:         [PASS][74] -> [FAIL][75]
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-6/igt@i915_pm_rpm@module-reload.html
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-6/igt@i915_pm_rpm@module-reload.html
    - fi-cfl-8700k:       [PASS][76] -> [FAIL][77]
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-cfl-8700k/igt@i915_pm_rpm@module-reload.html
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-cfl-8700k/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live:
    - bat-dg2-9:          NOTRUN -> [SKIP][78]
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-9/igt@i915_selftest@live.html

  * igt@i915_selftest@live@gem_contexts:
    - bat-mtlp-8:         [PASS][79] -> [INCOMPLETE][80]
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-8/igt@i915_selftest@live@gem_contexts.html
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-8/igt@i915_selftest@live@gem_contexts.html

  * igt@i915_selftest@live@sanitycheck:
    - fi-ilk-650:         [PASS][81] -> [WARN][82] +1 similar issue
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-ilk-650/igt@i915_selftest@live@sanitycheck.html
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-ilk-650/igt@i915_selftest@live@sanitycheck.html
    - fi-blb-e6850:       [PASS][83] -> [WARN][84] +1 similar issue
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-blb-e6850/igt@i915_selftest@live@sanitycheck.html
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-blb-e6850/igt@i915_selftest@live@sanitycheck.html
    - fi-cfl-8700k:       [PASS][85] -> [WARN][86]
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-cfl-8700k/igt@i915_selftest@live@sanitycheck.html
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-cfl-8700k/igt@i915_selftest@live@sanitycheck.html

  * igt@i915_suspend@basic-s2idle-without-i915:
    - fi-rkl-11600:       [PASS][87] -> [FAIL][88]
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-rkl-11600/igt@i915_suspend@basic-s2idle-without-i915.html
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-rkl-11600/igt@i915_suspend@basic-s2idle-without-i915.html
    - bat-adls-5:         [PASS][89] -> [FAIL][90]
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adls-5/igt@i915_suspend@basic-s2idle-without-i915.html
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adls-5/igt@i915_suspend@basic-s2idle-without-i915.html
    - bat-dg1-5:          [PASS][91] -> [FAIL][92]
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg1-5/igt@i915_suspend@basic-s2idle-without-i915.html
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg1-5/igt@i915_suspend@basic-s2idle-without-i915.html
    - fi-pnv-d510:        [PASS][93] -> [FAIL][94]
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-pnv-d510/igt@i915_suspend@basic-s2idle-without-i915.html
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-pnv-d510/igt@i915_suspend@basic-s2idle-without-i915.html
    - bat-adlp-9:         [PASS][95] -> [FAIL][96]
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adlp-9/igt@i915_suspend@basic-s2idle-without-i915.html
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adlp-9/igt@i915_suspend@basic-s2idle-without-i915.html

  * igt@i915_suspend@basic-s3-without-i915:
    - fi-blb-e6850:       [PASS][97] -> [FAIL][98]
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-blb-e6850/igt@i915_suspend@basic-s3-without-i915.html
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-blb-e6850/igt@i915_suspend@basic-s3-without-i915.html

  * igt@vgem_basic@unload:
    - bat-mtlp-6:         [PASS][99] -> [SKIP][100]
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-6/igt@vgem_basic@unload.html
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-6/igt@vgem_basic@unload.html
    - bat-atsm-1:         [PASS][101] -> [SKIP][102]
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-atsm-1/igt@vgem_basic@unload.html
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-atsm-1/igt@vgem_basic@unload.html
    - fi-hsw-4770:        [PASS][103] -> [FAIL][104]
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-hsw-4770/igt@vgem_basic@unload.html
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-hsw-4770/igt@vgem_basic@unload.html
    - fi-ivb-3770:        [PASS][105] -> [FAIL][106]
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-ivb-3770/igt@vgem_basic@unload.html
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-ivb-3770/igt@vgem_basic@unload.html
    - bat-dg2-8:          [PASS][107] -> [SKIP][108]
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-8/igt@vgem_basic@unload.html
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-8/igt@vgem_basic@unload.html
    - bat-rpls-1:         [PASS][109] -> [SKIP][110]
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-rpls-1/igt@vgem_basic@unload.html
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-1/igt@vgem_basic@unload.html
    - bat-dg1-7:          [PASS][111] -> [SKIP][112]
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg1-7/igt@vgem_basic@unload.html
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg1-7/igt@vgem_basic@unload.html
    - fi-glk-j4005:       [PASS][113] -> [FAIL][114] +1 similar issue
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-glk-j4005/igt@vgem_basic@unload.html
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-glk-j4005/igt@vgem_basic@unload.html
    - bat-dg1-5:          [PASS][115] -> [SKIP][116]
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg1-5/igt@vgem_basic@unload.html
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg1-5/igt@vgem_basic@unload.html

  
#### Warnings ####

  * igt@i915_suspend@basic-s3-without-i915:
    - bat-atsm-1:         [SKIP][117] ([i915#6645]) -> [FAIL][118]
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-atsm-1/igt@i915_suspend@basic-s3-without-i915.html
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-atsm-1/igt@i915_suspend@basic-s3-without-i915.html

  
Known issues
------------

  Here are the changes found in IGTPW_9173 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@core_auth@basic-auth:
    - bat-adlp-11:        [PASS][119] -> [ABORT][120] ([i915#8011])
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adlp-11/igt@core_auth@basic-auth.html
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adlp-11/igt@core_auth@basic-auth.html

  * igt@gem_exec_suspend@basic-s0@smem:
    - bat-rpls-2:         NOTRUN -> [ABORT][121] ([i915#6687] / [i915#7964])
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-2/igt@gem_exec_suspend@basic-s0@smem.html

  * igt@gem_exec_suspend@basic-s3@smem:
    - bat-rpls-1:         NOTRUN -> [ABORT][122] ([i915#6687] / [i915#7978])
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-1/igt@gem_exec_suspend@basic-s3@smem.html

  * igt@i915_module_load@load:
    - bat-adlp-11:        [PASS][123] -> [DMESG-WARN][124] ([i915#4423])
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adlp-11/igt@i915_module_load@load.html
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adlp-11/igt@i915_module_load@load.html

  * igt@i915_module_load@reload:
    - fi-kbl-x1275:       [PASS][125] -> [WARN][126] ([i915#6596])
   [125]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-x1275/igt@i915_module_load@reload.html
   [126]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-x1275/igt@i915_module_load@reload.html
    - fi-bsw-n3050:       [PASS][127] -> [WARN][128] ([i915#6596])
   [127]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-bsw-n3050/igt@i915_module_load@reload.html
   [128]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-bsw-n3050/igt@i915_module_load@reload.html

  * igt@i915_selftest@live@hangcheck:
    - bat-dg1-7:          [PASS][129] -> [ABORT][130] ([i915#4983])
   [129]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg1-7/igt@i915_selftest@live@hangcheck.html
   [130]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg1-7/igt@i915_selftest@live@hangcheck.html

  * igt@i915_selftest@live@slpc:
    - bat-rpls-2:         NOTRUN -> [DMESG-WARN][131] ([i915#6367])
   [131]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-2/igt@i915_selftest@live@slpc.html
    - bat-rpls-1:         NOTRUN -> [DMESG-WARN][132] ([i915#6367])
   [132]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-1/igt@i915_selftest@live@slpc.html

  * igt@i915_selftest@live@workarounds:
    - bat-mtlp-8:         [PASS][133] -> [DMESG-FAIL][134] ([i915#6763])
   [133]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-8/igt@i915_selftest@live@workarounds.html
   [134]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-8/igt@i915_selftest@live@workarounds.html

  * igt@i915_suspend@basic-s2idle-without-i915:
    - fi-cfl-8109u:       [PASS][135] -> [FAIL][136] ([i915#6559]) +1 similar issue
   [135]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-cfl-8109u/igt@i915_suspend@basic-s2idle-without-i915.html
   [136]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-cfl-8109u/igt@i915_suspend@basic-s2idle-without-i915.html
    - bat-mtlp-6:         [PASS][137] -> [FAIL][138] ([i915#6559])
   [137]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-6/igt@i915_suspend@basic-s2idle-without-i915.html
   [138]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-6/igt@i915_suspend@basic-s2idle-without-i915.html
    - bat-rpls-2:         NOTRUN -> [FAIL][139] ([i915#6559]) +1 similar issue
   [139]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-2/igt@i915_suspend@basic-s2idle-without-i915.html
    - fi-skl-guc:         [PASS][140] -> [FAIL][141] ([i915#6559]) +1 similar issue
   [140]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-skl-guc/igt@i915_suspend@basic-s2idle-without-i915.html
   [141]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-skl-guc/igt@i915_suspend@basic-s2idle-without-i915.html
    - fi-cfl-8700k:       [PASS][142] -> [FAIL][143] ([i915#6559])
   [142]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-cfl-8700k/igt@i915_suspend@basic-s2idle-without-i915.html
   [143]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-cfl-8700k/igt@i915_suspend@basic-s2idle-without-i915.html
    - fi-ivb-3770:        [PASS][144] -> [FAIL][145] ([i915#6559])
   [144]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-ivb-3770/igt@i915_suspend@basic-s2idle-without-i915.html
   [145]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-ivb-3770/igt@i915_suspend@basic-s2idle-without-i915.html
    - fi-bsw-n3050:       [PASS][146] -> [FAIL][147] ([i915#6559])
   [146]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-bsw-n3050/igt@i915_suspend@basic-s2idle-without-i915.html
   [147]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-bsw-n3050/igt@i915_suspend@basic-s2idle-without-i915.html

  * igt@i915_suspend@basic-s3-without-i915:
    - bat-adls-5:         [PASS][148] -> [FAIL][149] ([i915#8210])
   [148]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-adls-5/igt@i915_suspend@basic-s3-without-i915.html
   [149]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-adls-5/igt@i915_suspend@basic-s3-without-i915.html
    - fi-cfl-guc:         [PASS][150] -> [FAIL][151] ([i915#6559])
   [150]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-cfl-guc/igt@i915_suspend@basic-s3-without-i915.html
   [151]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-cfl-guc/igt@i915_suspend@basic-s3-without-i915.html
    - fi-skl-6600u:       [PASS][152] -> [FAIL][153] ([i915#6559])
   [152]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-skl-6600u/igt@i915_suspend@basic-s3-without-i915.html
   [153]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-skl-6600u/igt@i915_suspend@basic-s3-without-i915.html
    - bat-dg2-11:         [PASS][154] -> [FAIL][155] ([i915#6559])
   [154]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-11/igt@i915_suspend@basic-s3-without-i915.html
   [155]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-11/igt@i915_suspend@basic-s3-without-i915.html
    - bat-kbl-2:          [PASS][156] -> [FAIL][157] ([i915#6559])
   [156]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-kbl-2/igt@i915_suspend@basic-s3-without-i915.html
   [157]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-kbl-2/igt@i915_suspend@basic-s3-without-i915.html
    - fi-kbl-guc:         [PASS][158] -> [FAIL][159] ([i915#6559])
   [158]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-guc/igt@i915_suspend@basic-s3-without-i915.html
   [159]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-guc/igt@i915_suspend@basic-s3-without-i915.html
    - bat-rpls-1:         NOTRUN -> [FAIL][160] ([i915#6559])
   [160]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-1/igt@i915_suspend@basic-s3-without-i915.html

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
    - fi-tgl-1115g4:      NOTRUN -> [SKIP][161] ([i915#7828])
   [161]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-tgl-1115g4/igt@kms_chamelium_hpd@common-hpd-after-suspend.html

  * igt@kms_pipe_crc_basic@nonblocking-crc@pipe-c-dp-1:
    - bat-dg2-8:          [PASS][162] -> [FAIL][163] ([i915#7932]) +1 similar issue
   [162]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc@pipe-c-dp-1.html
   [163]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc@pipe-c-dp-1.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-3:
    - bat-dg2-9:          [PASS][164] -> [FAIL][165] ([fdo#103375] / [i915#7932])
   [164]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-9/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-3.html
   [165]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-9/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-3.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-dp-3:
    - bat-dg2-9:          [PASS][166] -> [FAIL][167] ([fdo#103375]) +1 similar issue
   [166]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-9/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-dp-3.html
   [167]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-9/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-dp-3.html

  * igt@vgem_basic@unload:
    - fi-bsw-n3050:       [PASS][168] -> [SKIP][169] ([fdo#109271])
   [168]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-bsw-n3050/igt@vgem_basic@unload.html
   [169]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-bsw-n3050/igt@vgem_basic@unload.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@gt_heartbeat:
    - fi-apl-guc:         [DMESG-FAIL][170] ([i915#5334]) -> [PASS][171]
   [170]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
   [171]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
    - fi-kbl-soraka:      [DMESG-FAIL][172] ([i915#5334] / [i915#7872]) -> [PASS][173]
   [172]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
   [173]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

  * igt@i915_selftest@live@migrate:
    - bat-dg2-11:         [DMESG-WARN][174] ([i915#7699]) -> [PASS][175]
   [174]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-11/igt@i915_selftest@live@migrate.html
   [175]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-11/igt@i915_selftest@live@migrate.html

  * igt@i915_selftest@live@reset:
    - bat-rpls-1:         [ABORT][176] ([i915#4983] / [i915#7461] / [i915#8347] / [i915#8384]) -> [PASS][177]
   [176]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-rpls-1/igt@i915_selftest@live@reset.html
   [177]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-1/igt@i915_selftest@live@reset.html
    - bat-rpls-2:         [ABORT][178] ([i915#4983] / [i915#7461] / [i915#7913] / [i915#8347]) -> [PASS][179]
   [178]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-rpls-2/igt@i915_selftest@live@reset.html
   [179]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-rpls-2/igt@i915_selftest@live@reset.html

  * igt@i915_selftest@live@slpc:
    - bat-mtlp-6:         [DMESG-WARN][180] ([i915#6367]) -> [PASS][181]
   [180]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-6/igt@i915_selftest@live@slpc.html
   [181]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-6/igt@i915_selftest@live@slpc.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-hdmi-a-3:
    - bat-dg2-11:         [INCOMPLETE][182] ([i915#7908]) -> [PASS][183]
   [182]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-dg2-11/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-hdmi-a-3.html
   [183]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-dg2-11/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-hdmi-a-3.html

  
#### Warnings ####

  * igt@i915_suspend@basic-s3-without-i915:
    - fi-tgl-1115g4:      [INCOMPLETE][184] ([i915#7443] / [i915#8102]) -> [FAIL][185] ([i915#6559])
   [184]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-tgl-1115g4/igt@i915_suspend@basic-s3-without-i915.html
   [185]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-tgl-1115g4/igt@i915_suspend@basic-s3-without-i915.html
    - bat-mtlp-6:         [SKIP][186] ([i915#6645]) -> [FAIL][187] ([i915#6121] / [i915#6559])
   [186]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/bat-mtlp-6/igt@i915_suspend@basic-s3-without-i915.html
   [187]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/bat-mtlp-6/igt@i915_suspend@basic-s3-without-i915.html
    - fi-kbl-x1275:       [SKIP][188] ([fdo#109271]) -> [FAIL][189] ([i915#6559])
   [188]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7330/fi-kbl-x1275/igt@i915_suspend@basic-s3-without-i915.html
   [189]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/fi-kbl-x1275/igt@i915_suspend@basic-s3-without-i915.html

  
  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#4423]: https://gitlab.freedesktop.org/drm/intel/issues/4423
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
  [i915#6121]: https://gitlab.freedesktop.org/drm/intel/issues/6121
  [i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
  [i915#6559]: https://gitlab.freedesktop.org/drm/intel/issues/6559
  [i915#6596]: https://gitlab.freedesktop.org/drm/intel/issues/6596
  [i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
  [i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
  [i915#6763]: https://gitlab.freedesktop.org/drm/intel/issues/6763
  [i915#7443]: https://gitlab.freedesktop.org/drm/intel/issues/7443
  [i915#7461]: https://gitlab.freedesktop.org/drm/intel/issues/7461
  [i915#7699]: https://gitlab.freedesktop.org/drm/intel/issues/7699
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7872]: https://gitlab.freedesktop.org/drm/intel/issues/7872
  [i915#7908]: https://gitlab.freedesktop.org/drm/intel/issues/7908
  [i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
  [i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
  [i915#7964]: https://gitlab.freedesktop.org/drm/intel/issues/7964
  [i915#7978]: https://gitlab.freedesktop.org/drm/intel/issues/7978
  [i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
  [i915#8102]: https://gitlab.freedesktop.org/drm/intel/issues/8102
  [i915#8210]: https://gitlab.freedesktop.org/drm/intel/issues/8210
  [i915#8347]: https://gitlab.freedesktop.org/drm/intel/issues/8347
  [i915#8384]: https://gitlab.freedesktop.org/drm/intel/issues/8384


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7330 -> IGTPW_9173

  CI-20190529: 20190529
  CI_DRM_13270: a8b181a60198ccf04a1ad1c34f46be4c2a5e64b7 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_9173: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/index.html
  IGT_7330: 592a0e56412b3323fb103ce3cc9977035c29f402 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9173/index.html

[-- Attachment #2: Type: text/html, Size: 36216 bytes --]

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

* Re: [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
  2023-06-15  2:12 [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests vitaly.prosyak
                   ` (2 preceding siblings ...)
  2023-06-15  7:53 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
@ 2023-06-28 21:07 ` Kamil Konieczny
  3 siblings, 0 replies; 12+ messages in thread
From: Kamil Konieczny @ 2023-06-28 21:07 UTC (permalink / raw)
  To: igt-dev; +Cc: alexander.deucher, michael.strawbridge, christian.koenig

Hi Vitaly,

On 2023-06-14 at 22:12:23 -0400, vitaly.prosyak@amd.com wrote:
> From: Vitaly Prosyak <vitaly.prosyak@amd.com>
> 
> The tests do the validation the following bo features:
>  - export/import
>  - write/read metadata and then compare with original
>  - map/unmap
>  - alloc/free
>  - find bo mapping
> 
> Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
> Change-Id: Ica91b4bbc345c4760323b5c177c873129534b663
- ^^^^^^^^^
Drop this link as it is not public.

> ---
>  meson.build              |   2 +-
>  tests/amdgpu/amd_bo.c    | 291 +++++++++++++++++++++++++++++++++++++++
>  tests/amdgpu/meson.build |   1 +
>  3 files changed, 293 insertions(+), 1 deletion(-)
>  create mode 100644 tests/amdgpu/amd_bo.c
> 
> diff --git a/meson.build b/meson.build
> index 0487158dc..12269370a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -4,7 +4,7 @@ project('igt-gpu-tools', 'c',
>            'warning_level=2',
>            'c_std=gnu11',
>            'b_ndebug=false',
> -          'buildtype=debugoptimized',
> +          'buildtype=debug',

Drop this change.

>          ],
>  	license : 'MIT',
>  	meson_version : '>=0.47.2')
> diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
> new file mode 100644
> index 000000000..9a95da237
> --- /dev/null
> +++ b/tests/amdgpu/amd_bo.c
> @@ -0,0 +1,291 @@
> +// SPDX-License-Identifier: MIT

Add copyright.

> +
> +#include <stdio.h>
> +#include <amdgpu.h>
> +#include <amdgpu_drm.h>

Add newline.

> +#include "igt.h"
> +#include "lib/amdgpu/amd_memory.h"
> +
> +

Remove one empty line.

Please look at GitLab warning, there was some compilation error.

Regards,
Kamil

> +#define BUFFER_SIZE (4*1024)
> +#define BUFFER_ALIGN (4*1024)
> +
> +struct bo_data {
> +	amdgpu_bo_handle buffer_handle;
> +	uint64_t virtual_mc_base_address;
> +	amdgpu_va_handle va_handle;
> +};
> +
> +static int
> +amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
> +{
> +	struct amdgpu_bo_alloc_request req = {0};
> +	int r;
> +
> +	req.alloc_size = BUFFER_SIZE;
> +	req.phys_alignment = BUFFER_ALIGN;
> +	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
> +
> +	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
> +	if (r)
> +		return r;
> +
> +	r = amdgpu_va_range_alloc(device_handle,
> +				  amdgpu_gpu_va_range_general,
> +				  BUFFER_SIZE, BUFFER_ALIGN, 0,
> +				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
> +	if (r)
> +		goto error_va_alloc;
> +
> +	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
> +			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
> +	if (r)
> +		goto error_va_map;
> +
> +
> +	return 0;
> +
> +error_va_map:
> +	amdgpu_va_range_free(bo->va_handle);
> +
> +error_va_alloc:
> +	amdgpu_bo_free(bo->buffer_handle);
> +	return 1;
> +}
> +
> +static void
> +amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
> +{
> +	int r;
> +
> +	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
> +			    bo->virtual_mc_base_address, 0,
> +			    AMDGPU_VA_OP_UNMAP);
> +	igt_assert_eq(r, 0);
> +
> +	r = amdgpu_va_range_free(bo->va_handle);
> +	igt_assert_eq(r, 0);
> +	r = amdgpu_bo_free(bo->buffer_handle);
> +	igt_assert_eq(r, 0);
> +}
> +
> +static void
> +amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
> +		struct bo_data *bo, enum amdgpu_bo_handle_type type)
> +{
> +	struct amdgpu_bo_import_result res = {0};
> +	uint32_t shared_handle;
> +	int r;
> +
> +	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
> +	igt_assert_eq(r, 0);
> +
> +	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
> +	igt_assert_eq(r, 0);
> +
> +	igt_assert(res.buf_handle == bo->buffer_handle);
> +	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
> +
> +	r = amdgpu_bo_free(res.buf_handle);
> +	igt_assert_eq(r, 0);
> +}
> +
> +static void
> +amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
> +{
> +	amdgpu_bo_export_import_do_type(device, bo,
> +			amdgpu_bo_handle_type_gem_flink_name);
> +	amdgpu_bo_export_import_do_type(device, bo,
> +			amdgpu_bo_handle_type_dma_buf_fd);
> +}
> +
> +static void
> +amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
> +{
> +	struct amdgpu_bo_metadata meta = {0};
> +	struct amdgpu_bo_info info = {0};
> +	int r;
> +
> +	meta.size_metadata = 4;
> +	meta.umd_metadata[0] = 0xdeadbeef;
> +
> +	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
> +	igt_assert_eq(r, 0);
> +
> +	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
> +	igt_assert_eq(r, 0);
> +
> +	igt_assert_eq(info.metadata.size_metadata, 4);
> +	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
> +}
> +
> +static void
> +amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
> +{
> +	uint32_t *ptr;
> +	int i, r;
> +
> +	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
> +	igt_assert_eq(r, 0);
> +
> +	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
> +		ptr[i] = 0xdeadbeef;
> +
> +	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
> +	igt_assert_eq(r, 0);
> +}
> +
> +static void
> +amdgpu_memory_alloc(amdgpu_device_handle device_handle)
> +{
> +	amdgpu_bo_handle bo;
> +	amdgpu_va_handle va_handle;
> +	uint64_t bo_mc;
> +
> +	/* Test visible VRAM */
> +	bo = gpu_mem_alloc(device_handle,
> +			4096, 4096,
> +			AMDGPU_GEM_DOMAIN_VRAM,
> +			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
> +			&bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +
> +	/* Test invisible VRAM */
> +	bo = gpu_mem_alloc(device_handle,
> +			4096, 4096,
> +			AMDGPU_GEM_DOMAIN_VRAM,
> +			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
> +			&bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +
> +	/* Test GART cacheable */
> +	bo = gpu_mem_alloc(device_handle,
> +			4096, 4096,
> +			AMDGPU_GEM_DOMAIN_GTT,
> +			0, &bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +
> +	/* Test GART USWC */
> +	bo = gpu_mem_alloc(device_handle,
> +			4096, 4096,
> +			AMDGPU_GEM_DOMAIN_GTT,
> +			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
> +			&bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +
> +	/* Test GDS */
> +	bo = gpu_mem_alloc(device_handle, 1024, 0,
> +			AMDGPU_GEM_DOMAIN_GDS, 0,
> +			&bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +	/* Test GWS */
> +	bo = gpu_mem_alloc(device_handle, 1, 0,
> +			AMDGPU_GEM_DOMAIN_GWS, 0,
> +			&bo_mc, &va_handle);
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +	/* Test OA */
> +	bo = gpu_mem_alloc(device_handle, 1, 0,
> +			AMDGPU_GEM_DOMAIN_OA, 0,
> +			&bo_mc, &va_handle);
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +}
> +
> +static void
> +amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
> +{
> +	int r;
> +	struct amdgpu_bo_alloc_request req = {0};
> +	amdgpu_bo_handle buf_handle;
> +
> +	/* Test impossible mem allocation, 1TB */
> +	req.alloc_size = 0xE8D4A51000;
> +	req.phys_alignment = 4096;
> +	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
> +	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
> +
> +	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
> +	igt_assert_eq(r, -ENOMEM);
> +
> +	if (!r) {
> +		r = amdgpu_bo_free(buf_handle);
> +		igt_assert_eq(r, 0);
> +	}
> +}
> +
> +static void
> +amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
> +{
> +	amdgpu_bo_handle bo_handle, find_bo_handle;
> +	amdgpu_va_handle va_handle;
> +	void *bo_cpu;
> +	uint64_t bo_mc_address;
> +	uint64_t offset;
> +	int r;
> +
> +	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
> +				    AMDGPU_GEM_DOMAIN_GTT, 0,
> +				    &bo_handle, &bo_cpu,
> +				    &bo_mc_address, &va_handle);
> +	igt_assert_eq(r, 0);
> +
> +	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
> +					  bo_cpu,
> +					  4096,
> +					  &find_bo_handle,
> +					  &offset);
> +	igt_assert_eq(r, 0);
> +	igt_assert_eq(offset, 0);
> +
> +	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
> +				     bo_mc_address, 4096);
> +}
> +
> +igt_main
> +{
> +	amdgpu_device_handle device;
> +	struct bo_data bo;
> +	int fd = -1;
> +
> +	igt_fixture {
> +		uint32_t major, minor;
> +		int err;
> +
> +		fd = drm_open_driver(DRIVER_AMDGPU);
> +		err = amdgpu_device_initialize(fd, &major, &minor, &device);
> +		igt_require(err == 0);
> +		igt_info("Initialized amdgpu, driver version %d.%d\n",
> +			 major, minor);
> +
> +		amdgpu_bo_init(device, &bo);
> +	}
> +
> +	igt_subtest("amdgpu_bo_export_import")
> +	amdgpu_bo_export_import(device, &bo);
> +
> +	igt_subtest("amdgpu_bo_metadata")
> +	amdgpu_bo_metadata(device, &bo);
> +
> +	igt_subtest("amdgpu_bo_map_unmap")
> +	amdgpu_bo_map_unmap(device, &bo);
> +
> +	igt_subtest("amdgpu_memory_alloc")
> +	amdgpu_memory_alloc(device);
> +
> +	igt_subtest("amdgpu_mem_fail_alloc")
> +	amdgpu_mem_fail_alloc(device);
> +
> +	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
> +	amdgpu_bo_find_by_cpu_mapping(device);
> +
> +	igt_fixture {
> +		amdgpu_bo_clean(device, &bo);
> +		amdgpu_device_deinitialize(device);
> +		close(fd);
> +	}
> +}
> +
> diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
> index 7fff7602f..43326a7c4 100644
> --- a/tests/amdgpu/meson.build
> +++ b/tests/amdgpu/meson.build
> @@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
>  	amdgpu_progs += [ 'amd_abm',
>  			  'amd_assr',
>  			  'amd_basic',
> +			  'amd_bo',
>  			  'amd_bypass',
>  			  'amd_deadlock',
>  			  'amd_pci_unplug',
> -- 
> 2.25.1
> 

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

* [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
@ 2023-06-30 23:31 vitaly.prosyak
  0 siblings, 0 replies; 12+ messages in thread
From: vitaly.prosyak @ 2023-06-30 23:31 UTC (permalink / raw)
  To: igt-dev

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

The tests do the validation the following bo features:
 - export/import
 - write/read metadata and then compare with original
 - map/unmap
 - alloc/free
 - find bo mapping

v1-v2 Fix formatting errors, drop debug (it was added by mistake)
      and fix return code - Kamil

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Acked-by Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/amdgpu/amd_bo.c    | 292 +++++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build |   1 +
 2 files changed, 293 insertions(+)
 create mode 100644 tests/amdgpu/amd_bo.c

diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
new file mode 100644
index 000000000..01af2ba93
--- /dev/null
+++ b/tests/amdgpu/amd_bo.c
@@ -0,0 +1,292 @@
+// SPDX-License-Identifier: MIT
+// Copyright 2023 Advanced Micro Devices, Inc.
+
+#include <stdio.h>
+#include <amdgpu.h>
+#include <amdgpu_drm.h>
+
+#include "igt.h"
+#include "lib/amdgpu/amd_memory.h"
+
+
+#define BUFFER_SIZE (4*1024)
+#define BUFFER_ALIGN (4*1024)
+
+struct bo_data {
+	amdgpu_bo_handle buffer_handle;
+	uint64_t virtual_mc_base_address;
+	amdgpu_va_handle va_handle;
+};
+
+static int
+amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	struct amdgpu_bo_alloc_request req = {0};
+	int r;
+
+	req.alloc_size = BUFFER_SIZE;
+	req.phys_alignment = BUFFER_ALIGN;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
+	if (r)
+		return r;
+
+	r = amdgpu_va_range_alloc(device_handle,
+				  amdgpu_gpu_va_range_general,
+				  BUFFER_SIZE, BUFFER_ALIGN, 0,
+				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
+	if (r)
+		goto error_va_alloc;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
+	if (r)
+		goto error_va_map;
+
+	return r;
+
+error_va_map:
+	amdgpu_va_range_free(bo->va_handle);
+
+error_va_alloc:
+	amdgpu_bo_free(bo->buffer_handle);
+	return r;
+}
+
+static void
+amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	int r;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			    bo->virtual_mc_base_address, 0,
+			    AMDGPU_VA_OP_UNMAP);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_va_range_free(bo->va_handle);
+	igt_assert_eq(r, 0);
+	r = amdgpu_bo_free(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
+		struct bo_data *bo, enum amdgpu_bo_handle_type type)
+{
+	struct amdgpu_bo_import_result res = {0};
+	uint32_t shared_handle;
+	int r;
+
+	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
+	igt_assert_eq(r, 0);
+
+	igt_assert(res.buf_handle == bo->buffer_handle);
+	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
+
+	r = amdgpu_bo_free(res.buf_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
+{
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_gem_flink_name);
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_dma_buf_fd);
+}
+
+static void
+amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
+{
+	struct amdgpu_bo_metadata meta = {0};
+	struct amdgpu_bo_info info = {0};
+	int r;
+
+	meta.size_metadata = 4;
+	meta.umd_metadata[0] = 0xdeadbeef;
+
+	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
+	igt_assert_eq(r, 0);
+
+	igt_assert_eq(info.metadata.size_metadata, 4);
+	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
+}
+
+static void
+amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
+{
+	uint32_t *ptr;
+	int i, r;
+
+	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
+	igt_assert_eq(r, 0);
+
+	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
+		ptr[i] = 0xdeadbeef;
+
+	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_memory_alloc(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo;
+	amdgpu_va_handle va_handle;
+	uint64_t bo_mc;
+
+	/* Test visible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test invisible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART cacheable */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			0, &bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART USWC */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GDS */
+	bo = gpu_mem_alloc(device_handle, 1024, 0,
+			AMDGPU_GEM_DOMAIN_GDS, 0,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test GWS */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_GWS, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test OA */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_OA, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+}
+
+static void
+amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
+{
+	int r;
+	struct amdgpu_bo_alloc_request req = {0};
+	amdgpu_bo_handle buf_handle;
+
+	/* Test impossible mem allocation, 1TB */
+	req.alloc_size = 0xE8D4A51000;
+	req.phys_alignment = 4096;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
+	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
+	igt_assert_eq(r, -ENOMEM);
+
+	if (!r) {
+		r = amdgpu_bo_free(buf_handle);
+		igt_assert_eq(r, 0);
+	}
+}
+
+static void
+amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo_handle, find_bo_handle;
+	amdgpu_va_handle va_handle;
+	void *bo_cpu;
+	uint64_t bo_mc_address;
+	uint64_t offset;
+	int r;
+
+	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
+				    AMDGPU_GEM_DOMAIN_GTT, 0,
+				    &bo_handle, &bo_cpu,
+				    &bo_mc_address, &va_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
+					  bo_cpu,
+					  4096,
+					  &find_bo_handle,
+					  &offset);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(offset, 0);
+
+	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
+				     bo_mc_address, 4096);
+}
+
+igt_main
+{
+	amdgpu_device_handle device;
+	struct bo_data bo;
+	int fd = -1;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+		err = amdgpu_device_initialize(fd, &major, &minor, &device);
+		igt_require(err == 0);
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+		err = amdgpu_bo_init(device, &bo);
+		igt_require(err == 0);
+	}
+
+	igt_subtest("amdgpu_bo_export_import")
+	amdgpu_bo_export_import(device, &bo);
+
+	igt_subtest("amdgpu_bo_metadata")
+	amdgpu_bo_metadata(device, &bo);
+
+	igt_subtest("amdgpu_bo_map_unmap")
+	amdgpu_bo_map_unmap(device, &bo);
+
+	igt_subtest("amdgpu_memory_alloc")
+	amdgpu_memory_alloc(device);
+
+	igt_subtest("amdgpu_mem_fail_alloc")
+	amdgpu_mem_fail_alloc(device);
+
+	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
+	amdgpu_bo_find_by_cpu_mapping(device);
+
+	igt_fixture {
+		amdgpu_bo_clean(device, &bo);
+		amdgpu_device_deinitialize(device);
+		close(fd);
+	}
+}
+
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index 7fff7602f..43326a7c4 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
 	amdgpu_progs += [ 'amd_abm',
 			  'amd_assr',
 			  'amd_basic',
+			  'amd_bo',
 			  'amd_bypass',
 			  'amd_deadlock',
 			  'amd_pci_unplug',
-- 
2.25.1

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

* [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
@ 2023-06-21  0:39 vitaly.prosyak
  0 siblings, 0 replies; 12+ messages in thread
From: vitaly.prosyak @ 2023-06-21  0:39 UTC (permalink / raw)
  To: igt-dev

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

The tests do the validation the following bo features:
 - export/import
 - write/read metadata and then compare with original
 - map/unmap
 - alloc/free
 - find bo mapping

v1-v2 Fix formatting errors, drop debug (it was added by mistake)
      and fix return code - Kamil

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Acked-by Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/amdgpu/amd_bo.c    | 292 +++++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build |   1 +
 2 files changed, 293 insertions(+)
 create mode 100644 tests/amdgpu/amd_bo.c

diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
new file mode 100644
index 000000000..01af2ba93
--- /dev/null
+++ b/tests/amdgpu/amd_bo.c
@@ -0,0 +1,292 @@
+// SPDX-License-Identifier: MIT
+// Copyright 2023 Advanced Micro Devices, Inc.
+
+#include <stdio.h>
+#include <amdgpu.h>
+#include <amdgpu_drm.h>
+
+#include "igt.h"
+#include "lib/amdgpu/amd_memory.h"
+
+
+#define BUFFER_SIZE (4*1024)
+#define BUFFER_ALIGN (4*1024)
+
+struct bo_data {
+	amdgpu_bo_handle buffer_handle;
+	uint64_t virtual_mc_base_address;
+	amdgpu_va_handle va_handle;
+};
+
+static int
+amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	struct amdgpu_bo_alloc_request req = {0};
+	int r;
+
+	req.alloc_size = BUFFER_SIZE;
+	req.phys_alignment = BUFFER_ALIGN;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
+	if (r)
+		return r;
+
+	r = amdgpu_va_range_alloc(device_handle,
+				  amdgpu_gpu_va_range_general,
+				  BUFFER_SIZE, BUFFER_ALIGN, 0,
+				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
+	if (r)
+		goto error_va_alloc;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
+	if (r)
+		goto error_va_map;
+
+	return r;
+
+error_va_map:
+	amdgpu_va_range_free(bo->va_handle);
+
+error_va_alloc:
+	amdgpu_bo_free(bo->buffer_handle);
+	return r;
+}
+
+static void
+amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	int r;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			    bo->virtual_mc_base_address, 0,
+			    AMDGPU_VA_OP_UNMAP);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_va_range_free(bo->va_handle);
+	igt_assert_eq(r, 0);
+	r = amdgpu_bo_free(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
+		struct bo_data *bo, enum amdgpu_bo_handle_type type)
+{
+	struct amdgpu_bo_import_result res = {0};
+	uint32_t shared_handle;
+	int r;
+
+	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
+	igt_assert_eq(r, 0);
+
+	igt_assert(res.buf_handle == bo->buffer_handle);
+	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
+
+	r = amdgpu_bo_free(res.buf_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
+{
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_gem_flink_name);
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_dma_buf_fd);
+}
+
+static void
+amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
+{
+	struct amdgpu_bo_metadata meta = {0};
+	struct amdgpu_bo_info info = {0};
+	int r;
+
+	meta.size_metadata = 4;
+	meta.umd_metadata[0] = 0xdeadbeef;
+
+	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
+	igt_assert_eq(r, 0);
+
+	igt_assert_eq(info.metadata.size_metadata, 4);
+	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
+}
+
+static void
+amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
+{
+	uint32_t *ptr;
+	int i, r;
+
+	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
+	igt_assert_eq(r, 0);
+
+	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
+		ptr[i] = 0xdeadbeef;
+
+	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_memory_alloc(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo;
+	amdgpu_va_handle va_handle;
+	uint64_t bo_mc;
+
+	/* Test visible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test invisible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART cacheable */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			0, &bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART USWC */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GDS */
+	bo = gpu_mem_alloc(device_handle, 1024, 0,
+			AMDGPU_GEM_DOMAIN_GDS, 0,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test GWS */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_GWS, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test OA */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_OA, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+}
+
+static void
+amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
+{
+	int r;
+	struct amdgpu_bo_alloc_request req = {0};
+	amdgpu_bo_handle buf_handle;
+
+	/* Test impossible mem allocation, 1TB */
+	req.alloc_size = 0xE8D4A51000;
+	req.phys_alignment = 4096;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
+	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
+	igt_assert_eq(r, -ENOMEM);
+
+	if (!r) {
+		r = amdgpu_bo_free(buf_handle);
+		igt_assert_eq(r, 0);
+	}
+}
+
+static void
+amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo_handle, find_bo_handle;
+	amdgpu_va_handle va_handle;
+	void *bo_cpu;
+	uint64_t bo_mc_address;
+	uint64_t offset;
+	int r;
+
+	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
+				    AMDGPU_GEM_DOMAIN_GTT, 0,
+				    &bo_handle, &bo_cpu,
+				    &bo_mc_address, &va_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
+					  bo_cpu,
+					  4096,
+					  &find_bo_handle,
+					  &offset);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(offset, 0);
+
+	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
+				     bo_mc_address, 4096);
+}
+
+igt_main
+{
+	amdgpu_device_handle device;
+	struct bo_data bo;
+	int fd = -1;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+		err = amdgpu_device_initialize(fd, &major, &minor, &device);
+		igt_require(err == 0);
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+		err = amdgpu_bo_init(device, &bo);
+		igt_require(err == 0);
+	}
+
+	igt_subtest("amdgpu_bo_export_import")
+	amdgpu_bo_export_import(device, &bo);
+
+	igt_subtest("amdgpu_bo_metadata")
+	amdgpu_bo_metadata(device, &bo);
+
+	igt_subtest("amdgpu_bo_map_unmap")
+	amdgpu_bo_map_unmap(device, &bo);
+
+	igt_subtest("amdgpu_memory_alloc")
+	amdgpu_memory_alloc(device);
+
+	igt_subtest("amdgpu_mem_fail_alloc")
+	amdgpu_mem_fail_alloc(device);
+
+	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
+	amdgpu_bo_find_by_cpu_mapping(device);
+
+	igt_fixture {
+		amdgpu_bo_clean(device, &bo);
+		amdgpu_device_deinitialize(device);
+		close(fd);
+	}
+}
+
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index 7fff7602f..43326a7c4 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
 	amdgpu_progs += [ 'amd_abm',
 			  'amd_assr',
 			  'amd_basic',
+			  'amd_bo',
 			  'amd_bypass',
 			  'amd_deadlock',
 			  'amd_pci_unplug',
-- 
2.25.1

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

* [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
@ 2023-06-19 20:37 vitaly.prosyak
  0 siblings, 0 replies; 12+ messages in thread
From: vitaly.prosyak @ 2023-06-19 20:37 UTC (permalink / raw)
  To: igt-dev

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

The tests do the validation the following bo features:
 - export/import
 - write/read metadata and then compare with original
 - map/unmap
 - alloc/free
 - find bo mapping

v1-v2 Fix formatting errors, drop debug (it was added by mistake)
      and fix return code - Kamil

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Acked-by Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/amdgpu/amd_bo.c    | 292 +++++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build |   1 +
 2 files changed, 293 insertions(+)
 create mode 100644 tests/amdgpu/amd_bo.c

diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
new file mode 100644
index 000000000..01af2ba93
--- /dev/null
+++ b/tests/amdgpu/amd_bo.c
@@ -0,0 +1,292 @@
+// SPDX-License-Identifier: MIT
+// Copyright 2023 Advanced Micro Devices, Inc.
+
+#include <stdio.h>
+#include <amdgpu.h>
+#include <amdgpu_drm.h>
+
+#include "igt.h"
+#include "lib/amdgpu/amd_memory.h"
+
+
+#define BUFFER_SIZE (4*1024)
+#define BUFFER_ALIGN (4*1024)
+
+struct bo_data {
+	amdgpu_bo_handle buffer_handle;
+	uint64_t virtual_mc_base_address;
+	amdgpu_va_handle va_handle;
+};
+
+static int
+amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	struct amdgpu_bo_alloc_request req = {0};
+	int r;
+
+	req.alloc_size = BUFFER_SIZE;
+	req.phys_alignment = BUFFER_ALIGN;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
+	if (r)
+		return r;
+
+	r = amdgpu_va_range_alloc(device_handle,
+				  amdgpu_gpu_va_range_general,
+				  BUFFER_SIZE, BUFFER_ALIGN, 0,
+				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
+	if (r)
+		goto error_va_alloc;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
+	if (r)
+		goto error_va_map;
+
+	return r;
+
+error_va_map:
+	amdgpu_va_range_free(bo->va_handle);
+
+error_va_alloc:
+	amdgpu_bo_free(bo->buffer_handle);
+	return r;
+}
+
+static void
+amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	int r;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			    bo->virtual_mc_base_address, 0,
+			    AMDGPU_VA_OP_UNMAP);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_va_range_free(bo->va_handle);
+	igt_assert_eq(r, 0);
+	r = amdgpu_bo_free(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
+		struct bo_data *bo, enum amdgpu_bo_handle_type type)
+{
+	struct amdgpu_bo_import_result res = {0};
+	uint32_t shared_handle;
+	int r;
+
+	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
+	igt_assert_eq(r, 0);
+
+	igt_assert(res.buf_handle == bo->buffer_handle);
+	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
+
+	r = amdgpu_bo_free(res.buf_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
+{
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_gem_flink_name);
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_dma_buf_fd);
+}
+
+static void
+amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
+{
+	struct amdgpu_bo_metadata meta = {0};
+	struct amdgpu_bo_info info = {0};
+	int r;
+
+	meta.size_metadata = 4;
+	meta.umd_metadata[0] = 0xdeadbeef;
+
+	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
+	igt_assert_eq(r, 0);
+
+	igt_assert_eq(info.metadata.size_metadata, 4);
+	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
+}
+
+static void
+amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
+{
+	uint32_t *ptr;
+	int i, r;
+
+	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
+	igt_assert_eq(r, 0);
+
+	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
+		ptr[i] = 0xdeadbeef;
+
+	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_memory_alloc(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo;
+	amdgpu_va_handle va_handle;
+	uint64_t bo_mc;
+
+	/* Test visible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test invisible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART cacheable */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			0, &bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART USWC */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GDS */
+	bo = gpu_mem_alloc(device_handle, 1024, 0,
+			AMDGPU_GEM_DOMAIN_GDS, 0,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test GWS */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_GWS, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test OA */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_OA, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+}
+
+static void
+amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
+{
+	int r;
+	struct amdgpu_bo_alloc_request req = {0};
+	amdgpu_bo_handle buf_handle;
+
+	/* Test impossible mem allocation, 1TB */
+	req.alloc_size = 0xE8D4A51000;
+	req.phys_alignment = 4096;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
+	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
+	igt_assert_eq(r, -ENOMEM);
+
+	if (!r) {
+		r = amdgpu_bo_free(buf_handle);
+		igt_assert_eq(r, 0);
+	}
+}
+
+static void
+amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo_handle, find_bo_handle;
+	amdgpu_va_handle va_handle;
+	void *bo_cpu;
+	uint64_t bo_mc_address;
+	uint64_t offset;
+	int r;
+
+	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
+				    AMDGPU_GEM_DOMAIN_GTT, 0,
+				    &bo_handle, &bo_cpu,
+				    &bo_mc_address, &va_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
+					  bo_cpu,
+					  4096,
+					  &find_bo_handle,
+					  &offset);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(offset, 0);
+
+	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
+				     bo_mc_address, 4096);
+}
+
+igt_main
+{
+	amdgpu_device_handle device;
+	struct bo_data bo;
+	int fd = -1;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+		err = amdgpu_device_initialize(fd, &major, &minor, &device);
+		igt_require(err == 0);
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+		err = amdgpu_bo_init(device, &bo);
+		igt_require(err == 0);
+	}
+
+	igt_subtest("amdgpu_bo_export_import")
+	amdgpu_bo_export_import(device, &bo);
+
+	igt_subtest("amdgpu_bo_metadata")
+	amdgpu_bo_metadata(device, &bo);
+
+	igt_subtest("amdgpu_bo_map_unmap")
+	amdgpu_bo_map_unmap(device, &bo);
+
+	igt_subtest("amdgpu_memory_alloc")
+	amdgpu_memory_alloc(device);
+
+	igt_subtest("amdgpu_mem_fail_alloc")
+	amdgpu_mem_fail_alloc(device);
+
+	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
+	amdgpu_bo_find_by_cpu_mapping(device);
+
+	igt_fixture {
+		amdgpu_bo_clean(device, &bo);
+		amdgpu_device_deinitialize(device);
+		close(fd);
+	}
+}
+
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index 7fff7602f..43326a7c4 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
 	amdgpu_progs += [ 'amd_abm',
 			  'amd_assr',
 			  'amd_basic',
+			  'amd_bo',
 			  'amd_bypass',
 			  'amd_deadlock',
 			  'amd_pci_unplug',
-- 
2.25.1

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

* Re: [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
  2023-06-15 17:02 ` Kamil Konieczny
@ 2023-06-15 23:35   ` vitaly prosyak
  0 siblings, 0 replies; 12+ messages in thread
From: vitaly prosyak @ 2023-06-15 23:35 UTC (permalink / raw)
  To: Kamil Konieczny, igt-dev, christian.koenig

Hi Kamil,

Thanks for the review, it was helpful!

The updated patches are here: https://patchwork.freedesktop.org/series/119417/

Thanks, Vitaly

On 2023-06-15 13:02, Kamil Konieczny wrote:
> Hi Vitaly,
>
> On 2023-06-14 at 22:14:05 -0400, vitaly.prosyak@amd.com wrote:
>> From: Vitaly Prosyak <vitaly.prosyak@amd.com>
>>
>> The tests do the validation the following bo features:
>>  - export/import
>>  - write/read metadata and then compare with original
>>  - map/unmap
>>  - alloc/free
>>  - find bo mapping
>>
>> Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
>> ---
>>  meson.build              |   2 +-
>>  tests/amdgpu/amd_bo.c    | 291 +++++++++++++++++++++++++++++++++++++++
>>  tests/amdgpu/meson.build |   1 +
>>  3 files changed, 293 insertions(+), 1 deletion(-)
>>  create mode 100644 tests/amdgpu/amd_bo.c
>>
>> diff --git a/meson.build b/meson.build
>> index 0487158dc..12269370a 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -4,7 +4,7 @@ project('igt-gpu-tools', 'c',
>>            'warning_level=2',
>>            'c_std=gnu11',
>>            'b_ndebug=false',
>> -          'buildtype=debugoptimized',
>> +          'buildtype=debug',
> Drop this change.
>
>>          ],
>>  	license : 'MIT',
>>  	meson_version : '>=0.47.2')
>> diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
>> new file mode 100644
>> index 000000000..9a95da237
>> --- /dev/null
>> +++ b/tests/amdgpu/amd_bo.c
>> @@ -0,0 +1,291 @@
>> +// SPDX-License-Identifier: MIT
> Add copyright here.
>
>> +
>> +#include <stdio.h>
>> +#include <amdgpu.h>
>> +#include <amdgpu_drm.h>
> Put newline here.
>
>> +#include "igt.h"
>> +#include "lib/amdgpu/amd_memory.h"
>> +
>> +
>> +#define BUFFER_SIZE (4*1024)
>> +#define BUFFER_ALIGN (4*1024)
>> +
>> +struct bo_data {
>> +	amdgpu_bo_handle buffer_handle;
>> +	uint64_t virtual_mc_base_address;
>> +	amdgpu_va_handle va_handle;
>> +};
>> +
>> +static int
>> +amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
>> +{
>> +	struct amdgpu_bo_alloc_request req = {0};
>> +	int r;
>> +
>> +	req.alloc_size = BUFFER_SIZE;
>> +	req.phys_alignment = BUFFER_ALIGN;
>> +	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
>> +
>> +	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
>> +	if (r)
>> +		return r;
>> +
>> +	r = amdgpu_va_range_alloc(device_handle,
>> +				  amdgpu_gpu_va_range_general,
>> +				  BUFFER_SIZE, BUFFER_ALIGN, 0,
>> +				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
>> +	if (r)
>> +		goto error_va_alloc;
>> +
>> +	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
>> +			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
>> +	if (r)
>> +		goto error_va_map;
>> +
> Remove extra empty line.
>
>> +
>> +	return 0;
>> +
>> +error_va_map:
>> +	amdgpu_va_range_free(bo->va_handle);
>> +
>> +error_va_alloc:
>> +	amdgpu_bo_free(bo->buffer_handle);
>> +	return 1;
> -------------- ^
> better:	return r;
>
> Regards,
> Kamil
>
>> +}
>> +
>> +static void
>> +amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
>> +{
>> +	int r;
>> +
>> +	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
>> +			    bo->virtual_mc_base_address, 0,
>> +			    AMDGPU_VA_OP_UNMAP);
>> +	igt_assert_eq(r, 0);
>> +
>> +	r = amdgpu_va_range_free(bo->va_handle);
>> +	igt_assert_eq(r, 0);
>> +	r = amdgpu_bo_free(bo->buffer_handle);
>> +	igt_assert_eq(r, 0);
>> +}
>> +
>> +static void
>> +amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
>> +		struct bo_data *bo, enum amdgpu_bo_handle_type type)
>> +{
>> +	struct amdgpu_bo_import_result res = {0};
>> +	uint32_t shared_handle;
>> +	int r;
>> +
>> +	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
>> +	igt_assert_eq(r, 0);
>> +
>> +	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
>> +	igt_assert_eq(r, 0);
>> +
>> +	igt_assert(res.buf_handle == bo->buffer_handle);
>> +	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
>> +
>> +	r = amdgpu_bo_free(res.buf_handle);
>> +	igt_assert_eq(r, 0);
>> +}
>> +
>> +static void
>> +amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
>> +{
>> +	amdgpu_bo_export_import_do_type(device, bo,
>> +			amdgpu_bo_handle_type_gem_flink_name);
>> +	amdgpu_bo_export_import_do_type(device, bo,
>> +			amdgpu_bo_handle_type_dma_buf_fd);
>> +}
>> +
>> +static void
>> +amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
>> +{
>> +	struct amdgpu_bo_metadata meta = {0};
>> +	struct amdgpu_bo_info info = {0};
>> +	int r;
>> +
>> +	meta.size_metadata = 4;
>> +	meta.umd_metadata[0] = 0xdeadbeef;
>> +
>> +	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
>> +	igt_assert_eq(r, 0);
>> +
>> +	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
>> +	igt_assert_eq(r, 0);
>> +
>> +	igt_assert_eq(info.metadata.size_metadata, 4);
>> +	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
>> +}
>> +
>> +static void
>> +amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
>> +{
>> +	uint32_t *ptr;
>> +	int i, r;
>> +
>> +	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
>> +	igt_assert_eq(r, 0);
>> +
>> +	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
>> +		ptr[i] = 0xdeadbeef;
>> +
>> +	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
>> +	igt_assert_eq(r, 0);
>> +}
>> +
>> +static void
>> +amdgpu_memory_alloc(amdgpu_device_handle device_handle)
>> +{
>> +	amdgpu_bo_handle bo;
>> +	amdgpu_va_handle va_handle;
>> +	uint64_t bo_mc;
>> +
>> +	/* Test visible VRAM */
>> +	bo = gpu_mem_alloc(device_handle,
>> +			4096, 4096,
>> +			AMDGPU_GEM_DOMAIN_VRAM,
>> +			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
>> +			&bo_mc, &va_handle);
>> +
>> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
>> +
>> +	/* Test invisible VRAM */
>> +	bo = gpu_mem_alloc(device_handle,
>> +			4096, 4096,
>> +			AMDGPU_GEM_DOMAIN_VRAM,
>> +			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
>> +			&bo_mc, &va_handle);
>> +
>> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
>> +
>> +	/* Test GART cacheable */
>> +	bo = gpu_mem_alloc(device_handle,
>> +			4096, 4096,
>> +			AMDGPU_GEM_DOMAIN_GTT,
>> +			0, &bo_mc, &va_handle);
>> +
>> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
>> +
>> +	/* Test GART USWC */
>> +	bo = gpu_mem_alloc(device_handle,
>> +			4096, 4096,
>> +			AMDGPU_GEM_DOMAIN_GTT,
>> +			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
>> +			&bo_mc, &va_handle);
>> +
>> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
>> +
>> +	/* Test GDS */
>> +	bo = gpu_mem_alloc(device_handle, 1024, 0,
>> +			AMDGPU_GEM_DOMAIN_GDS, 0,
>> +			&bo_mc, &va_handle);
>> +
>> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
>> +	/* Test GWS */
>> +	bo = gpu_mem_alloc(device_handle, 1, 0,
>> +			AMDGPU_GEM_DOMAIN_GWS, 0,
>> +			&bo_mc, &va_handle);
>> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
>> +	/* Test OA */
>> +	bo = gpu_mem_alloc(device_handle, 1, 0,
>> +			AMDGPU_GEM_DOMAIN_OA, 0,
>> +			&bo_mc, &va_handle);
>> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
>> +}
>> +
>> +static void
>> +amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
>> +{
>> +	int r;
>> +	struct amdgpu_bo_alloc_request req = {0};
>> +	amdgpu_bo_handle buf_handle;
>> +
>> +	/* Test impossible mem allocation, 1TB */
>> +	req.alloc_size = 0xE8D4A51000;
>> +	req.phys_alignment = 4096;
>> +	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
>> +	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
>> +
>> +	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
>> +	igt_assert_eq(r, -ENOMEM);
>> +
>> +	if (!r) {
>> +		r = amdgpu_bo_free(buf_handle);
>> +		igt_assert_eq(r, 0);
>> +	}
>> +}
>> +
>> +static void
>> +amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
>> +{
>> +	amdgpu_bo_handle bo_handle, find_bo_handle;
>> +	amdgpu_va_handle va_handle;
>> +	void *bo_cpu;
>> +	uint64_t bo_mc_address;
>> +	uint64_t offset;
>> +	int r;
>> +
>> +	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
>> +				    AMDGPU_GEM_DOMAIN_GTT, 0,
>> +				    &bo_handle, &bo_cpu,
>> +				    &bo_mc_address, &va_handle);
>> +	igt_assert_eq(r, 0);
>> +
>> +	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
>> +					  bo_cpu,
>> +					  4096,
>> +					  &find_bo_handle,
>> +					  &offset);
>> +	igt_assert_eq(r, 0);
>> +	igt_assert_eq(offset, 0);
>> +
>> +	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
>> +				     bo_mc_address, 4096);
>> +}
>> +
>> +igt_main
>> +{
>> +	amdgpu_device_handle device;
>> +	struct bo_data bo;
>> +	int fd = -1;
>> +
>> +	igt_fixture {
>> +		uint32_t major, minor;
>> +		int err;
>> +
>> +		fd = drm_open_driver(DRIVER_AMDGPU);
>> +		err = amdgpu_device_initialize(fd, &major, &minor, &device);
>> +		igt_require(err == 0);
>> +		igt_info("Initialized amdgpu, driver version %d.%d\n",
>> +			 major, minor);
>> +
>> +		amdgpu_bo_init(device, &bo);
>> +	}
>> +
>> +	igt_subtest("amdgpu_bo_export_import")
>> +	amdgpu_bo_export_import(device, &bo);
>> +
>> +	igt_subtest("amdgpu_bo_metadata")
>> +	amdgpu_bo_metadata(device, &bo);
>> +
>> +	igt_subtest("amdgpu_bo_map_unmap")
>> +	amdgpu_bo_map_unmap(device, &bo);
>> +
>> +	igt_subtest("amdgpu_memory_alloc")
>> +	amdgpu_memory_alloc(device);
>> +
>> +	igt_subtest("amdgpu_mem_fail_alloc")
>> +	amdgpu_mem_fail_alloc(device);
>> +
>> +	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
>> +	amdgpu_bo_find_by_cpu_mapping(device);
>> +
>> +	igt_fixture {
>> +		amdgpu_bo_clean(device, &bo);
>> +		amdgpu_device_deinitialize(device);
>> +		close(fd);
>> +	}
>> +}
>> +
>> diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
>> index 7fff7602f..43326a7c4 100644
>> --- a/tests/amdgpu/meson.build
>> +++ b/tests/amdgpu/meson.build
>> @@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
>>  	amdgpu_progs += [ 'amd_abm',
>>  			  'amd_assr',
>>  			  'amd_basic',
>> +			  'amd_bo',
>>  			  'amd_bypass',
>>  			  'amd_deadlock',
>>  			  'amd_pci_unplug',
>> -- 
>> 2.25.1
>>

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

* [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
@ 2023-06-15 22:39 vitaly.prosyak
  0 siblings, 0 replies; 12+ messages in thread
From: vitaly.prosyak @ 2023-06-15 22:39 UTC (permalink / raw)
  To: igt-dev; +Cc: alexander.deucher, michael.strawbridge, christian.koenig

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

The tests do the validation the following bo features:
 - export/import
 - write/read metadata and then compare with original
 - map/unmap
 - alloc/free
 - find bo mapping

v1-v2 Fix formatting errors, drop debug (it was added by mistake)
      and fix return code - Kamil

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Acked-by Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/amdgpu/amd_bo.c    | 292 +++++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build |   1 +
 2 files changed, 293 insertions(+)
 create mode 100644 tests/amdgpu/amd_bo.c

diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
new file mode 100644
index 000000000..01af2ba93
--- /dev/null
+++ b/tests/amdgpu/amd_bo.c
@@ -0,0 +1,292 @@
+// SPDX-License-Identifier: MIT
+// Copyright 2023 Advanced Micro Devices, Inc.
+
+#include <stdio.h>
+#include <amdgpu.h>
+#include <amdgpu_drm.h>
+
+#include "igt.h"
+#include "lib/amdgpu/amd_memory.h"
+
+
+#define BUFFER_SIZE (4*1024)
+#define BUFFER_ALIGN (4*1024)
+
+struct bo_data {
+	amdgpu_bo_handle buffer_handle;
+	uint64_t virtual_mc_base_address;
+	amdgpu_va_handle va_handle;
+};
+
+static int
+amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	struct amdgpu_bo_alloc_request req = {0};
+	int r;
+
+	req.alloc_size = BUFFER_SIZE;
+	req.phys_alignment = BUFFER_ALIGN;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
+	if (r)
+		return r;
+
+	r = amdgpu_va_range_alloc(device_handle,
+				  amdgpu_gpu_va_range_general,
+				  BUFFER_SIZE, BUFFER_ALIGN, 0,
+				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
+	if (r)
+		goto error_va_alloc;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
+	if (r)
+		goto error_va_map;
+
+	return r;
+
+error_va_map:
+	amdgpu_va_range_free(bo->va_handle);
+
+error_va_alloc:
+	amdgpu_bo_free(bo->buffer_handle);
+	return r;
+}
+
+static void
+amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	int r;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			    bo->virtual_mc_base_address, 0,
+			    AMDGPU_VA_OP_UNMAP);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_va_range_free(bo->va_handle);
+	igt_assert_eq(r, 0);
+	r = amdgpu_bo_free(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
+		struct bo_data *bo, enum amdgpu_bo_handle_type type)
+{
+	struct amdgpu_bo_import_result res = {0};
+	uint32_t shared_handle;
+	int r;
+
+	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
+	igt_assert_eq(r, 0);
+
+	igt_assert(res.buf_handle == bo->buffer_handle);
+	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
+
+	r = amdgpu_bo_free(res.buf_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
+{
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_gem_flink_name);
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_dma_buf_fd);
+}
+
+static void
+amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
+{
+	struct amdgpu_bo_metadata meta = {0};
+	struct amdgpu_bo_info info = {0};
+	int r;
+
+	meta.size_metadata = 4;
+	meta.umd_metadata[0] = 0xdeadbeef;
+
+	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
+	igt_assert_eq(r, 0);
+
+	igt_assert_eq(info.metadata.size_metadata, 4);
+	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
+}
+
+static void
+amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
+{
+	uint32_t *ptr;
+	int i, r;
+
+	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
+	igt_assert_eq(r, 0);
+
+	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
+		ptr[i] = 0xdeadbeef;
+
+	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_memory_alloc(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo;
+	amdgpu_va_handle va_handle;
+	uint64_t bo_mc;
+
+	/* Test visible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test invisible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART cacheable */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			0, &bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART USWC */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GDS */
+	bo = gpu_mem_alloc(device_handle, 1024, 0,
+			AMDGPU_GEM_DOMAIN_GDS, 0,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test GWS */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_GWS, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test OA */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_OA, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+}
+
+static void
+amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
+{
+	int r;
+	struct amdgpu_bo_alloc_request req = {0};
+	amdgpu_bo_handle buf_handle;
+
+	/* Test impossible mem allocation, 1TB */
+	req.alloc_size = 0xE8D4A51000;
+	req.phys_alignment = 4096;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
+	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
+	igt_assert_eq(r, -ENOMEM);
+
+	if (!r) {
+		r = amdgpu_bo_free(buf_handle);
+		igt_assert_eq(r, 0);
+	}
+}
+
+static void
+amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo_handle, find_bo_handle;
+	amdgpu_va_handle va_handle;
+	void *bo_cpu;
+	uint64_t bo_mc_address;
+	uint64_t offset;
+	int r;
+
+	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
+				    AMDGPU_GEM_DOMAIN_GTT, 0,
+				    &bo_handle, &bo_cpu,
+				    &bo_mc_address, &va_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
+					  bo_cpu,
+					  4096,
+					  &find_bo_handle,
+					  &offset);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(offset, 0);
+
+	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
+				     bo_mc_address, 4096);
+}
+
+igt_main
+{
+	amdgpu_device_handle device;
+	struct bo_data bo;
+	int fd = -1;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+		err = amdgpu_device_initialize(fd, &major, &minor, &device);
+		igt_require(err == 0);
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+		err = amdgpu_bo_init(device, &bo);
+		igt_require(err == 0);
+	}
+
+	igt_subtest("amdgpu_bo_export_import")
+	amdgpu_bo_export_import(device, &bo);
+
+	igt_subtest("amdgpu_bo_metadata")
+	amdgpu_bo_metadata(device, &bo);
+
+	igt_subtest("amdgpu_bo_map_unmap")
+	amdgpu_bo_map_unmap(device, &bo);
+
+	igt_subtest("amdgpu_memory_alloc")
+	amdgpu_memory_alloc(device);
+
+	igt_subtest("amdgpu_mem_fail_alloc")
+	amdgpu_mem_fail_alloc(device);
+
+	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
+	amdgpu_bo_find_by_cpu_mapping(device);
+
+	igt_fixture {
+		amdgpu_bo_clean(device, &bo);
+		amdgpu_device_deinitialize(device);
+		close(fd);
+	}
+}
+
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index 7fff7602f..43326a7c4 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
 	amdgpu_progs += [ 'amd_abm',
 			  'amd_assr',
 			  'amd_basic',
+			  'amd_bo',
 			  'amd_bypass',
 			  'amd_deadlock',
 			  'amd_pci_unplug',
-- 
2.25.1

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

* Re: [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
  2023-06-15  2:14 vitaly.prosyak
@ 2023-06-15 17:02 ` Kamil Konieczny
  2023-06-15 23:35   ` vitaly prosyak
  0 siblings, 1 reply; 12+ messages in thread
From: Kamil Konieczny @ 2023-06-15 17:02 UTC (permalink / raw)
  To: igt-dev; +Cc: alexander.deucher, michael.strawbridge, christian.koenig

Hi Vitaly,

On 2023-06-14 at 22:14:05 -0400, vitaly.prosyak@amd.com wrote:
> From: Vitaly Prosyak <vitaly.prosyak@amd.com>
> 
> The tests do the validation the following bo features:
>  - export/import
>  - write/read metadata and then compare with original
>  - map/unmap
>  - alloc/free
>  - find bo mapping
> 
> Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
> ---
>  meson.build              |   2 +-
>  tests/amdgpu/amd_bo.c    | 291 +++++++++++++++++++++++++++++++++++++++
>  tests/amdgpu/meson.build |   1 +
>  3 files changed, 293 insertions(+), 1 deletion(-)
>  create mode 100644 tests/amdgpu/amd_bo.c
> 
> diff --git a/meson.build b/meson.build
> index 0487158dc..12269370a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -4,7 +4,7 @@ project('igt-gpu-tools', 'c',
>            'warning_level=2',
>            'c_std=gnu11',
>            'b_ndebug=false',
> -          'buildtype=debugoptimized',
> +          'buildtype=debug',

Drop this change.

>          ],
>  	license : 'MIT',
>  	meson_version : '>=0.47.2')
> diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
> new file mode 100644
> index 000000000..9a95da237
> --- /dev/null
> +++ b/tests/amdgpu/amd_bo.c
> @@ -0,0 +1,291 @@
> +// SPDX-License-Identifier: MIT

Add copyright here.

> +
> +#include <stdio.h>
> +#include <amdgpu.h>
> +#include <amdgpu_drm.h>

Put newline here.

> +#include "igt.h"
> +#include "lib/amdgpu/amd_memory.h"
> +
> +
> +#define BUFFER_SIZE (4*1024)
> +#define BUFFER_ALIGN (4*1024)
> +
> +struct bo_data {
> +	amdgpu_bo_handle buffer_handle;
> +	uint64_t virtual_mc_base_address;
> +	amdgpu_va_handle va_handle;
> +};
> +
> +static int
> +amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
> +{
> +	struct amdgpu_bo_alloc_request req = {0};
> +	int r;
> +
> +	req.alloc_size = BUFFER_SIZE;
> +	req.phys_alignment = BUFFER_ALIGN;
> +	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
> +
> +	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
> +	if (r)
> +		return r;
> +
> +	r = amdgpu_va_range_alloc(device_handle,
> +				  amdgpu_gpu_va_range_general,
> +				  BUFFER_SIZE, BUFFER_ALIGN, 0,
> +				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
> +	if (r)
> +		goto error_va_alloc;
> +
> +	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
> +			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
> +	if (r)
> +		goto error_va_map;
> +

Remove extra empty line.

> +
> +	return 0;
> +
> +error_va_map:
> +	amdgpu_va_range_free(bo->va_handle);
> +
> +error_va_alloc:
> +	amdgpu_bo_free(bo->buffer_handle);
> +	return 1;
-------------- ^
better:	return r;

Regards,
Kamil

> +}
> +
> +static void
> +amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
> +{
> +	int r;
> +
> +	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
> +			    bo->virtual_mc_base_address, 0,
> +			    AMDGPU_VA_OP_UNMAP);
> +	igt_assert_eq(r, 0);
> +
> +	r = amdgpu_va_range_free(bo->va_handle);
> +	igt_assert_eq(r, 0);
> +	r = amdgpu_bo_free(bo->buffer_handle);
> +	igt_assert_eq(r, 0);
> +}
> +
> +static void
> +amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
> +		struct bo_data *bo, enum amdgpu_bo_handle_type type)
> +{
> +	struct amdgpu_bo_import_result res = {0};
> +	uint32_t shared_handle;
> +	int r;
> +
> +	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
> +	igt_assert_eq(r, 0);
> +
> +	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
> +	igt_assert_eq(r, 0);
> +
> +	igt_assert(res.buf_handle == bo->buffer_handle);
> +	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
> +
> +	r = amdgpu_bo_free(res.buf_handle);
> +	igt_assert_eq(r, 0);
> +}
> +
> +static void
> +amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
> +{
> +	amdgpu_bo_export_import_do_type(device, bo,
> +			amdgpu_bo_handle_type_gem_flink_name);
> +	amdgpu_bo_export_import_do_type(device, bo,
> +			amdgpu_bo_handle_type_dma_buf_fd);
> +}
> +
> +static void
> +amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
> +{
> +	struct amdgpu_bo_metadata meta = {0};
> +	struct amdgpu_bo_info info = {0};
> +	int r;
> +
> +	meta.size_metadata = 4;
> +	meta.umd_metadata[0] = 0xdeadbeef;
> +
> +	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
> +	igt_assert_eq(r, 0);
> +
> +	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
> +	igt_assert_eq(r, 0);
> +
> +	igt_assert_eq(info.metadata.size_metadata, 4);
> +	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
> +}
> +
> +static void
> +amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
> +{
> +	uint32_t *ptr;
> +	int i, r;
> +
> +	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
> +	igt_assert_eq(r, 0);
> +
> +	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
> +		ptr[i] = 0xdeadbeef;
> +
> +	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
> +	igt_assert_eq(r, 0);
> +}
> +
> +static void
> +amdgpu_memory_alloc(amdgpu_device_handle device_handle)
> +{
> +	amdgpu_bo_handle bo;
> +	amdgpu_va_handle va_handle;
> +	uint64_t bo_mc;
> +
> +	/* Test visible VRAM */
> +	bo = gpu_mem_alloc(device_handle,
> +			4096, 4096,
> +			AMDGPU_GEM_DOMAIN_VRAM,
> +			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
> +			&bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +
> +	/* Test invisible VRAM */
> +	bo = gpu_mem_alloc(device_handle,
> +			4096, 4096,
> +			AMDGPU_GEM_DOMAIN_VRAM,
> +			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
> +			&bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +
> +	/* Test GART cacheable */
> +	bo = gpu_mem_alloc(device_handle,
> +			4096, 4096,
> +			AMDGPU_GEM_DOMAIN_GTT,
> +			0, &bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +
> +	/* Test GART USWC */
> +	bo = gpu_mem_alloc(device_handle,
> +			4096, 4096,
> +			AMDGPU_GEM_DOMAIN_GTT,
> +			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
> +			&bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +
> +	/* Test GDS */
> +	bo = gpu_mem_alloc(device_handle, 1024, 0,
> +			AMDGPU_GEM_DOMAIN_GDS, 0,
> +			&bo_mc, &va_handle);
> +
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +	/* Test GWS */
> +	bo = gpu_mem_alloc(device_handle, 1, 0,
> +			AMDGPU_GEM_DOMAIN_GWS, 0,
> +			&bo_mc, &va_handle);
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +	/* Test OA */
> +	bo = gpu_mem_alloc(device_handle, 1, 0,
> +			AMDGPU_GEM_DOMAIN_OA, 0,
> +			&bo_mc, &va_handle);
> +	gpu_mem_free(bo, va_handle, bo_mc, 4096);
> +}
> +
> +static void
> +amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
> +{
> +	int r;
> +	struct amdgpu_bo_alloc_request req = {0};
> +	amdgpu_bo_handle buf_handle;
> +
> +	/* Test impossible mem allocation, 1TB */
> +	req.alloc_size = 0xE8D4A51000;
> +	req.phys_alignment = 4096;
> +	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
> +	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
> +
> +	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
> +	igt_assert_eq(r, -ENOMEM);
> +
> +	if (!r) {
> +		r = amdgpu_bo_free(buf_handle);
> +		igt_assert_eq(r, 0);
> +	}
> +}
> +
> +static void
> +amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
> +{
> +	amdgpu_bo_handle bo_handle, find_bo_handle;
> +	amdgpu_va_handle va_handle;
> +	void *bo_cpu;
> +	uint64_t bo_mc_address;
> +	uint64_t offset;
> +	int r;
> +
> +	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
> +				    AMDGPU_GEM_DOMAIN_GTT, 0,
> +				    &bo_handle, &bo_cpu,
> +				    &bo_mc_address, &va_handle);
> +	igt_assert_eq(r, 0);
> +
> +	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
> +					  bo_cpu,
> +					  4096,
> +					  &find_bo_handle,
> +					  &offset);
> +	igt_assert_eq(r, 0);
> +	igt_assert_eq(offset, 0);
> +
> +	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
> +				     bo_mc_address, 4096);
> +}
> +
> +igt_main
> +{
> +	amdgpu_device_handle device;
> +	struct bo_data bo;
> +	int fd = -1;
> +
> +	igt_fixture {
> +		uint32_t major, minor;
> +		int err;
> +
> +		fd = drm_open_driver(DRIVER_AMDGPU);
> +		err = amdgpu_device_initialize(fd, &major, &minor, &device);
> +		igt_require(err == 0);
> +		igt_info("Initialized amdgpu, driver version %d.%d\n",
> +			 major, minor);
> +
> +		amdgpu_bo_init(device, &bo);
> +	}
> +
> +	igt_subtest("amdgpu_bo_export_import")
> +	amdgpu_bo_export_import(device, &bo);
> +
> +	igt_subtest("amdgpu_bo_metadata")
> +	amdgpu_bo_metadata(device, &bo);
> +
> +	igt_subtest("amdgpu_bo_map_unmap")
> +	amdgpu_bo_map_unmap(device, &bo);
> +
> +	igt_subtest("amdgpu_memory_alloc")
> +	amdgpu_memory_alloc(device);
> +
> +	igt_subtest("amdgpu_mem_fail_alloc")
> +	amdgpu_mem_fail_alloc(device);
> +
> +	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
> +	amdgpu_bo_find_by_cpu_mapping(device);
> +
> +	igt_fixture {
> +		amdgpu_bo_clean(device, &bo);
> +		amdgpu_device_deinitialize(device);
> +		close(fd);
> +	}
> +}
> +
> diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
> index 7fff7602f..43326a7c4 100644
> --- a/tests/amdgpu/meson.build
> +++ b/tests/amdgpu/meson.build
> @@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
>  	amdgpu_progs += [ 'amd_abm',
>  			  'amd_assr',
>  			  'amd_basic',
> +			  'amd_bo',
>  			  'amd_bypass',
>  			  'amd_deadlock',
>  			  'amd_pci_unplug',
> -- 
> 2.25.1
> 

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

* [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests
@ 2023-06-15  2:14 vitaly.prosyak
  2023-06-15 17:02 ` Kamil Konieczny
  0 siblings, 1 reply; 12+ messages in thread
From: vitaly.prosyak @ 2023-06-15  2:14 UTC (permalink / raw)
  To: igt-dev; +Cc: alexander.deucher, michael.strawbridge, christian.koenig

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

The tests do the validation the following bo features:
 - export/import
 - write/read metadata and then compare with original
 - map/unmap
 - alloc/free
 - find bo mapping

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
---
 meson.build              |   2 +-
 tests/amdgpu/amd_bo.c    | 291 +++++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build |   1 +
 3 files changed, 293 insertions(+), 1 deletion(-)
 create mode 100644 tests/amdgpu/amd_bo.c

diff --git a/meson.build b/meson.build
index 0487158dc..12269370a 100644
--- a/meson.build
+++ b/meson.build
@@ -4,7 +4,7 @@ project('igt-gpu-tools', 'c',
           'warning_level=2',
           'c_std=gnu11',
           'b_ndebug=false',
-          'buildtype=debugoptimized',
+          'buildtype=debug',
         ],
 	license : 'MIT',
 	meson_version : '>=0.47.2')
diff --git a/tests/amdgpu/amd_bo.c b/tests/amdgpu/amd_bo.c
new file mode 100644
index 000000000..9a95da237
--- /dev/null
+++ b/tests/amdgpu/amd_bo.c
@@ -0,0 +1,291 @@
+// SPDX-License-Identifier: MIT
+
+#include <stdio.h>
+#include <amdgpu.h>
+#include <amdgpu_drm.h>
+#include "igt.h"
+#include "lib/amdgpu/amd_memory.h"
+
+
+#define BUFFER_SIZE (4*1024)
+#define BUFFER_ALIGN (4*1024)
+
+struct bo_data {
+	amdgpu_bo_handle buffer_handle;
+	uint64_t virtual_mc_base_address;
+	amdgpu_va_handle va_handle;
+};
+
+static int
+amdgpu_bo_init(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	struct amdgpu_bo_alloc_request req = {0};
+	int r;
+
+	req.alloc_size = BUFFER_SIZE;
+	req.phys_alignment = BUFFER_ALIGN;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &bo->buffer_handle);
+	if (r)
+		return r;
+
+	r = amdgpu_va_range_alloc(device_handle,
+				  amdgpu_gpu_va_range_general,
+				  BUFFER_SIZE, BUFFER_ALIGN, 0,
+				  &bo->virtual_mc_base_address, &bo->va_handle, 0);
+	if (r)
+		goto error_va_alloc;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			bo->virtual_mc_base_address, 0, AMDGPU_VA_OP_MAP);
+	if (r)
+		goto error_va_map;
+
+
+	return 0;
+
+error_va_map:
+	amdgpu_va_range_free(bo->va_handle);
+
+error_va_alloc:
+	amdgpu_bo_free(bo->buffer_handle);
+	return 1;
+}
+
+static void
+amdgpu_bo_clean(amdgpu_device_handle device_handle, struct bo_data *bo)
+{
+	int r;
+
+	r = amdgpu_bo_va_op(bo->buffer_handle, 0, BUFFER_SIZE,
+			    bo->virtual_mc_base_address, 0,
+			    AMDGPU_VA_OP_UNMAP);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_va_range_free(bo->va_handle);
+	igt_assert_eq(r, 0);
+	r = amdgpu_bo_free(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import_do_type(amdgpu_device_handle device_handle,
+		struct bo_data *bo, enum amdgpu_bo_handle_type type)
+{
+	struct amdgpu_bo_import_result res = {0};
+	uint32_t shared_handle;
+	int r;
+
+	r = amdgpu_bo_export(bo->buffer_handle, type, &shared_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_import(device_handle, type, shared_handle, &res);
+	igt_assert_eq(r, 0);
+
+	igt_assert(res.buf_handle == bo->buffer_handle);
+	igt_assert_eq(res.alloc_size, BUFFER_SIZE);
+
+	r = amdgpu_bo_free(res.buf_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_bo_export_import(amdgpu_device_handle device, struct bo_data *bo)
+{
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_gem_flink_name);
+	amdgpu_bo_export_import_do_type(device, bo,
+			amdgpu_bo_handle_type_dma_buf_fd);
+}
+
+static void
+amdgpu_bo_metadata(amdgpu_device_handle device, struct bo_data *bo)
+{
+	struct amdgpu_bo_metadata meta = {0};
+	struct amdgpu_bo_info info = {0};
+	int r;
+
+	meta.size_metadata = 4;
+	meta.umd_metadata[0] = 0xdeadbeef;
+
+	r = amdgpu_bo_set_metadata(bo->buffer_handle, &meta);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_bo_query_info(bo->buffer_handle, &info);
+	igt_assert_eq(r, 0);
+
+	igt_assert_eq(info.metadata.size_metadata, 4);
+	igt_assert_eq(info.metadata.umd_metadata[0], 0xdeadbeef);
+}
+
+static void
+amdgpu_bo_map_unmap(amdgpu_device_handle device, struct bo_data *bo)
+{
+	uint32_t *ptr;
+	int i, r;
+
+	r = amdgpu_bo_cpu_map(bo->buffer_handle, (void **)&ptr);
+	igt_assert_eq(r, 0);
+
+	for (i = 0; i < (BUFFER_SIZE / 4); ++i)
+		ptr[i] = 0xdeadbeef;
+
+	r = amdgpu_bo_cpu_unmap(bo->buffer_handle);
+	igt_assert_eq(r, 0);
+}
+
+static void
+amdgpu_memory_alloc(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo;
+	amdgpu_va_handle va_handle;
+	uint64_t bo_mc;
+
+	/* Test visible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test invisible VRAM */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART cacheable */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			0, &bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GART USWC */
+	bo = gpu_mem_alloc(device_handle,
+			4096, 4096,
+			AMDGPU_GEM_DOMAIN_GTT,
+			AMDGPU_GEM_CREATE_CPU_GTT_USWC,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+
+	/* Test GDS */
+	bo = gpu_mem_alloc(device_handle, 1024, 0,
+			AMDGPU_GEM_DOMAIN_GDS, 0,
+			&bo_mc, &va_handle);
+
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test GWS */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_GWS, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+	/* Test OA */
+	bo = gpu_mem_alloc(device_handle, 1, 0,
+			AMDGPU_GEM_DOMAIN_OA, 0,
+			&bo_mc, &va_handle);
+	gpu_mem_free(bo, va_handle, bo_mc, 4096);
+}
+
+static void
+amdgpu_mem_fail_alloc(amdgpu_device_handle device_handle)
+{
+	int r;
+	struct amdgpu_bo_alloc_request req = {0};
+	amdgpu_bo_handle buf_handle;
+
+	/* Test impossible mem allocation, 1TB */
+	req.alloc_size = 0xE8D4A51000;
+	req.phys_alignment = 4096;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
+	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
+	igt_assert_eq(r, -ENOMEM);
+
+	if (!r) {
+		r = amdgpu_bo_free(buf_handle);
+		igt_assert_eq(r, 0);
+	}
+}
+
+static void
+amdgpu_bo_find_by_cpu_mapping(amdgpu_device_handle device_handle)
+{
+	amdgpu_bo_handle bo_handle, find_bo_handle;
+	amdgpu_va_handle va_handle;
+	void *bo_cpu;
+	uint64_t bo_mc_address;
+	uint64_t offset;
+	int r;
+
+	r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096,
+				    AMDGPU_GEM_DOMAIN_GTT, 0,
+				    &bo_handle, &bo_cpu,
+				    &bo_mc_address, &va_handle);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_find_bo_by_cpu_mapping(device_handle,
+					  bo_cpu,
+					  4096,
+					  &find_bo_handle,
+					  &offset);
+	igt_assert_eq(r, 0);
+	igt_assert_eq(offset, 0);
+
+	amdgpu_bo_unmap_and_free(bo_handle, va_handle,
+				     bo_mc_address, 4096);
+}
+
+igt_main
+{
+	amdgpu_device_handle device;
+	struct bo_data bo;
+	int fd = -1;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+		err = amdgpu_device_initialize(fd, &major, &minor, &device);
+		igt_require(err == 0);
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+
+		amdgpu_bo_init(device, &bo);
+	}
+
+	igt_subtest("amdgpu_bo_export_import")
+	amdgpu_bo_export_import(device, &bo);
+
+	igt_subtest("amdgpu_bo_metadata")
+	amdgpu_bo_metadata(device, &bo);
+
+	igt_subtest("amdgpu_bo_map_unmap")
+	amdgpu_bo_map_unmap(device, &bo);
+
+	igt_subtest("amdgpu_memory_alloc")
+	amdgpu_memory_alloc(device);
+
+	igt_subtest("amdgpu_mem_fail_alloc")
+	amdgpu_mem_fail_alloc(device);
+
+	igt_subtest("amdgpu_bo_find_by_cpu_mapping")
+	amdgpu_bo_find_by_cpu_mapping(device);
+
+	igt_fixture {
+		amdgpu_bo_clean(device, &bo);
+		amdgpu_device_deinitialize(device);
+		close(fd);
+	}
+}
+
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index 7fff7602f..43326a7c4 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -5,6 +5,7 @@ if libdrm_amdgpu.found()
 	amdgpu_progs += [ 'amd_abm',
 			  'amd_assr',
 			  'amd_basic',
+			  'amd_bo',
 			  'amd_bypass',
 			  'amd_deadlock',
 			  'amd_pci_unplug',
-- 
2.25.1

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

end of thread, other threads:[~2023-06-30 23:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-15  2:12 [igt-dev] [PATCH 1/2] tests/amdgpu: add bo tests vitaly.prosyak
2023-06-15  2:12 ` [igt-dev] [PATCH 2/2] tests/amdgpu: add sync object tests vitaly.prosyak
2023-06-15  2:38 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [1/2] tests/amdgpu: add bo tests Patchwork
2023-06-15  7:53 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2023-06-28 21:07 ` [igt-dev] [PATCH 1/2] " Kamil Konieczny
2023-06-15  2:14 vitaly.prosyak
2023-06-15 17:02 ` Kamil Konieczny
2023-06-15 23:35   ` vitaly prosyak
2023-06-15 22:39 vitaly.prosyak
2023-06-19 20:37 vitaly.prosyak
2023-06-21  0:39 vitaly.prosyak
2023-06-30 23:31 vitaly.prosyak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.