drm/xe: Disambiguate GMDID-based IP names
authorGustavo Sousa <gustavo.sousa@intel.com>
Fri, 21 Feb 2025 18:51:41 +0000 (15:51 -0300)
committerMatt Roper <matthew.d.roper@intel.com>
Wed, 5 Mar 2025 20:16:04 +0000 (12:16 -0800)
The name of an IP is a function of its version. As such, given an IP
version, it should be clear to identify the name of that IP release.

With the current code, we keep that mapping clear for pre-GMDID IPs, but
ambiguous for GMDID-based ones. That causes two types of inconveniences:

 1. The end user, who might not have all the necessary mapping at hand,
    might be confused when seeing different possible IP names in the
    dmesg log.

 2. It makes a developer who is not familiar with the "IP version" to
    "Release name" need to resort to looking at the specs to understand
    see what version maps to what. While the specs should be the
    authority on the mapping, we should make our lives easier by
    reflecting that mapping in the source code.

Thus, since the IP name is tied to the version, let's  remove the
ambiguity by using a "name" field in struct gmdid_map instead of
accumulating names in the descriptor instances.

This does result in the code having IP name being defined in
different structs (gmdid_map, xe_graphics_desc, xe_media_desc), but that
will be resolved in upcoming changes.

A side-effect of this change is that media_xe2 exactly matches
media_xelpmp now, so we just re-use the latter.

v2:
  - Drop media_xe2 and re-use media_xelpmp. (Matt)

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250221-xe-unify-ip-descriptors-v2-2-5bc0c6d0c13f@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_pci.c
drivers/gpu/drm/xe/xe_pci_types.h

index eb81b1a..772f013 100644 (file)
@@ -149,7 +149,6 @@ static const struct xe_graphics_desc graphics_xehpc = {
 };
 
 static const struct xe_graphics_desc graphics_xelpg = {
-       .name = "Xe_LPG",
        .hw_engine_mask =
                BIT(XE_HW_ENGINE_RCS0) | BIT(XE_HW_ENGINE_BCS0) |
                BIT(XE_HW_ENGINE_CCS0),
@@ -172,8 +171,6 @@ static const struct xe_graphics_desc graphics_xelpg = {
                GENMASK(XE_HW_ENGINE_CCS3, XE_HW_ENGINE_CCS0)
 
 static const struct xe_graphics_desc graphics_xe2 = {
-       .name = "Xe2_LPG / Xe2_HPG / Xe3_LPG",
-
        XE2_GFX_FEATURES,
 };
 
@@ -198,15 +195,6 @@ static const struct xe_media_desc media_xehpm = {
 };
 
 static const struct xe_media_desc media_xelpmp = {
-       .name = "Xe_LPM+",
-       .hw_engine_mask =
-               GENMASK(XE_HW_ENGINE_VCS7, XE_HW_ENGINE_VCS0) |
-               GENMASK(XE_HW_ENGINE_VECS3, XE_HW_ENGINE_VECS0) |
-               BIT(XE_HW_ENGINE_GSCCS0)
-};
-
-static const struct xe_media_desc media_xe2 = {
-       .name = "Xe2_LPM / Xe2_HPM / Xe3_LPM",
        .hw_engine_mask =
                GENMASK(XE_HW_ENGINE_VCS7, XE_HW_ENGINE_VCS0) |
                GENMASK(XE_HW_ENGINE_VECS3, XE_HW_ENGINE_VECS0) |
@@ -372,21 +360,21 @@ __diag_pop();
 
 /* Map of GMD_ID values to graphics IP */
 static const struct gmdid_map graphics_ip_map[] = {
-       { 1270, &graphics_xelpg },
-       { 1271, &graphics_xelpg },
-       { 1274, &graphics_xelpg },      /* Xe_LPG+ */
-       { 2001, &graphics_xe2 },
-       { 2004, &graphics_xe2 },
-       { 3000, &graphics_xe2 },
-       { 3001, &graphics_xe2 },
+       { 1270, "Xe_LPG", &graphics_xelpg },
+       { 1271, "Xe_LPG", &graphics_xelpg },
+       { 1274, "Xe_LPG+", &graphics_xelpg },
+       { 2001, "Xe2_HPG", &graphics_xe2 },
+       { 2004, "Xe2_LPG", &graphics_xe2 },
+       { 3000, "Xe3_LPG", &graphics_xe2 },
+       { 3001, "Xe3_LPG", &graphics_xe2 },
 };
 
 /* Map of GMD_ID values to media IP */
 static const struct gmdid_map media_ip_map[] = {
-       { 1300, &media_xelpmp },
-       { 1301, &media_xe2 },
-       { 2000, &media_xe2 },
-       { 3000, &media_xe2 },
+       { 1300, "Xe_LPM+", &media_xelpmp },
+       { 1301, "Xe2_HPM", &media_xelpmp },
+       { 2000, "Xe2_LPM", &media_xelpmp },
+       { 3000, "Xe3_LPM", &media_xelpmp },
 };
 
 /*
@@ -587,8 +575,8 @@ static void handle_gmdid(struct xe_device *xe,
        for (int i = 0; i < ARRAY_SIZE(graphics_ip_map); i++) {
                if (ver == graphics_ip_map[i].ver) {
                        xe->info.graphics_verx100 = ver;
+                       xe->info.graphics_name = graphics_ip_map[i].name;
                        *graphics = graphics_ip_map[i].ip;
-                       xe->info.graphics_name = (*graphics)->name;
 
                        break;
                }
@@ -609,8 +597,8 @@ static void handle_gmdid(struct xe_device *xe,
        for (int i = 0; i < ARRAY_SIZE(media_ip_map); i++) {
                if (ver == media_ip_map[i].ver) {
                        xe->info.media_verx100 = ver;
+                       xe->info.media_name = media_ip_map[i].name;
                        *media = media_ip_map[i].ip;
-                       xe->info.media_name = (*media)->name;
 
                        break;
                }
index b964238..8e586d0 100644 (file)
@@ -39,6 +39,7 @@ struct xe_media_desc {
 
 struct gmdid_map {
        unsigned int ver;
+       const char *name;
        const void *ip;
 };