From: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
Subject: [PATCH v2 1/4] drm/xe/vram: Add binding information to VRAM regions
Date: Fri, 21 Aug 2026 11:45:58 +0200 [thread overview]
Message-ID: <20260821094601.607060-2-piotr.piorkowski@intel.com> (raw)
In-Reply-To: <20260821094601.607060-1-piotr.piorkowski@intel.com>
From: Piotr Piórkowski <piotr.piorkowski@intel.com>
Add a binding field to VRAM regions and pass it at allocation time.
This allows distinguishing VRAM regions serving different purposes. It is
needed for future patches where different VRAM regions serve different
purposes, such as dedicated VRAM for kernel allocations.
Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
---
drivers/gpu/drm/xe/xe_tile.c | 2 +-
drivers/gpu/drm/xe/xe_vram.c | 40 ++++++++++++++++++++++++------
drivers/gpu/drm/xe/xe_vram.h | 6 ++---
drivers/gpu/drm/xe/xe_vram_types.h | 12 ++++++++-
4 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_tile.c b/drivers/gpu/drm/xe/xe_tile.c
index 74d925a337b7..fd0c2e4cbdd2 100644
--- a/drivers/gpu/drm/xe/xe_tile.c
+++ b/drivers/gpu/drm/xe/xe_tile.c
@@ -119,7 +119,7 @@ int xe_tile_alloc_vram(struct xe_tile *tile)
if (!IS_DGFX(xe))
return 0;
- vram = xe_vram_region_alloc(xe, tile->id, XE_PL_VRAM0 + tile->id);
+ vram = xe_vram_region_alloc_tile(xe, tile->id);
if (!vram)
return -ENOMEM;
tile->mem.vram = vram;
diff --git a/drivers/gpu/drm/xe/xe_vram.c b/drivers/gpu/drm/xe/xe_vram.c
index 23eb7edbdd57..e5f83df98826 100644
--- a/drivers/gpu/drm/xe/xe_vram.c
+++ b/drivers/gpu/drm/xe/xe_vram.c
@@ -24,6 +24,16 @@
#include "xe_vram.h"
#include "xe_vram_types.h"
+static const char *stringify_vram_binding(enum xe_vram_binding binding)
+{
+ switch (binding) {
+ case XE_VRAM_BINDING_TILE:
+ return "Tile";
+ }
+
+ return "Unknown";
+}
+
static bool resource_is_valid(struct pci_dev *pdev, int bar)
{
if (!pci_resource_flags(pdev, bar))
@@ -189,7 +199,8 @@ static void vram_fini(void *arg)
}
}
-struct xe_vram_region *xe_vram_region_alloc(struct xe_device *xe, u8 id, u32 placement)
+static struct xe_vram_region *vram_region_alloc(struct xe_device *xe, enum xe_vram_binding binding,
+ u8 id, u32 placement)
{
struct xe_vram_region *vram;
struct drm_device *drm = &xe->drm;
@@ -203,12 +214,25 @@ struct xe_vram_region *xe_vram_region_alloc(struct xe_device *xe, u8 id, u32 pla
vram->xe = xe;
vram->id = id;
vram->placement = placement;
+ vram->binding = binding;
#if defined(CONFIG_DRM_XE_PAGEMAP)
vram->migrate = xe->tiles[id].migrate;
#endif
return vram;
}
+/**
+ * xe_vram_region_alloc_tile - Allocate a tile VRAM region
+ * @xe: the &xe_device
+ * @id: tile id
+ *
+ * Return: the allocated VRAM region, or NULL on failure.
+ */
+struct xe_vram_region *xe_vram_region_alloc_tile(struct xe_device *xe, u8 id)
+{
+ return vram_region_alloc(xe, XE_VRAM_BINDING_TILE, id, XE_PL_VRAM0 + id);
+}
+
static void print_vram_region_info(struct xe_device *xe, struct xe_vram_region *vram)
{
struct drm_device *drm = &xe->drm;
@@ -217,11 +241,13 @@ static void print_vram_region_info(struct xe_device *xe, struct xe_vram_region *
drm_info(drm, "Small BAR device\n");
drm_info(drm,
- "VRAM[%u]: Actual physical size %pa, usable size exclude stolen %pa, CPU accessible size %pa\n",
- vram->id, &vram->actual_physical_size, &vram->usable_size, &vram->io_size);
- drm_info(drm, "VRAM[%u]: DPA range: [%pa-%llx], io range: [%pa-%llx]\n",
- vram->id, &vram->dpa_base, vram->dpa_base + (u64)vram->actual_physical_size,
- &vram->io_start, vram->io_start + (u64)vram->io_size);
+ "%s[%u] VRAM region: Actual physical size %pa, usable size exclude stolen %pa, CPU accessible size %pa\n",
+ stringify_vram_binding(vram->binding), vram->id, &vram->actual_physical_size,
+ &vram->usable_size, &vram->io_size);
+ drm_info(drm, "%s[%u] VRAM region: DPA range: [%pa-%llx], io range: [%pa-%llx]\n",
+ stringify_vram_binding(vram->binding), vram->id, &vram->dpa_base,
+ vram->dpa_base + (u64)vram->actual_physical_size, &vram->io_start,
+ vram->io_start + (u64)vram->io_size);
}
static int vram_region_init(struct xe_device *xe, struct xe_vram_region *vram,
@@ -237,7 +263,7 @@ static int vram_region_init(struct xe_device *xe, struct xe_vram_region *vram,
vram->io_size = min_t(u64, usable_size, remain_io_size);
if (!vram->io_size) {
- drm_err(&xe->drm, "Tile without any CPU visible VRAM. Aborting.\n");
+ drm_err(&xe->drm, "VRAM region without any CPU visible memory\n");
return -ENODEV;
}
diff --git a/drivers/gpu/drm/xe/xe_vram.h b/drivers/gpu/drm/xe/xe_vram.h
index dd1c8bf17922..87088ffbfd5e 100644
--- a/drivers/gpu/drm/xe/xe_vram.h
+++ b/drivers/gpu/drm/xe/xe_vram.h
@@ -8,15 +8,15 @@
#include <linux/types.h>
+#include "xe_vram_types.h"
+
struct xe_device;
-struct xe_vram_region;
struct ttm_resource;
struct xe_vram_region *xe_map_resource_to_region(struct ttm_resource *res);
int xe_vram_probe(struct xe_device *xe);
-struct xe_vram_region *xe_vram_region_alloc(struct xe_device *xe, u8 id, u32 placement);
-
+struct xe_vram_region *xe_vram_region_alloc_tile(struct xe_device *xe, u8 id);
resource_size_t xe_vram_region_io_start(const struct xe_vram_region *vram);
resource_size_t xe_vram_region_io_size(const struct xe_vram_region *vram);
resource_size_t xe_vram_region_dpa_base(const struct xe_vram_region *vram);
diff --git a/drivers/gpu/drm/xe/xe_vram_types.h b/drivers/gpu/drm/xe/xe_vram_types.h
index 646e3c12ae9f..51884e7a679d 100644
--- a/drivers/gpu/drm/xe/xe_vram_types.h
+++ b/drivers/gpu/drm/xe/xe_vram_types.h
@@ -15,6 +15,14 @@
struct xe_device;
struct xe_migrate;
+/**
+ * enum xe_vram_binding - VRAM binding types
+ * @XE_VRAM_BINDING_TILE: general-purpose VRAM region bound to a tile
+ */
+enum xe_vram_binding {
+ XE_VRAM_BINDING_TILE = 0,
+};
+
/**
* struct xe_vram_region - memory region structure
* This is used to describe a memory region in xe
@@ -26,9 +34,11 @@ struct xe_vram_region {
/**
* @id: VRAM region instance id
*
- * The value should be unique for VRAM region.
+ * The value should be unique within a given binding.
*/
u8 id;
+ /** @binding: VRAM region instance binding */
+ enum xe_vram_binding binding;
/** @io_start: IO start address of this VRAM instance */
resource_size_t io_start;
/**
--
2.34.1
next prev parent reply other threads:[~2026-08-21 9:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 9:45 [PATCH v2 0/4] Introduce PF-mem VRAM regions Piórkowski, Piotr
2026-08-21 9:45 ` Piórkowski, Piotr [this message]
2026-08-21 9:54 ` [PATCH v2 1/4] drm/xe/vram: Add binding information to " sashiko-bot
2026-08-21 9:45 ` [PATCH v2 2/4] drm/xe/ttm: Add PF-mem VRAM placement types for TTM Piórkowski, Piotr
2026-08-21 9:46 ` [PATCH v2 3/4] drm/xe/vram: Add initial support for PF-mem regions Piórkowski, Piotr
2026-08-21 9:46 ` [PATCH v2 4/4] drm/xe/kunit: Add tests " Piórkowski, Piotr
2026-08-21 9:54 ` sashiko-bot
2026-08-21 9:52 ` ✗ CI.checkpatch: warning for Introduce PF-mem VRAM regions (rev2) Patchwork
2026-08-21 9:53 ` ✓ CI.KUnit: success " Patchwork
2026-08-21 10:16 ` [PATCH v2 0/4] Introduce PF-mem VRAM regions Matthew Auld
2026-08-21 10:33 ` ✓ Xe.CI.BAT: success for Introduce PF-mem VRAM regions (rev2) Patchwork
2026-08-21 11:43 ` ✓ Xe.CI.FULL: " 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=20260821094601.607060-2-piotr.piorkowski@intel.com \
--to=piotr.piorkowski@intel.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.