Commit ad703e06 authored by Matt Roper's avatar Matt Roper Committed by Rodrigo Vivi
Browse files

drm/xe: Move GGTT from GT to tile



The GGTT exists at the tile level.  When a tile contains multiple GTs,
they share the same GGTT.

v2:
 - Include some changes that were mis-squashed into the VRAM patch.
   (Gustavo)

Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Acked-by: default avatarGustavo Sousa <gustavo.sousa@intel.com>
Link: https://lore.kernel.org/r/20230601215244.678611-9-matthew.d.roper@intel.com


Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 3b0d4a55
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ xe-y += xe_bb.o \
	xe_sched_job.o \
	xe_step.o \
	xe_sync.o \
	xe_tile.o \
	xe_trace.o \
	xe_ttm_sys_mgr.o \
	xe_ttm_stolen_mgr.o \
+3 −3
Original line number Diff line number Diff line
@@ -964,7 +964,7 @@ static void xe_ttm_bo_destroy(struct ttm_buffer_object *ttm_bo)
	WARN_ON(!list_empty(&bo->vmas));

	if (bo->ggtt_node.size)
		xe_ggtt_remove_bo(bo->gt->mem.ggtt, bo);
		xe_ggtt_remove_bo(gt_to_tile(bo->gt)->mem.ggtt, bo);

	if (bo->vm && xe_bo_is_user(bo))
		xe_vm_put(bo->vm);
@@ -1242,9 +1242,9 @@ xe_bo_create_locked_range(struct xe_device *xe,

		if (flags & XE_BO_CREATE_STOLEN_BIT &&
		    flags & XE_BO_FIXED_PLACEMENT_BIT) {
			err = xe_ggtt_insert_bo_at(gt->mem.ggtt, bo, start);
			err = xe_ggtt_insert_bo_at(gt_to_tile(gt)->mem.ggtt, bo, start);
		} else {
			err = xe_ggtt_insert_bo(gt->mem.ggtt, bo);
			err = xe_ggtt_insert_bo(gt_to_tile(gt)->mem.ggtt, bo);
		}
		if (err)
			goto err_unlock_put_bo;
+5 −3
Original line number Diff line number Diff line
@@ -149,9 +149,11 @@ int xe_bo_restore_kernel(struct xe_device *xe)
		}

		if (bo->flags & XE_BO_CREATE_GGTT_BIT) {
			mutex_lock(&bo->gt->mem.ggtt->lock);
			xe_ggtt_map_bo(bo->gt->mem.ggtt, bo);
			mutex_unlock(&bo->gt->mem.ggtt->lock);
			struct xe_tile *tile = gt_to_tile(bo->gt);

			mutex_lock(&tile->mem.ggtt->lock);
			xe_ggtt_map_bo(tile->mem.ggtt, bo);
			mutex_unlock(&tile->mem.ggtt->lock);
		}

		/*
+14 −4
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include "xe_pcode.h"
#include "xe_pm.h"
#include "xe_query.h"
#include "xe_tile.h"
#include "xe_ttm_stolen_mgr.h"
#include "xe_ttm_sys_mgr.h"
#include "xe_vm.h"
@@ -237,14 +238,19 @@ static void xe_device_sanitize(struct drm_device *drm, void *arg)

int xe_device_probe(struct xe_device *xe)
{
	struct xe_tile *tile;
	struct xe_gt *gt;
	int err;
	u8 id;

	xe->info.mem_region_mask = 1;

	for_each_gt(gt, xe, id) {
		err = xe_gt_alloc(xe, gt);
	for_each_tile(tile, xe, id) {
		err = xe_tile_alloc(tile);
		if (err)
			return err;

		err = xe_gt_alloc(xe, &tile->primary_gt);
		if (err)
			return err;
	}
@@ -275,8 +281,12 @@ int xe_device_probe(struct xe_device *xe)

	xe_ttm_sys_mgr_init(xe);

	for_each_gt(gt, xe, id) {
		err = xe_gt_init_noalloc(gt);
	for_each_tile(tile, xe, id) {
		err = xe_tile_init_noalloc(tile);
		if (err)
			goto err_irq_shutdown;

		err = xe_gt_init_noalloc(&tile->primary_gt);
		if (err)
			goto err_irq_shutdown;
	}
+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#include "xe_platform_types.h"
#include "xe_step_types.h"

struct xe_ggtt;

#define XE_BO_INVALID_OFFSET	LONG_MAX

#define GRAPHICS_VER(xe) ((xe)->info.graphics_verx100 / 100)
@@ -91,6 +93,12 @@ struct xe_tile {
		/** @regs: pointer to tile's MMIO space (starting with registers) */
		void *regs;
	} mmio;

	/** @mem: memory management info for tile */
	struct {
		/** @ggtt: Global graphics translation table */
		struct xe_ggtt *ggtt;
	} mem;
};

/**
Loading