Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@gmail.com, daniel@ffwll.ch, lucas.demarchi@intel.com,
	rodrigo.vivi@intel.com, jani.nikula@linux.intel.com,
	ray.huang@amd.com, christian.koenig@amd.com, kraxel@redhat.com,
	airlied@redhat.com, suijingfeng@loongson.cn
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 1/6] iosys-map: Add allocator flags
Date: Fri, 14 Jun 2024 15:21:55 +0200	[thread overview]
Message-ID: <20240614133556.11378-2-tzimmermann@suse.de> (raw)
In-Reply-To: <20240614133556.11378-1-tzimmermann@suse.de>

Add the public field alloc_flags to struct iosys_map. It allows for
the allocator of the mapping to store additional flags, such details
about the internal alloctor operations. This will be helpful with
DRM's TTM memory manager, which supports various types of memory in
it's vmap functions.

The new field fills existing padding bytes in struct iosys_map, so
instances of the type do not grow in size.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/iosys-map.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/linux/iosys-map.h b/include/linux/iosys-map.h
index 4696abfd311cc..f3b351094bca0 100644
--- a/include/linux/iosys-map.h
+++ b/include/linux/iosys-map.h
@@ -97,6 +97,11 @@
  *
  *	iosys_map_memcpy_to(&map, src, len);
  *	iosys_map_incr(&map, len); // go to first byte after the memcpy
+ *
+ * The only public field in :c:type:`struct iosys_map <iosys_map>` is
+ * alloc_flags. It allows allocators to store additional information about the
+ * stored memory. Helpers will initialize or clear it to zero, but the values
+ * are only used by the allocator.
  */
 
 /**
@@ -105,6 +110,7 @@
  * @vaddr:		The buffer's address if in system memory
  * @is_iomem:		True if the buffer is located in I/O memory, or false
  *			otherwise.
+ * @alloc_flags		Allocator private flags
  */
 struct iosys_map {
 	union {
@@ -112,6 +118,7 @@ struct iosys_map {
 		void *vaddr;
 	};
 	bool is_iomem;
+	u16 alloc_flags;
 };
 
 /**
@@ -122,6 +129,7 @@ struct iosys_map {
 	{				\
 		.vaddr = (vaddr_),	\
 		.is_iomem = false,	\
+		.alloc_flags = 0,	\
 	}
 
 /**
@@ -132,6 +140,7 @@ struct iosys_map {
 	{						\
 		.vaddr_iomem = (vaddr_iomem_),		\
 		.is_iomem = true,			\
+		.alloc_flags = 0,			\
 	}
 
 /**
@@ -260,7 +269,8 @@ static inline bool iosys_map_is_set(const struct iosys_map *map)
  *
  * Clears all fields to zero, including struct iosys_map.is_iomem, so
  * mapping structures that were set to point to I/O memory are reset for
- * system memory. Pointers are cleared to NULL. This is the default.
+ * system memory. Pointers are cleared to NULL. The allocator flags in
+ * struct iosys_map.alloc_flags are cleared to zero.
  */
 static inline void iosys_map_clear(struct iosys_map *map)
 {
@@ -270,6 +280,7 @@ static inline void iosys_map_clear(struct iosys_map *map)
 	} else {
 		map->vaddr = NULL;
 	}
+	map->alloc_flags = 0;
 }
 
 /**
-- 
2.45.2


  reply	other threads:[~2024-06-14 13:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 13:21 [PATCH 0/6] drm/{ttm,xe}: Improve ttm_bo_vmap() and update xe Thomas Zimmermann
2024-06-14 13:21 ` Thomas Zimmermann [this message]
2024-06-14 13:21 ` [PATCH 2/6] drm/ttm: Store the bo_kmap_type in struct iosys_map Thomas Zimmermann
2024-06-14 14:31   ` Christian König
2024-06-17 12:32     ` Thomas Zimmermann
2024-06-17 12:56       ` Christian König
2024-06-14 13:21 ` [PATCH 3/6] drm/ttm: Support partial buffer mappings for ttm_bo_vmap() Thomas Zimmermann
2024-06-14 14:33   ` Christian König
2024-06-17 13:00     ` Thomas Zimmermann
2024-06-14 13:21 ` [PATCH 4/6] drm/ttm: Support kmap for single-page mappings in ttm_bo_vmap() Thomas Zimmermann
2024-06-14 13:21 ` [PATCH 5/6] drm/xe: Remove vunmap calls object-freeing code Thomas Zimmermann
2024-06-14 13:22 ` [PATCH 6/6] drm/xe: Replace ttm_bo_kmap() with ttm_bo_vmap() Thomas Zimmermann
2024-06-14 13:41 ` ✓ CI.Patch_applied: success for drm/{ttm,xe}: Improve ttm_bo_vmap() and update xe Patchwork
2024-06-14 13:41 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-14 13:42 ` ✓ CI.KUnit: success " Patchwork
2024-06-14 13:54 ` ✓ CI.Build: " Patchwork
2024-06-14 13:56 ` ✗ CI.Hooks: failure " Patchwork
2024-06-14 13:58 ` ✗ CI.checksparse: warning " Patchwork
2024-06-14 14:28 ` ✗ 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=20240614133556.11378-2-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=kraxel@redhat.com \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=suijingfeng@loongson.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox