From: Christopher Snowhill <kode54@gmail.com>
To: intel-xe@lists.freedesktop.org
Subject: [Intel-xe] [PATCH 1/2] drm/xe: Add explicit padding to uAPI definition
Date: Tue, 23 May 2023 20:31:30 -0700 [thread overview]
Message-ID: <20230524033131.2000480-2-kode54@gmail.com> (raw)
In-Reply-To: <20230524033131.2000480-1-kode54@gmail.com>
Pad the uAPI definition so that it would align identically between
64-bit and 32-bit uarch, so consumers using this header will work
correctly from 32-bit compat userspace on a 64-bit kernel. Do it
in a minimally invasive way, so that 64-bit userspace will still
work with the previous header, and so that no fields suddenly
change sizes.
Originally inspired by mlankhorst.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
---
include/uapi/drm/xe_drm.h | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
index b0b80aae3ee8..d5fc54b5be74 100644
--- a/include/uapi/drm/xe_drm.h
+++ b/include/uapi/drm/xe_drm.h
@@ -91,7 +91,7 @@ struct xe_user_extension {
*/
__u32 name;
/**
- * @flags: MBZ
+ * @pad: MBZ
*
* All undefined bits must be zero.
*/
@@ -291,6 +291,9 @@ struct drm_xe_gem_create {
*/
__u32 handle;
+ /** @pad: MBZ */
+ __u32 pad;
+
/** @reserved: Reserved */
__u64 reserved[2];
};
@@ -335,6 +338,9 @@ struct drm_xe_ext_vm_set_property {
#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0
__u32 property;
+ /** @pad: MBZ */
+ __u32 pad;
+
/** @value: property value */
__u64 value;
@@ -379,6 +385,9 @@ struct drm_xe_vm_bind_op {
*/
__u32 obj;
+ /** @pad: MBZ */
+ __u32 pad;
+
union {
/**
* @obj_offset: Offset into the object, MBZ for CLEAR_RANGE,
@@ -469,6 +478,9 @@ struct drm_xe_vm_bind {
/** @num_binds: number of binds in this IOCTL */
__u32 num_binds;
+ /** @pad: MBZ */
+ __u32 pad;
+
union {
/** @bind: used if num_binds == 1 */
struct drm_xe_vm_bind_op bind;
@@ -482,6 +494,9 @@ struct drm_xe_vm_bind {
/** @num_syncs: amount of syncs to wait on */
__u32 num_syncs;
+ /** @pad2: MBZ */
+ __u32 pad2;
+
/** @syncs: pointer to struct drm_xe_sync array */
__u64 syncs;
@@ -497,6 +512,9 @@ struct drm_xe_ext_engine_set_property {
/** @property: property to set */
__u32 property;
+ /** @pad: MBZ */
+ __u32 pad;
+
/** @value: property value */
__u64 value;
};
@@ -612,6 +630,9 @@ struct drm_xe_sync {
#define DRM_XE_SYNC_USER_FENCE 0x3
#define DRM_XE_SYNC_SIGNAL 0x10
+ /** @pad: MBZ */
+ __u32 pad;
+
union {
__u32 handle;
/**
@@ -656,6 +677,9 @@ struct drm_xe_exec {
*/
__u16 num_batch_buffer;
+ /** @pad: MBZ */
+ __u16 pad[3];
+
/** @reserved: Reserved */
__u64 reserved[2];
};
@@ -718,6 +742,8 @@ struct drm_xe_wait_user_fence {
#define DRM_XE_UFENCE_WAIT_ABSTIME (1 << 1)
#define DRM_XE_UFENCE_WAIT_VM_ERROR (1 << 2)
__u16 flags;
+ /** @pad: MBZ */
+ __u32 pad;
/** @value: compare value */
__u64 value;
/** @mask: comparison mask */
@@ -750,6 +776,9 @@ struct drm_xe_vm_madvise {
/** @vm_id: The ID VM in which the VMA exists */
__u32 vm_id;
+ /** @pad: MBZ */
+ __u32 pad;
+
/** @range: Number of bytes in the VMA */
__u64 range;
@@ -794,6 +823,9 @@ struct drm_xe_vm_madvise {
/** @property: property to set */
__u32 property;
+ /** @pad2: MBZ */
+ __u32 pad2;
+
/** @value: property value */
__u64 value;
--
2.40.1
next prev parent reply other threads:[~2023-05-24 3:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 3:31 [Intel-xe] [PATCH 0/2] Update Xe uAPI in a minimally invasive way Christopher Snowhill
2023-05-24 3:31 ` Christopher Snowhill [this message]
2023-05-24 15:20 ` [Intel-xe] [PATCH 1/2] drm/xe: Add explicit padding to uAPI definition Souza, Jose
2023-05-24 16:21 ` Lucas De Marchi
2023-05-24 3:31 ` [Intel-xe] [PATCH 2/2] drm/xe: Validate uAPI padding and reserved fields Christopher Snowhill
2023-05-24 15:37 ` Souza, Jose
2023-05-25 1:40 ` Christopher Snowhill
2023-05-25 13:06 ` Souza, Jose
2023-05-24 23:43 ` Lucas De Marchi
2023-05-24 3:34 ` [Intel-xe] ✓ CI.Patch_applied: success for Update Xe uAPI in a minimally invasive way Patchwork
2023-05-24 3:36 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-05-24 3:40 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-05-24 4:08 ` [Intel-xe] ○ CI.BAT: info " 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=20230524033131.2000480-2-kode54@gmail.com \
--to=kode54@gmail.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is 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.