From patchwork Mon Aug 22 03:15:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Skeggs X-Patchwork-Id: 1084292 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7M3C1pB003245 for ; Mon, 22 Aug 2011 03:12:22 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B41399EB54 for ; Sun, 21 Aug 2011 20:12:01 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vx0-f177.google.com (mail-vx0-f177.google.com [209.85.220.177]) by gabe.freedesktop.org (Postfix) with ESMTP id F2ED89E79E for ; Sun, 21 Aug 2011 20:11:20 -0700 (PDT) Received: by vxj2 with SMTP id 2so4670566vxj.36 for ; Sun, 21 Aug 2011 20:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=jcrQyRyNF8N2SHXpJ0vBGaV3i2Gat+asx8p0bzBXLZY=; b=j8CmRfR1a68lxJIa0137Q02cvqygRtc6ZRUYyXPILZeHXTR+DWe9c6N/uFNAF+sdDx NwMp/3ECWFlWVbXsFIrEyu1CM5zEElLXG9xskOtYT8YmQsdEl3a5J90Ev0okG5IdH21+ U2lSDuc4sbvPtFt0B/qpula9evhToJuHWWIko= Received: by 10.52.20.82 with SMTP id l18mr1747926vde.65.1313982680126; Sun, 21 Aug 2011 20:11:20 -0700 (PDT) Received: from pegasus.bne.redhat.com ([66.187.239.10]) by mx.google.com with ESMTPS id n5sm2808326vcw.32.2011.08.21.20.11.18 (version=SSLv3 cipher=OTHER); Sun, 21 Aug 2011 20:11:19 -0700 (PDT) From: skeggsb@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/ttm: ensure ttm for new node is bound before calling move_notify() Date: Mon, 22 Aug 2011 13:15:05 +1000 Message-Id: <1313982905-30129-2-git-send-email-skeggsb@gmail.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1313982905-30129-1-git-send-email-skeggsb@gmail.com> References: <1313982905-30129-1-git-send-email-skeggsb@gmail.com> Cc: Ben Skeggs X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 22 Aug 2011 03:12:22 +0000 (UTC) From: Ben Skeggs This was true for new TTM_PL_SYSTEM and new TTM_PL_TT cases, but wasn't the case on TTM_PL_SYSTEM<->TTM_PL_TT moves, which causes trouble on some paths as nouveau's move_notify() hook requires that the dma addresses be valid at this point. Signed-off-by: Ben Skeggs --- drivers/gpu/drm/nouveau/nouveau_mem.c | 1 + drivers/gpu/drm/ttm/ttm_bo.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 2eecf5d..b4af850 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c @@ -831,6 +831,7 @@ nouveau_gart_manager_fini(struct ttm_mem_type_manager *man) return 0; } + static void nouveau_gart_manager_del(struct ttm_mem_type_manager *man, struct ttm_mem_reg *mem) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 2e618b5..9095b5b 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -390,10 +390,12 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, * Create and bind a ttm if required. */ - if (!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && (bo->ttm == NULL)) { - ret = ttm_bo_add_ttm(bo, false); - if (ret) - goto out_err; + if (!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) { + if (bo->ttm == NULL) { + ret = ttm_bo_add_ttm(bo, false); + if (ret) + goto out_err; + } ret = ttm_tt_set_placement_caching(bo->ttm, mem->placement); if (ret)