Commit e4b2893c authored by Tejas Upadhyay's avatar Tejas Upadhyay Committed by Rodrigo Vivi
Browse files

drm/xe: Make usable size of VRAM readable



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: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: default avatarTejas Upadhyay <tejas.upadhyay@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 9641df81
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
+10 −3
Original line number Diff line number Diff line
@@ -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 */
+3 −3
Original line number Diff line number Diff line
@@ -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);

+1 −1
Original line number Diff line number Diff line
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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;
Loading