Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A05FC77B61 for ; Thu, 27 Apr 2023 19:52:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0362910E0D4; Thu, 27 Apr 2023 19:52:55 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 462B710E09F for ; Thu, 27 Apr 2023 19:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682625173; x=1714161173; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C90GVJnJfJPfuX/hUFSXKGGH3Nqnuq8pOc1ZgHTkxhE=; b=kLnwjOo8y1Wvn3zB4carRC23D3nEcKf8NmK1tQOKMbeTNYr7zs4/F00J b8N+8Md9GARa2H4Yphoz6LXEHFC/wRJCW+J6dQcdM7rHqEX/zU5U0n1yO xR9DQZSlCmbrO4y/h9k708uVhO4YeP6uxHiHfwhS9SS45t7QCoDoHOw9W uRJ7l8y8+F5W/v1YA2OC87ZFKmkUPPvzxdobxRcE/iFjuZskZKKVSDYHt 23Q9VRif0/yIY1SbG8SW6LXg9FEGOTlgryUW5aWRV0O7u0ZoqfVMKshhH eu7wWGMFWiwOwGHxOnIT+6Xa62XOihLkjbVIc+g8jTPt7iz9IKew9EWxQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10693"; a="412911655" X-IronPort-AV: E=Sophos;i="5.99,232,1677571200"; d="scan'208";a="412911655" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2023 12:52:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10693"; a="806089597" X-IronPort-AV: E=Sophos;i="5.99,232,1677571200"; d="scan'208";a="806089597" Received: from awvttdev-05.aw.intel.com ([10.228.212.156]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2023 12:52:32 -0700 From: "Michael J. Ruhl" To: intel-xe@lists.freedesktop.org Date: Thu, 27 Apr 2023 15:52:13 -0400 Message-Id: <20230427195213.3958260-3-michael.j.ruhl@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230427195213.3958260-1-michael.j.ruhl@intel.com> References: <20230427195213.3958260-1-michael.j.ruhl@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH 3/3] drm/xe: Rename GPU offset helper to reflect true usage X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michael.j.ruhl@intel.com, himal.prasad.ghimiray@intel.com, matthew.auld@intel.com Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" The _io_offset helper function is returning an offset into the GPU address space. Using the CPU address offset (io_) is not correct. Rename to reflect usage. Update to use GPU offset information. Signed-off-by: Michael J. Ruhl --- drivers/gpu/drm/xe/xe_bo.c | 8 ++++---- drivers/gpu/drm/xe/xe_bo.h | 2 +- drivers/gpu/drm/xe/xe_migrate.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index 3ab404e33fae..7ee5a135b065 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -1335,7 +1335,7 @@ struct xe_bo *xe_bo_create_from_data(struct xe_device *xe, struct xe_gt *gt, * XXX: This is in the VM bind data path, likely should calculate this once and * store, with a recalculation if the BO is moved. */ -uint64_t vram_region_io_offset(struct ttm_resource *res) +uint64_t vram_region_gpu_offset(struct ttm_resource *res) { struct xe_device *xe = ttm_to_xe_device(res->bo->bdev); struct xe_gt *gt = mem_type_to_gt(xe, res->mem_type); @@ -1343,7 +1343,7 @@ uint64_t vram_region_io_offset(struct ttm_resource *res) if (res->mem_type == XE_PL_STOLEN) return xe_ttm_stolen_gpu_offset(xe); - return gt->mem.vram.io_start - xe->mem.vram.io_start; + return gt->mem.vram.base; } /** @@ -1427,7 +1427,7 @@ int xe_bo_pin(struct xe_bo *bo) XE_BUG_ON(!(place->flags & TTM_PL_FLAG_CONTIGUOUS)); place->fpfn = (xe_bo_addr(bo, 0, PAGE_SIZE, &vram) - - vram_region_io_offset(bo->ttm.resource)) >> PAGE_SHIFT; + vram_region_gpu_offset(bo->ttm.resource)) >> PAGE_SHIFT; place->lpfn = place->fpfn + (bo->size >> PAGE_SHIFT); spin_lock(&xe->pinned.lock); @@ -1571,7 +1571,7 @@ dma_addr_t xe_bo_addr(struct xe_bo *bo, u64 offset, xe_res_first(bo->ttm.resource, page << PAGE_SHIFT, page_size, &cur); - return cur.start + offset + vram_region_io_offset(bo->ttm.resource); + return cur.start + offset + vram_region_gpu_offset(bo->ttm.resource); } } diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h index 8354d05ccdf3..161d5e9f09cf 100644 --- a/drivers/gpu/drm/xe/xe_bo.h +++ b/drivers/gpu/drm/xe/xe_bo.h @@ -224,7 +224,7 @@ void xe_bo_vunmap(struct xe_bo *bo); bool mem_type_is_vram(u32 mem_type); bool xe_bo_is_vram(struct xe_bo *bo); bool xe_bo_is_stolen(struct xe_bo *bo); -uint64_t vram_region_io_offset(struct ttm_resource *res); +uint64_t vram_region_gpu_offset(struct ttm_resource *res); bool xe_bo_can_migrate(struct xe_bo *bo, u32 mem_type); diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c index a1d507db0098..c79561035b1b 100644 --- a/drivers/gpu/drm/xe/xe_migrate.c +++ b/drivers/gpu/drm/xe/xe_migrate.c @@ -419,7 +419,7 @@ static u32 pte_update_size(struct xe_migrate *m, } else { /* Offset into identity map. */ *L0_ofs = xe_migrate_vram_ofs(cur->start + - vram_region_io_offset(res)); + vram_region_gpu_offset(res)); cmds += cmd_size; } @@ -469,7 +469,7 @@ static void emit_pte(struct xe_migrate *m, addr |= XE_PTE_PS64; } - addr += vram_region_io_offset(bo->ttm.resource); + addr += vram_region_gpu_offset(bo->ttm.resource); addr |= XE_PPGTT_PTE_LM; } addr |= PPAT_CACHED | XE_PAGE_PRESENT | XE_PAGE_RW; -- 2.39.2