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 1DDAAC87FE2 for ; Thu, 1 Jun 2023 00:04:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8834A10E529; Thu, 1 Jun 2023 00:04:18 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id D672F10E51E for ; Thu, 1 Jun 2023 00:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685577856; x=1717113856; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/9h+a5twwaVJc6gGjGJdnsD5NwaEJhDLaWKI8XHbSYI=; b=BJh/W5BNWwF37rQPIlD+Xkn8DZYkBRclNsYm4VkGkMbeyk+E/pJFHU3m ioiEbW7rFbV8EVxsxjswTh/BV17zU4lE4FQWudKmPF+JIRTvUFU5yt0ef DERgy2WEqzAzY8PcIVSKOaMwxHUiMQzGEnIRMnHvJqc5BIfMzAx/ZJmd3 vmh9bvv5s6XAJNSKYjTkybxLcFpObNHYmIJh6MwD6TqYZS0Xb1e0B93OR BKBilAM278L0IRMjhrSUB9xWiIcZDxovVmet3utTOT4Rk0xgcsKcSQKDR fA+BExSI2dLOxA3YaGy95J3NI/W8rfJLtPFffDECeJUI5qMHMCQgdIzx7 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10727"; a="339996868" X-IronPort-AV: E=Sophos;i="6.00,207,1681196400"; d="scan'208";a="339996868" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2023 17:04:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10727"; a="657556237" X-IronPort-AV: E=Sophos;i="6.00,207,1681196400"; d="scan'208";a="657556237" Received: from mdroper-desk1.fm.intel.com ([10.1.27.147]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2023 17:04:16 -0700 From: Matt Roper To: intel-xe@lists.freedesktop.org Date: Wed, 31 May 2023 17:03:58 -0700 Message-Id: <20230601000403.432517-27-matthew.d.roper@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601000403.432517-1-matthew.d.roper@intel.com> References: <20230601000403.432517-1-matthew.d.roper@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH v4 26/31] drm/xe: Invalidate TLB on all affected GTs during GGTT updates 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: matthew.d.roper@intel.com, Nirmoy Das Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" The GGTT is part of the tile and is shared by the primary and media GTs on platforms with a standalone media architecture. However each of these GTs has its own TLBs caching the page table lookups, and each needs to be invalidated separately. Signed-off-by: Matt Roper Reviewed-by: Nirmoy Das --- drivers/gpu/drm/xe/xe_ggtt.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c index c4862c1cfd9b..9a3edead3948 100644 --- a/drivers/gpu/drm/xe/xe_ggtt.c +++ b/drivers/gpu/drm/xe/xe_ggtt.c @@ -190,13 +190,10 @@ int xe_ggtt_init(struct xe_ggtt *ggtt) #define PVC_GUC_TLB_INV_DESC1 XE_REG(0xcf80) #define PVC_GUC_TLB_INV_DESC1_INVALIDATE REG_BIT(6) -void xe_ggtt_invalidate(struct xe_ggtt *ggtt) +static void ggtt_invalidate_gt_tlb(struct xe_gt *gt) { - /* - * TODO: Loop over each GT in tile once media GT support is - * re-added - */ - struct xe_gt *gt = ggtt->tile->primary_gt; + if (!gt) + return; /* TODO: vfunc for GuC vs. non-GuC */ @@ -221,6 +218,13 @@ void xe_ggtt_invalidate(struct xe_ggtt *ggtt) } } +void xe_ggtt_invalidate(struct xe_ggtt *ggtt) +{ + /* Each GT in a tile has its own TLB to cache GGTT lookups */ + ggtt_invalidate_gt_tlb(ggtt->tile->primary_gt); + ggtt_invalidate_gt_tlb(ggtt->tile->media_gt); +} + void xe_ggtt_printk(struct xe_ggtt *ggtt, const char *prefix) { u64 addr, scratch_pte; -- 2.40.1