]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Rename gmdid_map to xe_ip
authorGustavo Sousa <gustavo.sousa@intel.com>
Fri, 21 Feb 2025 18:51:42 +0000 (15:51 -0300)
committerMatt Roper <matthew.d.roper@intel.com>
Wed, 5 Mar 2025 20:16:04 +0000 (12:16 -0800)
If we pay closer attention to struct gmdid_map, we will realize that it
is actually fully describing an IP (graphics or media): it contains
"release info" and "features info". The former is comprised of fields
"ver" and "name"; and the latter is done via member "ip", which is a
pointer to either struct xe_graphics_desc or xe_media_desc, and can be
reused across releases.

As such let's:

  * Rename struct gmdid_map to xe_ip.
  * Rename the field ver to verx100 to be consistent with the naming of
    members using that encoding of the version.
  * Rename the field "ip" to "desc" to make it clear that it is a
    pointer to a descriptor of features for the IP, since it will not
    contain *all* info (i.e. features + release info).

We sill have release info mapped into struct xe_{graphics,media}_desc
for pre-GMDID IPs. In an upcoming change we will handle that so that we
make a clear separation between "release info" and "feature info".

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-3-5bc0c6d0c13f@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/tests/xe_pci.c
drivers/gpu/drm/xe/xe_pci.c
drivers/gpu/drm/xe/xe_pci_types.h

index 67404863087e78e5a1b3054959d57d29aa7a34af..5132c1961472f7d039783193d608721a717252da 100644 (file)
  */
 void xe_call_for_each_graphics_ip(xe_graphics_fn xe_fn)
 {
-       const struct xe_graphics_desc *ip, *last = NULL;
+       const struct xe_graphics_desc *desc, *last = NULL;
 
-       for (int i = 0; i < ARRAY_SIZE(graphics_ip_map); i++) {
-               ip = graphics_ip_map[i].ip;
-               if (ip == last)
+       for (int i = 0; i < ARRAY_SIZE(graphics_ips); i++) {
+               desc = graphics_ips[i].desc;
+               if (desc == last)
                        continue;
 
-               xe_fn(ip);
-               last = ip;
+               xe_fn(desc);
+               last = desc;
        }
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_call_for_each_graphics_ip);
@@ -43,15 +43,15 @@ EXPORT_SYMBOL_IF_KUNIT(xe_call_for_each_graphics_ip);
  */
 void xe_call_for_each_media_ip(xe_media_fn xe_fn)
 {
-       const struct xe_media_desc *ip, *last = NULL;
+       const struct xe_media_desc *desc, *last = NULL;
 
-       for (int i = 0; i < ARRAY_SIZE(media_ip_map); i++) {
-               ip = media_ip_map[i].ip;
-               if (ip == last)
+       for (int i = 0; i < ARRAY_SIZE(media_ips); i++) {
+               desc = media_ips[i].desc;
+               if (desc == last)
                        continue;
 
-               xe_fn(ip);
-               last = ip;
+               xe_fn(desc);
+               last = desc;
        }
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_call_for_each_media_ip);
index 772f01320b1def94c758e89b1ce578c03e5442c6..6f5bf343fe863e99653d0cf3233d802633ae09fc 100644 (file)
@@ -358,8 +358,8 @@ static const struct xe_device_desc ptl_desc = {
 #undef PLATFORM
 __diag_pop();
 
-/* Map of GMD_ID values to graphics IP */
-static const struct gmdid_map graphics_ip_map[] = {
+/* GMDID-based Graphics IPs */
+static const struct xe_ip graphics_ips[] = {
        { 1270, "Xe_LPG", &graphics_xelpg },
        { 1271, "Xe_LPG", &graphics_xelpg },
        { 1274, "Xe_LPG+", &graphics_xelpg },
@@ -369,8 +369,8 @@ static const struct gmdid_map graphics_ip_map[] = {
        { 3001, "Xe3_LPG", &graphics_xe2 },
 };
 
-/* Map of GMD_ID values to media IP */
-static const struct gmdid_map media_ip_map[] = {
+/* GMDID-based Media IPs */
+static const struct xe_ip media_ips[] = {
        { 1300, "Xe_LPM+", &media_xelpmp },
        { 1301, "Xe2_HPM", &media_xelpmp },
        { 2000, "Xe2_LPM", &media_xelpmp },
@@ -572,11 +572,11 @@ static void handle_gmdid(struct xe_device *xe,
 
        read_gmdid(xe, GMDID_GRAPHICS, &ver, graphics_revid);
 
-       for (int i = 0; i < ARRAY_SIZE(graphics_ip_map); i++) {
-               if (ver == graphics_ip_map[i].ver) {
+       for (int i = 0; i < ARRAY_SIZE(graphics_ips); i++) {
+               if (ver == graphics_ips[i].verx100) {
                        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_ips[i].name;
+                       *graphics = graphics_ips[i].desc;
 
                        break;
                }
@@ -594,11 +594,11 @@ static void handle_gmdid(struct xe_device *xe,
        if (ver == 0)
                return;
 
-       for (int i = 0; i < ARRAY_SIZE(media_ip_map); i++) {
-               if (ver == media_ip_map[i].ver) {
+       for (int i = 0; i < ARRAY_SIZE(media_ips); i++) {
+               if (ver == media_ips[i].verx100) {
                        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_ips[i].name;
+                       *media = media_ips[i].desc;
 
                        break;
                }
index 8e586d02d089847cc9b0dbce20ceae894e7c7fcd..f46426ef8ed8555af5587137601de0be4d1f2f82 100644 (file)
@@ -37,10 +37,10 @@ struct xe_media_desc {
        u8 has_indirect_ring_state:1;
 };
 
-struct gmdid_map {
-       unsigned int ver;
+struct xe_ip {
+       unsigned int verx100;
        const char *name;
-       const void *ip;
+       const void *desc;
 };
 
 #endif