From patchwork Mon Jan 30 10:12:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 13120882 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 8B11AC54EED for ; Mon, 30 Jan 2023 10:18:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7323110E1E0; Mon, 30 Jan 2023 10:18:00 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 62BBC10E0DA; Mon, 30 Jan 2023 10:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675073875; x=1706609875; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XfOfAFj5gf+/AQiEluoe6T0Y7igC1cO9ZymBBcN0xrM=; b=IgL8CQarCGD3/rmeFUNABICs6EqtFJX5om+vQclda1becrlua0cWc63H VCqIk4Dm5tnT8wN9qcbGrel2+oIFft6eiHzs5/9o4SQ0+9eoZ7zZ9ULKq zOh0daivz2uiEsbhvmte7uvZk4zfJRLNS8SgFETXP7HMmDS2ZIQc6NzRt 8ifnkZJZ9Otkg5aSwzt/xipk2A56Elc3zZH36ouU3trt6LxWhygpqUawv sEMT6NiwksFsiUzP5CZCOG15HgpFBsnwiKHaf1dp8bJsTNoNdPHXYNNeM AdGo+1f6RWEjuwqtfUU2gWegBTRJpY+r5NLJdfWoCJZAD3nZln97IoFs9 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="328798967" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="328798967" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2023 02:17:12 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="696348856" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="696348856" Received: from dscheepe-mobl2.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.252.1.159]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2023 02:14:17 -0800 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Subject: [PATCH 3/6] drm/ttm: clear the ttm_tt when bo->resource is NULL Date: Mon, 30 Jan 2023 10:12:27 +0000 Message-Id: <20230130101230.25347-3-matthew.auld@intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230130101230.25347-1-matthew.auld@intel.com> References: <20230130101230.25347-1-matthew.auld@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In the next few patches, when initially creating a ttm BO, the bo->resource is NULL, and the driver is then expected to handle the initial dummy move. However, if this is created as a system resource the first ttm_tt we create will always have the clear value set to false. Previously the initial ttm_tt would be created in ttm_bo_validate() with the clear parameter always set to true. Signed-off-by: Matthew Auld Cc: Christian König Reviewed-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 326a3d13a829..773080f48864 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -120,8 +120,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, bool old_use_tt, new_use_tt; int ret; - old_use_tt = bo->resource && - ttm_manager_type(bdev, bo->resource->mem_type)->use_tt; + old_use_tt = !bo->resource || ttm_manager_type(bdev, bo->resource->mem_type)->use_tt; new_use_tt = ttm_manager_type(bdev, mem->mem_type)->use_tt; ttm_bo_unmap_virtual(bo);