From patchwork Thu Jun 6 21:55:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 2683661 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id D594FDF23A for ; Thu, 6 Jun 2013 21:59:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9845E6797 for ; Thu, 6 Jun 2013 14:59:55 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f171.google.com (mail-qc0-f171.google.com [209.85.216.171]) by gabe.freedesktop.org (Postfix) with ESMTP id A3836E5EAB for ; Thu, 6 Jun 2013 14:59:05 -0700 (PDT) Received: by mail-qc0-f171.google.com with SMTP id z1so771837qcx.16 for ; Thu, 06 Jun 2013 14:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=qbqapPx3jL5H2669/g4vHjdM6oO76WtbcvN/FA8VPSw=; b=whvH+jELOwQsjTMXHAXNlDy/RN+UvB1MVG4hvJuEI8EIvDwM7N+bRcaTamE4XfGo/n y+uu7PRK8z4qh+dre5cz296bbvZt0v7fl4XbzopeIFIzicEXQ3bFROtUEIcBjO5U8Tq9 vnjB0AhBP+m6jJFagFrzA+7NvIMxrwsbzBbQAZyXg1qh/8m3jzP7r4uAmwtbSJHiBLz6 H+j6qKTRZBr/w+Nf3eBXuePN5ITvuoSlK7QFoWwOVbiZiRVNyyEAEGrT1+focaQ/y03P BcckIbVl0HdcHrSYPSeY0STLAMRa1xqoxV2teKfGvU836TOZ4nsaJYks0dLBXTM9GxPe 54Sg== X-Received: by 10.229.135.204 with SMTP id o12mr9864848qct.16.1370555945120; Thu, 06 Jun 2013 14:59:05 -0700 (PDT) Received: from localhost.boston.devel.redhat.com ([66.187.233.206]) by mx.google.com with ESMTPSA id w7sm82446788qej.7.2013.06.06.14.59.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Jun 2013 14:59:04 -0700 (PDT) From: j.glisse@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon: fix write back suspend regression with uvd Date: Thu, 6 Jun 2013 17:55:32 -0400 Message-Id: <1370555732-3679-1-git-send-email-j.glisse@gmail.com> X-Mailer: git-send-email 1.7.11.7 Cc: Jerome Glisse X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 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 From: Jerome Glisse UVD ring can't use scratch thus it does need writeback buffer to keep a valid address or radeon_ring_backup will trigger a kernel fault. It's ok to not unpin the write back buffer on suspend as it leave in gtt and thus does not need eviction. Reported and tracked by Wojtek Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/radeon_device.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 1899738..eb8068a 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -244,16 +244,6 @@ void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg) */ void radeon_wb_disable(struct radeon_device *rdev) { - int r; - - if (rdev->wb.wb_obj) { - r = radeon_bo_reserve(rdev->wb.wb_obj, false); - if (unlikely(r != 0)) - return; - radeon_bo_kunmap(rdev->wb.wb_obj); - radeon_bo_unpin(rdev->wb.wb_obj); - radeon_bo_unreserve(rdev->wb.wb_obj); - } rdev->wb.enabled = false; } @@ -269,6 +259,11 @@ void radeon_wb_fini(struct radeon_device *rdev) { radeon_wb_disable(rdev); if (rdev->wb.wb_obj) { + if (!radeon_bo_reserve(rdev->wb.wb_obj, false)) { + radeon_bo_kunmap(rdev->wb.wb_obj); + radeon_bo_unpin(rdev->wb.wb_obj); + radeon_bo_unreserve(rdev->wb.wb_obj); + } radeon_bo_unref(&rdev->wb.wb_obj); rdev->wb.wb = NULL; rdev->wb.wb_obj = NULL;