drm/xe: Make usable size of VRAM readable
authorTejas Upadhyay <tejas.upadhyay@intel.com>
Wed, 28 Jun 2023 06:23:16 +0000 (11:53 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:35:06 +0000 (11:35 -0500)
Current size member of vram struct does not give
complete information as what "size" contains. Does
it contain reserved portions or not. Name it usable
size and accordingly describe other size members as
well.

Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_bo.c
drivers/gpu/drm/xe/xe_device_types.h
drivers/gpu/drm/xe/xe_mmio.c
drivers/gpu/drm/xe/xe_query.c
drivers/gpu/drm/xe/xe_tile.c
drivers/gpu/drm/xe/xe_ttm_vram_mgr.c

index 17c0c6c2ae65a06e9c1fed1d181d32b6397b59dd..86947a6fcc7ca81ceac0e7c92134931d5890fcd4 100644 (file)
@@ -125,7 +125,7 @@ static void add_vram(struct xe_device *xe, struct xe_bo *bo,
 {
        struct xe_tile *tile = mem_type_to_tile(xe, mem_type);
 
-       XE_BUG_ON(!tile->mem.vram.size);
+       XE_BUG_ON(!tile->mem.vram.usable_size);
 
        places[*c] = (struct ttm_place) {
                .mem_type = mem_type,
index c404d250e4537ef720a9cce27b4cd1f72cea9938..db08d64abce1914f52b2a0665041f8ec429d3838 100644 (file)
@@ -122,11 +122,18 @@ struct xe_tile {
                        resource_size_t io_size;
                        /** @base: offset of VRAM starting base */
                        resource_size_t base;
-                       /** @size: size of VRAM. */
-                       resource_size_t size;
+                       /**
+                        * @usable_size: usable size of VRAM
+                        *
+                        * Usable size of VRAM excluding reserved portions
+                        * (e.g stolen mem)
+                        */
+                       resource_size_t usable_size;
                        /**
                         * @actual_physical_size: Actual VRAM size
-                        * including stolen mem for tile
+                        *
+                        * Actual VRAM size including reserved portions
+                        * (e.g stolen mem)
                         */
                        resource_size_t actual_physical_size;
                        /** @mapping: pointer to VRAM mappable space */
index 7d92258cd35d02686cd365f5b2db40f442ab19b6..5effb21db9d4a698fe48f4d14f16942002d7c10a 100644 (file)
@@ -289,13 +289,13 @@ int xe_mmio_probe_vram(struct xe_device *xe)
                tile->mem.vram.base = tile_offset;
 
                /* small bar can limit the visible size.  size accordingly */
-               tile->mem.vram.size = min_t(u64, vram_size, io_size);
+               tile->mem.vram.usable_size = min_t(u64, vram_size, io_size);
                tile->mem.vram.mapping = xe->mem.vram.mapping + tile_offset;
 
                drm_info(&xe->drm, "VRAM[%u, %u]: %pa, %pa\n", id, tile->id,
-                        &tile->mem.vram.io_start, &tile->mem.vram.size);
+                        &tile->mem.vram.io_start, &tile->mem.vram.usable_size);
 
-               if (tile->mem.vram.io_size < tile->mem.vram.size)
+               if (tile->mem.vram.io_size < tile->mem.vram.usable_size)
                        drm_info(&xe->drm, "VRAM[%u, %u]: CPU access limited to %pa\n", id,
                                 tile->id, &tile->mem.vram.io_size);
 
index 15e171ca7e62800bdeb1e9d04095033b85626e0d..9acbb27dfcab993c5a281c0572c4408e9539a40c 100644 (file)
@@ -188,7 +188,7 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
        config->num_params = num_params;
        config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] =
                xe->info.devid | (xe->info.revid << 16);
-       if (xe_device_get_root_tile(xe)->mem.vram.size)
+       if (xe_device_get_root_tile(xe)->mem.vram.usable_size)
                config->info[XE_QUERY_CONFIG_FLAGS] =
                        XE_QUERY_CONFIG_FLAGS_HAS_VRAM;
        if (xe->info.enable_guc)
index ac70486d09c327aeefc6a5627158168321abf712..e0bc2b60ab09a00e88b6e0e0296be8cf5de55479 100644 (file)
@@ -101,7 +101,7 @@ static int tile_ttm_mgr_init(struct xe_tile *tile)
        struct xe_device *xe = tile_to_xe(tile);
        int err;
 
-       if (tile->mem.vram.size) {
+       if (tile->mem.vram.usable_size) {
                err = xe_ttm_vram_mgr_init(tile, tile->mem.vram_mgr);
                if (err)
                        return err;
index 1a84abd35fcffae679388339e7a8ca3685fac49c..a10fd0366da3cd8a920c8591a354a9432a2818e1 100644 (file)
@@ -360,7 +360,8 @@ int xe_ttm_vram_mgr_init(struct xe_tile *tile, struct xe_ttm_vram_mgr *mgr)
        mgr->tile = tile;
 
        return __xe_ttm_vram_mgr_init(xe, mgr, XE_PL_VRAM0 + tile->id,
-                                     tile->mem.vram.size, tile->mem.vram.io_size,
+                                     tile->mem.vram.usable_size,
+                                     tile->mem.vram.io_size,
                                      PAGE_SIZE);
 }