Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH 4/4] drm/xe: Convert pre-GMDID IPs to struct xe_ip
Date: Thu, 20 Feb 2025 14:25:11 -0300	[thread overview]
Message-ID: <20250220172532.66613-5-gustavo.sousa@intel.com> (raw)
In-Reply-To: <20250220172532.66613-1-gustavo.sousa@intel.com>

We have now a struct xe_ip to fully describe an IP, but we are only
using that for GMDID-based IPs.

For pre-GMDID IPs, we still describe release info (version and name) via
feature descriptors (struct xe_{graphics,media}_desc). Let's convert
those to use struct xe_ip.

With this, we have a uniform way of describing IPs in the xe driver
instead of having different approaches based on whether the IPs use
GMDIDs or not.

A nice side-effect of this change is that now we have an easy way to
lookup, in the source code, mappings between versions, names and
features for all supported IPs.

Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
---
 drivers/gpu/drm/xe/xe_pci.c       | 60 ++++++++++++++++---------------
 drivers/gpu/drm/xe/xe_pci_types.h |  8 -----
 2 files changed, 32 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 8b8111e954c1..c88c2da1e731 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -82,10 +82,6 @@ __diag_ignore_all("-Woverride-init", "Allow field overrides in table");
 #define NOP(x)	x
 
 static const struct xe_graphics_desc graphics_xelp = {
-	.name = "Xe_LP",
-	.ver = 12,
-	.rel = 0,
-
 	.hw_engine_mask = BIT(XE_HW_ENGINE_RCS0) | BIT(XE_HW_ENGINE_BCS0),
 
 	.va_bits = 48,
@@ -93,10 +89,6 @@ static const struct xe_graphics_desc graphics_xelp = {
 };
 
 static const struct xe_graphics_desc graphics_xelpp = {
-	.name = "Xe_LP+",
-	.ver = 12,
-	.rel = 10,
-
 	.hw_engine_mask = BIT(XE_HW_ENGINE_RCS0) | BIT(XE_HW_ENGINE_BCS0),
 
 	.va_bits = 48,
@@ -109,10 +101,6 @@ static const struct xe_graphics_desc graphics_xelpp = {
 	.vm_max_level = 3
 
 static const struct xe_graphics_desc graphics_xehpg = {
-	.name = "Xe_HPG",
-	.ver = 12,
-	.rel = 55,
-
 	.hw_engine_mask =
 		BIT(XE_HW_ENGINE_RCS0) | BIT(XE_HW_ENGINE_BCS0) |
 		BIT(XE_HW_ENGINE_CCS0) | BIT(XE_HW_ENGINE_CCS1) |
@@ -125,10 +113,6 @@ static const struct xe_graphics_desc graphics_xehpg = {
 };
 
 static const struct xe_graphics_desc graphics_xehpc = {
-	.name = "Xe_HPC",
-	.ver = 12,
-	.rel = 60,
-
 	.hw_engine_mask =
 		BIT(XE_HW_ENGINE_BCS0) | BIT(XE_HW_ENGINE_BCS1) |
 		BIT(XE_HW_ENGINE_BCS2) | BIT(XE_HW_ENGINE_BCS3) |
@@ -175,20 +159,12 @@ static const struct xe_graphics_desc graphics_xe2 = {
 };
 
 static const struct xe_media_desc media_xem = {
-	.name = "Xe_M",
-	.ver = 12,
-	.rel = 0,
-
 	.hw_engine_mask =
 		GENMASK(XE_HW_ENGINE_VCS7, XE_HW_ENGINE_VCS0) |
 		GENMASK(XE_HW_ENGINE_VECS3, XE_HW_ENGINE_VECS0),
 };
 
 static const struct xe_media_desc media_xehpm = {
-	.name = "Xe_HPM",
-	.ver = 12,
-	.rel = 55,
-
 	.hw_engine_mask =
 		GENMASK(XE_HW_ENGINE_VCS7, XE_HW_ENGINE_VCS0) |
 		GENMASK(XE_HW_ENGINE_VECS3, XE_HW_ENGINE_VECS0),
@@ -369,6 +345,13 @@ static const struct xe_device_desc ptl_desc = {
 #undef PLATFORM
 __diag_pop();
 
+static const struct xe_ip pre_gmdid_ips[] = {
+	{ 1200, "Xe_LP", &graphics_xelp },
+	{ 1210, "Xe_LP+", &graphics_xelpp },
+	{ 1255, "Xe_HPG", &graphics_xehpg },
+	{ 1260, "Xe_HPC", &graphics_xehpc },
+};
+
 /* GMDID-based Graphics IPs */
 static const struct xe_ip graphics_ips[] = {
 	{ 1270, "Xe_LPG", &graphics_xelpg },
@@ -380,6 +363,11 @@ static const struct xe_ip graphics_ips[] = {
 	{ 3001, "Xe3_LPG", &graphics_xe2 },
 };
 
+static const struct xe_ip pre_gmdid_media_ips[] = {
+	{ 1200, "Xe_M", &media_xem },
+	{ 1255, "Xe_HPM", &media_xehpm },
+};
+
 /* GMDID-based Media IPs */
 static const struct xe_ip media_ips[] = {
 	{ 1300, "Xe_LPM+", &media_xelpmp },
@@ -558,12 +546,28 @@ static void handle_pre_gmdid(struct xe_device *xe,
 			     const struct xe_graphics_desc *graphics,
 			     const struct xe_media_desc *media)
 {
-	xe->info.graphics_verx100 = graphics->ver * 100 + graphics->rel;
-	xe->info.graphics_name = graphics->name;
+	for (int i = 0; i < ARRAY_SIZE(pre_gmdid_ips); i++) {
+		if (pre_gmdid_ips[i].desc == graphics) {
+			xe->info.graphics_verx100 = pre_gmdid_ips[i].verx100;
+			xe->info.graphics_name = pre_gmdid_ips[i].name;
+
+			break;
+		}
+	}
+
+	xe_assert(xe, xe->info.graphics_verx100);
 
 	if (media) {
-		xe->info.media_verx100 = media->ver * 100 + media->rel;
-		xe->info.media_name = media->name;
+		for (int i = 0; i < ARRAY_SIZE(pre_gmdid_media_ips); i++) {
+			if (pre_gmdid_media_ips[i].desc == media) {
+				xe->info.media_verx100 = pre_gmdid_media_ips[i].verx100;
+				xe->info.media_name = pre_gmdid_media_ips[i].name;
+
+				break;
+			}
+		}
+
+		xe_assert(xe, xe->info.media_verx100);
 	} else {
 		xe->info.media_name = "none";
 	}
diff --git a/drivers/gpu/drm/xe/xe_pci_types.h b/drivers/gpu/drm/xe/xe_pci_types.h
index f46426ef8ed8..e9b9bbc138d3 100644
--- a/drivers/gpu/drm/xe/xe_pci_types.h
+++ b/drivers/gpu/drm/xe/xe_pci_types.h
@@ -9,10 +9,6 @@
 #include <linux/types.h>
 
 struct xe_graphics_desc {
-	const char *name;
-	u8 ver;
-	u8 rel;
-
 	u8 va_bits;
 	u8 vm_max_level;
 	u8 vram_flags;
@@ -28,10 +24,6 @@ struct xe_graphics_desc {
 };
 
 struct xe_media_desc {
-	const char *name;
-	u8 ver;
-	u8 rel;
-
 	u64 hw_engine_mask;	/* hardware engines provided by media IP */
 
 	u8 has_indirect_ring_state:1;
-- 
2.48.1


  parent reply	other threads:[~2025-02-20 17:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 17:25 [PATCH 0/4] drm/xe: Unify IP descriptors Gustavo Sousa
2025-02-20 17:25 ` [PATCH 1/4] drm/xe: Set IP names in functions handling IP version Gustavo Sousa
2025-02-20 20:40   ` Matt Roper
2025-02-20 17:25 ` [PATCH 2/4] drm/xe: Disambiguate GMDID-based IP names Gustavo Sousa
2025-02-20 20:45   ` Matt Roper
2025-02-20 17:25 ` [PATCH 3/4] drm/xe: Rename gmdid_map to xe_ip Gustavo Sousa
2025-02-20 20:52   ` Matt Roper
2025-02-20 17:25 ` Gustavo Sousa [this message]
2025-02-20 21:10   ` [PATCH 4/4] drm/xe: Convert pre-GMDID IPs to struct xe_ip Matt Roper
2025-02-20 21:23     ` Gustavo Sousa
2025-02-20 21:25       ` Gustavo Sousa
2025-02-20 21:31         ` Matt Roper
2025-02-20 18:02 ` ✓ CI.Patch_applied: success for drm/xe: Unify IP descriptors Patchwork
2025-02-20 18:02 ` ✓ CI.checkpatch: " Patchwork
2025-02-20 18:03 ` ✓ CI.KUnit: " Patchwork
2025-02-20 18:20 ` ✓ CI.Build: " Patchwork
2025-02-20 18:22 ` ✓ CI.Hooks: " Patchwork
2025-02-20 18:23 ` ✓ CI.checksparse: " Patchwork
2025-02-20 18:55 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-21 12:53 ` ✗ Xe.CI.Full: 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=20250220172532.66613-5-gustavo.sousa@intel.com \
    --to=gustavo.sousa@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox