All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Francois Dugast <francois.dugast@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [Intel-xe] [PATCH v2 08/14] drm/xe/uapi: Split xe_sync types from flags
Date: Wed, 22 Nov 2023 14:38:27 +0000	[thread overview]
Message-ID: <20231122143833.7-9-francois.dugast@intel.com> (raw)
In-Reply-To: <20231122143833.7-1-francois.dugast@intel.com>

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

Let's continue on the uapi clean-up with more splits
with stuff into their own exclusive fields instead of
reusing stuff.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
---
 drivers/gpu/drm/xe/xe_sync.c       | 23 +++++++----------------
 drivers/gpu/drm/xe/xe_sync_types.h |  1 +
 include/uapi/drm/xe_drm.h          | 16 ++++++++--------
 3 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
index eafe53c2f55d..883987b27c4e 100644
--- a/drivers/gpu/drm/xe/xe_sync.c
+++ b/drivers/gpu/drm/xe/xe_sync.c
@@ -17,8 +17,6 @@
 #include "xe_macros.h"
 #include "xe_sched_job_types.h"
 
-#define SYNC_FLAGS_TYPE_MASK 0x3
-
 struct user_fence {
 	struct xe_device *xe;
 	struct kref refcount;
@@ -109,15 +107,13 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
 	if (copy_from_user(&sync_in, sync_user, sizeof(*sync_user)))
 		return -EFAULT;
 
-	if (XE_IOCTL_DBG(xe, sync_in.flags &
-			 ~(SYNC_FLAGS_TYPE_MASK | DRM_XE_SYNC_FLAG_SIGNAL)) ||
-	    XE_IOCTL_DBG(xe, sync_in.pad) ||
+	if (XE_IOCTL_DBG(xe, sync_in.flags & ~DRM_XE_SYNC_FLAG_SIGNAL) ||
 	    XE_IOCTL_DBG(xe, sync_in.reserved[0] || sync_in.reserved[1]))
 		return -EINVAL;
 
 	signal = sync_in.flags & DRM_XE_SYNC_FLAG_SIGNAL;
-	switch (sync_in.flags & SYNC_FLAGS_TYPE_MASK) {
-	case DRM_XE_SYNC_FLAG_SYNCOBJ:
+	switch (sync_in.type) {
+	case DRM_XE_SYNC_TYPE_SYNCOBJ:
 		if (XE_IOCTL_DBG(xe, no_dma_fences && signal))
 			return -EOPNOTSUPP;
 
@@ -135,7 +131,7 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
 		}
 		break;
 
-	case DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ:
+	case DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ:
 		if (XE_IOCTL_DBG(xe, no_dma_fences && signal))
 			return -EOPNOTSUPP;
 
@@ -165,12 +161,7 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
 		}
 		break;
 
-	case DRM_XE_SYNC_FLAG_DMA_BUF:
-		if (XE_IOCTL_DBG(xe, "TODO"))
-			return -EINVAL;
-		break;
-
-	case DRM_XE_SYNC_FLAG_USER_FENCE:
+	case DRM_XE_SYNC_TYPE_USER_FENCE:
 		if (XE_IOCTL_DBG(xe, !signal))
 			return -EOPNOTSUPP;
 
@@ -192,6 +183,7 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
 		return -EINVAL;
 	}
 
+	sync->type = sync_in.type;
 	sync->flags = sync_in.flags;
 	sync->timeline_value = sync_in.timeline_value;
 
@@ -252,8 +244,7 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct xe_sched_job *job,
 			user_fence_put(sync->ufence);
 			dma_fence_put(fence);
 		}
