[PATCH i-g-t V2 1/2] drm-uapi/xe: Add new flag in mmap offset ioctl

Tejas Upadhyay tejas.upadhyay at intel.com
Wed Oct 23 09:43:26 UTC 2024


Add flag in mmap offset for querying special defined
mmap offset for specific purpose like pci membarrier
which requires to write 4K doorbell page mapped at
defined offset.

For user to query special offset, special flag can be
passed in mmap_offset ioctl and used in mmap as follows,
struct drm_xe_gem_mmap_offset mmo = {
	.handle = 0, (this must be set to 0)
	.flags = DRM_XE_MMAP_OFFSET_FLAG_PCI_BARRIER,
};
igt_ioctl(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo);
map = mmap(NULL, size, PROT_WRITE, MAP_SHARED, fd, mmo);

Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
---
 include/drm-uapi/xe_drm.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/drm-uapi/xe_drm.h b/include/drm-uapi/xe_drm.h
index f0a450db9..a04d6f1de 100644
--- a/include/drm-uapi/xe_drm.h
+++ b/include/drm-uapi/xe_drm.h
@@ -817,7 +817,18 @@ struct drm_xe_gem_mmap_offset {
 	/** @handle: Handle for the object being mapped. */
 	__u32 handle;
 
-	/** @flags: Must be zero */
+/**
+ * For user to query special offset we are adding special flag in
+ * mmap_offset ioctl which needs to be passed as follows,
+ * struct drm_xe_gem_mmap_offset mmo = {
+ *      .handle = 0, (this must be set to 0)
+ *      .flags = DRM_XE_MMAP_OFFSET_FLAG_PCI_BARRIER,
+ * };
+ * igt_ioctl(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo);
+ * map = mmap(NULL, size, PROT_WRITE, MAP_SHARED, fd, mmo);
+*/
+#define DRM_XE_MMAP_OFFSET_FLAG_PCI_BARRIER     (1 << 0)
+	/** @flags: Flag to indicate if any special offset, zero otherwise */
 	__u32 flags;
 
 	/** @offset: The fake offset to use for subsequent mmap call */
-- 
2.34.1



More information about the igt-dev mailing list