From patchwork Mon Apr 7 18:07:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 337504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id B1EB41400A3 for ; Tue, 8 Apr 2014 04:07:48 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1WXDxQ-0000GA-2x; Mon, 07 Apr 2014 18:07:44 +0000 Received: from mail-wi0-f174.google.com ([209.85.212.174]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1WXDxD-0000Dq-5F for kernel-team@lists.ubuntu.com; Mon, 07 Apr 2014 18:07:31 +0000 Received: by mail-wi0-f174.google.com with SMTP id d1so5602283wiv.1 for ; Mon, 07 Apr 2014 11:07:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fMrnNDmNKwanJ8TsLHdbjaRGtoy1I6KK1GIG3XjsqpA=; b=BKGiRzZ3YVNqwMKlCcqgrg2nwA3aS+NQdKa7BGgKqoldJFYOOhfW0/xiUN7sh+XrKJ k7VMPrTlWiPvL/wYh2d0Iv8ovfVlCrhI0mRT57DKmRWJnOBI/Z7FbBaGjrD6xiu2tt56 T6n8Zvda8SxUgEdozXaYOgKMatmxhvb0HkGr72YWE7QWErkucwYqv1kdLnu+x6h8asxI jwPhYdISzNNwAn8dLeYjiyI5dacbjI6M8U+Pb5prCfXppdqEPZITsUe/ZfvXJzKDyNtB TzCUF+7HkUIBo0WmpWRj3N6qI2xfFHWmCOXqT8n56fWtY3bDbjIfV+Bdghdl5VywkcNI ntug== X-Gm-Message-State: ALoCoQk7Wgro6GImzFSahq25C8EfFR0zhGUy6agT8dUfIWzvRwjfvw8plSpasvMuzBgTaabip6QW X-Received: by 10.194.90.107 with SMTP id bv11mr43500480wjb.11.1396894050903; Mon, 07 Apr 2014 11:07:30 -0700 (PDT) Received: from localhost ([2001:470:6973:2:221:70ff:fe81:b177]) by mx.google.com with ESMTPSA id fi2sm12323366wic.15.2014.04.07.11.07.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 07 Apr 2014 11:07:30 -0700 (PDT) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/3] drm/nouveau/device: provide a way for devinit to mark engines as disabled Date: Mon, 7 Apr 2014 19:07:23 +0100 Message-Id: <1396894044-19676-3-git-send-email-apw@canonical.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1396894044-19676-1-git-send-email-apw@canonical.com> References: <1396894044-19676-1-git-send-email-apw@canonical.com> Cc: Andy Whitcroft X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Ilia Mirkin Signed-off-by: Ilia Mirkin Signed-off-by: Ben Skeggs (cherry picked from commit f0d13e3a851ef29691076d89ff7ee69f004037a7) Signed-off-by: Andy Whitcroft --- drivers/gpu/drm/nouveau/core/core/engine.c | 23 +++++++++++++++++----- drivers/gpu/drm/nouveau/core/include/core/device.h | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/core/engine.c b/drivers/gpu/drm/nouveau/core/core/engine.c index c8bed4a..1f6954a 100644 --- a/drivers/gpu/drm/nouveau/core/core/engine.c +++ b/drivers/gpu/drm/nouveau/core/core/engine.c @@ -42,11 +42,24 @@ nouveau_engine_create_(struct nouveau_object *parent, if (ret) return ret; - if ( parent && - !nouveau_boolopt(nv_device(parent)->cfgopt, iname, enable)) { - if (!enable) - nv_warn(engine, "disabled, %s=1 to enable\n", iname); - return -ENODEV; + if (parent) { + struct nouveau_device *device = nv_device(parent); + int engidx = nv_engidx(nv_object(engine)); + + if (device->disable_mask & (1ULL << engidx)) { + if (!nouveau_boolopt(device->cfgopt, iname, false)) { + nv_debug(engine, "engine disabled by hw/fw\n"); + return -ENODEV; + } + + nv_warn(engine, "ignoring hw/fw engine disable\n"); + } + + if (!nouveau_boolopt(device->cfgopt, iname, enable)) { + if (!enable) + nv_warn(engine, "disabled, %s=1 to enable\n", iname); + return -ENODEV; + } } INIT_LIST_HEAD(&engine->contexts); diff --git a/drivers/gpu/drm/nouveau/core/include/core/device.h b/drivers/gpu/drm/nouveau/core/include/core/device.h index ac2881d..d04c523 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/device.h +++ b/drivers/gpu/drm/nouveau/core/include/core/device.h @@ -70,6 +70,7 @@ struct nouveau_device { const char *dbgopt; const char *name; const char *cname; + u64 disable_mask; enum { NV_04 = 0x04,