-	} else if ((sync->flags & SYNC_FLAGS_TYPE_MASK) ==
-		   DRM_XE_SYNC_FLAG_USER_FENCE) {
+	} else if (sync->type == DRM_XE_SYNC_TYPE_USER_FENCE) {
 		job->user_fence.used = true;
 		job->user_fence.addr = sync->addr;
 		job->user_fence.value = sync->timeline_value;
diff --git a/drivers/gpu/drm/xe/xe_sync_types.h b/drivers/gpu/drm/xe/xe_sync_types.h
index 24fccc26cb53..852db5e7884f 100644
--- a/drivers/gpu/drm/xe/xe_sync_types.h
+++ b/drivers/gpu/drm/xe/xe_sync_types.h
@@ -21,6 +21,7 @@ struct xe_sync_entry {
 	struct user_fence *ufence;
 	u64 addr;
 	u64 timeline_value;
+	u32 type;
 	u32 flags;
 };
 
diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
index fe911728fd97..f2bdc6e323e4 100644
--- a/include/uapi/drm/xe_drm.h
+++ b/include/uapi/drm/xe_drm.h
@@ -880,16 +880,16 @@ struct drm_xe_sync {
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
 
-#define DRM_XE_SYNC_FLAG_SYNCOBJ		0x0
-#define DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ	0x1
-#define DRM_XE_SYNC_FLAG_DMA_BUF		0x2
-#define DRM_XE_SYNC_FLAG_USER_FENCE		0x3
-#define DRM_XE_SYNC_FLAG_SIGNAL		0x10
+#define DRM_XE_SYNC_TYPE_SYNCOBJ		0x0
+#define DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ	0x1
+#define DRM_XE_SYNC_TYPE_USER_FENCE		0x2
+	/** @type: Type of the this sync object */
+	__u32 type;
+
+#define DRM_XE_SYNC_FLAG_SIGNAL	(1 << 0)
+	/** @flags: Sync Flags */
 	__u32 flags;
 
-	/** @pad: MBZ */
-	__u32 pad;
-
 	union {
 		__u32 handle;
 
-- 
2.34.1


  parent reply	other threads:[~2023-11-22 14:39 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 14:38 [Intel-xe] [PATCH v2 00/14] uAPI Alignment - Cleanup and future proof Francois Dugast
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 01/14] drm/xe: Extend drm_xe_vm_bind_op Francois Dugast
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 02/14] drm/xe/uapi: Separate bo_create placement from flags Francois Dugast
2023-11-29 19:36   ` Welty, Brian
2023-11-29 20:41     ` Rodrigo Vivi
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 03/14] drm/xe: Make DRM_XE_DEVICE_QUERY_ENGINES future proof Francois Dugast
2023-11-28 21:17   ` Matthew Brost
2023-11-29 16:54     ` Rodrigo Vivi
2023-11-29 12:35       ` Matthew Brost
2023-11-29 20:04         ` Souza, Jose
2023-11-29 22:52           ` Rodrigo Vivi
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 04/14] drm/xe/uapi: Reject bo creation of unaligned size Francois Dugast
2023-11-24 18:15   ` Souza, Jose
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 05/14] drm/xe/uapi: Align on a common way to return arrays (memory regions) Francois Dugast
2023-11-24 18:19   ` Souza, Jose
2023-11-28 20:51     ` Rodrigo Vivi
2023-11-29 12:33       ` Francois Dugast
2023-11-30 20:53   ` Dixit, Ashutosh
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 06/14] drm/xe/uapi: Align on a common way to return arrays (gt) Francois Dugast
2023-11-28 20:51   ` Rodrigo Vivi
2023-11-29 18:30   ` Matt Roper
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 07/14] drm/xe/uapi: Align on a common way to return arrays (engines) Francois Dugast
2023-11-28 20:56   ` Rodrigo Vivi
2023-11-22 14:38 ` Francois Dugast [this message]
2023-11-28 21:19   ` [Intel-xe] [PATCH v2 08/14] drm/xe/uapi: Split xe_sync types from flags Matthew Brost
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 09/14] drm/xe/uapi: Kill tile_mask Francois Dugast
2023-11-29  9:07   ` Matthew Brost
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 10/14] drm/xe/uapi: Crystal Reference Clock updates Francois Dugast
2023-11-24 18:38   ` Souza, Jose
2023-11-29 14:08     ` Francois Dugast
2023-11-29 18:33       ` Souza, Jose
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 11/14] drm/xe/uapi: Remove bogus engine list from the wait_user_fence IOCTL Francois Dugast
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 12/14] drm/xe/uapi: Add Tile ID information to the GT info query Francois Dugast
2023-11-24 18:45   ` Souza, Jose
2023-11-27 14:08     ` Francois Dugast
2023-11-27 14:20       ` Souza, Jose
2023-11-29 18:33         ` Souza, Jose
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 13/14] drm/xe/uapi: Fix various struct padding for 64b alignment Francois Dugast
2023-11-29 17:02   ` Souza, Jose
2023-11-29 17:39     ` Francois Dugast
2023-11-22 14:38 ` [Intel-xe] [PATCH v2 14/14] drm/xe/uapi: Move xe_exec after xe_exec_queue Francois Dugast
2023-11-29 18:34   ` Souza, Jose
2023-11-23 14:14 ` [Intel-xe] ✓ CI.Patch_applied: success for uAPI Alignment - Cleanup and future proof (rev5) Patchwork
2023-11-23 14:14 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-11-23 14:15 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-11-23 14:23 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-11-23 14:23 ` [Intel-xe] ✗ CI.Hooks: failure " Patchwork
2023-11-23 14:24 ` [Intel-xe] ✓ CI.checksparse: success " Patchwork
2023-11-23 15:01 ` [Intel-xe] ✗ CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231122143833.7-9-francois.dugast@intel.com \
    --to=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.