drm/xe: Clarify GT counting logic
authorMatt Roper <matthew.d.roper@intel.com>
Thu, 6 Apr 2023 23:56:17 +0000 (16:56 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Tue, 19 Dec 2023 23:31:39 +0000 (18:31 -0500)
The total number of GTs supported by a platform should be one primary
GT, one media GT (if media version >= 13), and a number of remote tile
GTs dependent on the graphics IP present.  Express this more clearly in
the device setup.

Note that xe->info.tile_count is inaccurately named; the rest of the
driver treats this as the GT count, not just the tile count.  This
will need to be cleaned up at some point down the road.

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20230406235621.1914492-6-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_pci.c
drivers/gpu/drm/xe/xe_pci_types.h

index 198cae9c5116a7c888a462729cd41b0e2b752589..0697496c26d0ea63390e4614d12ee2ca0cd9467a 100644 (file)
@@ -124,7 +124,7 @@ static const struct xe_graphics_desc graphics_xehpc = {
 
        XE_HP_FEATURES,
        .dma_mask_size = 52,
-       .max_tiles = 2,
+       .max_remote_tiles = 1,
        .vm_max_level = 4,
        .vram_flags = XE_VRAM_FLAGS_NEED64K,
 
@@ -143,8 +143,6 @@ static const struct xe_graphics_desc graphics_xelpg = {
                BIT(XE_HW_ENGINE_CCS0),
 
        XE_HP_FEATURES,
-       .max_tiles = 2,
-
        .has_flat_ccs = 0,
 };
 
@@ -388,7 +386,6 @@ static void xe_info_init(struct xe_device *xe,
        xe->info.platform = desc->platform;
        xe->info.dma_mask_size = desc->graphics->dma_mask_size;
        xe->info.vram_flags = desc->graphics->vram_flags;
-       xe->info.tile_count = desc->graphics->max_tiles ?: 1;
        xe->info.vm_max_level = desc->graphics->vm_max_level;
        xe->info.supports_usm = desc->graphics->supports_usm;
        xe->info.has_asid = desc->graphics->has_asid;
@@ -397,6 +394,19 @@ static void xe_info_init(struct xe_device *xe,
        xe->info.has_range_tlb_invalidation = desc->graphics->has_range_tlb_invalidation;
        xe->info.has_link_copy_engine = desc->graphics->has_link_copy_engine;
 
+       /*
+        * All platforms have at least one primary GT.  Any platform with media
+        * version 13 or higher has an additional dedicated media GT.  And
+        * depending on the graphics IP there may be additional "remote tiles."
+        * All of these together determine the overall GT count.
+        *
+        * FIXME: 'tile_count' here is misnamed since the rest of the driver
+        * treats it as the number of GTs rather than just the number of tiles.
+        */
+       xe->info.tile_count = 1 + desc->graphics->max_remote_tiles;
+       if (MEDIA_VER(xe) >= 13)
+               xe->info.tile_count++;
+
        xe->info.subplatform = subplatform_desc ?
                subplatform_desc->subplatform : XE_SUBPLATFORM_NONE;
        xe->info.step = xe_step_get(xe);
index 1b3dff8886ad458b23937c952765e3a3f65f2767..f4bc5ef1bce36a70b554a7308445fc1a5aa1dc37 100644 (file)
@@ -13,12 +13,13 @@ struct xe_graphics_desc {
        u8 rel;
 
        u8 dma_mask_size;       /* available DMA address bits */
-       u8 max_tiles;           /* defaults to 1 if unset */
        u8 vm_max_level;
        u8 vram_flags;
 
        u64 hw_engine_mask;     /* hardware engines provided by graphics IP */
 
+       u8 max_remote_tiles:2;
+
        u8 has_asid:1;
        u8 has_flat_ccs:1;
        u8 has_link_copy_engine:1;