History

drm/xe: Add explicit padding to uAPI definition

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.

Christopher Snowhill committed 3 years ago

Commit e2bd81a1 parent 1b1d3711 file · +33 −1Browse files

Unified · Split

include/uapi/drm/xe_drm.h+33−1
@@ -91,7 +91,7 @@ struct xe_user_extension { · 90 unmodified lines
91 */91 */
92 __u32 name;92 __u32 name;
93 /**93 /**
94 * @flags: MBZ94 * @pad: MBZ
95 *95 *
96 * All undefined bits must be zero.96 * All undefined bits must be zero.
97 */97 */
@@ -291,6 +291,9 @@ struct drm_xe_gem_create { · 193 unmodified lines
291 */291 */
292 __u32 handle;292 __u32 handle;
293 293
294 /** @pad: MBZ */
295 __u32 pad;
296
294 /** @reserved: Reserved */297 /** @reserved: Reserved */
295 __u64 reserved[2];298 __u64 reserved[2];
296};299};
@@ -335,6 +338,9 @@ struct drm_xe_ext_vm_set_property { · 38 unmodified lines
335#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0338#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0
336 __u32 property;339 __u32 property;
337 340
341 /** @pad: MBZ */
342 __u32 pad;
343
338 /** @value: property value */344 /** @value: property value */
339 __u64 value;345 __u64 value;
340 346
@@ -379,6 +385,9 @@ struct drm_xe_vm_bind_op { · 38 unmodified lines
379 */385 */
380 __u32 obj;386 __u32 obj;
381 387
388 /** @pad: MBZ */
389 __u32 pad;
390
382 union {391 union {
383 /**392 /**
384 * @obj_offset: Offset into the object, MBZ for CLEAR_RANGE,393 * @obj_offset: Offset into the object, MBZ for CLEAR_RANGE,
@@ -469,6 +478,9 @@ struct drm_xe_vm_bind { · 84 unmodified lines
469 /** @num_binds: number of binds in this IOCTL */478 /** @num_binds: number of binds in this IOCTL */
470 __u32 num_binds;479 __u32 num_binds;
471 480
481 /** @pad: MBZ */
482 __u32 pad;
483
472 union {484 union {
473 /** @bind: used if num_binds == 1 */485 /** @bind: used if num_binds == 1 */
474 struct drm_xe_vm_bind_op bind;486 struct drm_xe_vm_bind_op bind;
@@ -482,6 +494,9 @@ struct drm_xe_vm_bind { · 7 unmodified lines
482 /** @num_syncs: amount of syncs to wait on */494 /** @num_syncs: amount of syncs to wait on */
483 __u32 num_syncs;495 __u32 num_syncs;
484 496
497 /** @pad2: MBZ */
498 __u32 pad2;
499
485 /** @syncs: pointer to struct drm_xe_sync array */500 /** @syncs: pointer to struct drm_xe_sync array */
486 __u64 syncs;501 __u64 syncs;
487 502
@@ -497,6 +512,9 @@ struct drm_xe_ext_engine_set_property { · 9 unmodified lines
497 /** @property: property to set */512 /** @property: property to set */
498 __u32 property;513 __u32 property;
499 514
515 /** @pad: MBZ */
516 __u32 pad;
517
500 /** @value: property value */518 /** @value: property value */
501 __u64 value;519 __u64 value;
502};520};
@@ -612,6 +630,9 @@ struct drm_xe_sync { · 109 unmodified lines
612#define DRM_XE_SYNC_USER_FENCE 0x3630#define DRM_XE_SYNC_USER_FENCE 0x3
613#define DRM_XE_SYNC_SIGNAL 0x10631#define DRM_XE_SYNC_SIGNAL 0x10
614 632
633 /** @pad: MBZ */
634 __u32 pad;
635
615 union {636 union {
616 __u32 handle;637 __u32 handle;
617 /**638 /**
@@ -656,6 +677,9 @@ struct drm_xe_exec { · 38 unmodified lines
656 */677 */
657 __u16 num_batch_buffer;678 __u16 num_batch_buffer;
658 679
680 /** @pad: MBZ */
681 __u16 pad[3];
682
659 /** @reserved: Reserved */683 /** @reserved: Reserved */
660 __u64 reserved[2];684 __u64 reserved[2];
661};685};
@@ -718,6 +742,8 @@ struct drm_xe_wait_user_fence { · 56 unmodified lines
718#define DRM_XE_UFENCE_WAIT_ABSTIME (1 << 1)742#define DRM_XE_UFENCE_WAIT_ABSTIME (1 << 1)
719#define DRM_XE_UFENCE_WAIT_VM_ERROR (1 << 2)743#define DRM_XE_UFENCE_WAIT_VM_ERROR (1 << 2)
720 __u16 flags;744 __u16 flags;
745 /** @pad: MBZ */
746 __u32 pad;
721 /** @value: compare value */747 /** @value: compare value */
722 __u64 value;748 __u64 value;
723 /** @mask: comparison mask */749 /** @mask: comparison mask */
@@ -750,6 +776,9 @@ struct drm_xe_vm_madvise { · 26 unmodified lines
750 /** @vm_id: The ID VM in which the VMA exists */776 /** @vm_id: The ID VM in which the VMA exists */
751 __u32 vm_id;777 __u32 vm_id;
752 778
779 /** @pad: MBZ */
780 __u32 pad;
781
753 /** @range: Number of bytes in the VMA */782 /** @range: Number of bytes in the VMA */
754 __u64 range;783 __u64 range;
755 784
@@ -794,6 +823,9 @@ struct drm_xe_vm_madvise { · 38 unmodified lines
794 /** @property: property to set */823 /** @property: property to set */
795 __u32 property;824 __u32 property;
796 825
826 /** @pad2: MBZ */
827 __u32 pad2;
828
797 /** @value: property value */829 /** @value: property value */
798 __u64 value;830 __u64 value;
799 831

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t