From patchwork Tue Oct 22 19:30:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 3084591 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1AB249F2B7 for ; Tue, 22 Oct 2013 19:32:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA43E202BE for ; Tue, 22 Oct 2013 19:32:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AC46D20233 for ; Tue, 22 Oct 2013 19:32:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7FFC2E692F for ; Tue, 22 Oct 2013 12:32:53 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qe0-f48.google.com (mail-qe0-f48.google.com [209.85.128.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 77523E5EE0 for ; Tue, 22 Oct 2013 12:30:38 -0700 (PDT) Received: by mail-qe0-f48.google.com with SMTP id d4so5017562qej.7 for ; Tue, 22 Oct 2013 12:30:38 -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:in-reply-to:references; bh=jmeFYPFKNQ1NUoLGICBQDmHpvn20bPdnw//V2mLdcSc=; b=fMzb44LvUfyjHAXNBDlOK9hb3hnZiJwSaSO2eBSzdqA9ZXrtMggdMcXeydWmqDixM7 0s2jqkg5PPAlyo6Sg4B/A3shmONi66IfrPNR8vmyICj4i0XyYiNcJxNakBof+eLeVXyy T8e+Iky7J6Dd0p5yBTwjf1jrOBHYm1dTYZv64PG2qOw6D2EdFomrfUaDwS7QmmRvhV7K NRthAJoZ2qzIwELswQkHRGo8H7IMPIPN2vG7Div1xaq9nC9V5NbVihTiYRvDv1/FszGB GGXnVeFcTeCrrnzHcCdpz9tBNdwxq9KXwNiuajW65EcvRcIxCZp6iLWT2N6Cpg3CZusE J6mQ== X-Received: by 10.224.95.70 with SMTP id c6mr32702685qan.61.1382470238055; Tue, 22 Oct 2013 12:30:38 -0700 (PDT) Received: from localhost.localdomain ([187.112.121.62]) by mx.google.com with ESMTPSA id e7sm52923739qag.7.2013.10.22.12.30.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Oct 2013 12:30:37 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 22 Oct 2013 17:30:11 -0200 Message-Id: <1382470214-1597-4-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1382470214-1597-1-git-send-email-przanoni@gmail.com> References: <1382470214-1597-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [RFC 3/6] drm/i915: add enable_runtime_pm option X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni And leave it off by default. We have way too many driver entry points, we can't assume this will work without regressions without tons of testing first. This option allows people to test and fix the problems. Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/i915_dma.c | 4 ++-- drivers/gpu/drm/i915/i915_drv.c | 8 ++++++-- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 6aa044e..dd4f424 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1458,7 +1458,7 @@ static void i915_init_runtime_pm(struct drm_i915_private *dev_priv) dev_priv->pm.suspended = false; - if (!HAS_RUNTIME_PM(dev)) + if (!HAS_RUNTIME_PM(dev) || !i915_enable_runtime_pm) return; pm_runtime_set_active(device); @@ -1475,7 +1475,7 @@ static void i915_fini_runtime_pm(struct drm_i915_private *dev_priv) struct drm_device *dev = dev_priv->dev; struct device *device = &dev->pdev->dev; - if (!HAS_RUNTIME_PM(dev)) + if (!HAS_RUNTIME_PM(dev) || !i915_enable_runtime_pm) return; /* Make sure we're not suspended first. */ diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index a999a3f..c75b78f 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -154,6 +154,10 @@ module_param_named(prefault_disable, i915_prefault_disable, bool, 0600); MODULE_PARM_DESC(prefault_disable, "Disable page prefaulting for pread/pwrite/reloc (default:false). For developers only."); +int i915_enable_runtime_pm __read_mostly = 0; +module_param_named(enable_runtime_pm, i915_enable_runtime_pm, int, 0600); +MODULE_PARM_DESC(enable_runtime_pm, "Enable runtime PM on supported platforms (default: disabled)"); + static struct drm_driver driver; extern int intel_agp_enabled; @@ -890,7 +894,7 @@ static int i915_runtime_suspend(struct device *device) struct drm_device *dev = pci_get_drvdata(pdev); struct drm_i915_private *dev_priv = dev->dev_private; - WARN_ON(!HAS_RUNTIME_PM(dev)); + WARN_ON(!HAS_RUNTIME_PM(dev) || !i915_enable_runtime_pm); DRM_DEBUG_KMS("Suspending device\n"); @@ -909,7 +913,7 @@ static int i915_runtime_resume(struct device *device) struct drm_device *dev = pci_get_drvdata(pdev); struct drm_i915_private *dev_priv = dev->dev_private; - WARN_ON(!HAS_RUNTIME_PM(dev)); + WARN_ON(!HAS_RUNTIME_PM(dev) || !i915_enable_runtime_pm); DRM_DEBUG_KMS("Resuming device\n"); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 74f2b5d..73ebb9e 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1831,6 +1831,7 @@ extern bool i915_fastboot __read_mostly; extern int i915_enable_pc8 __read_mostly; extern int i915_pc8_timeout __read_mostly; extern bool i915_prefault_disable __read_mostly; +extern int i915_enable_runtime_pm __read_mostly; extern int i915_suspend(struct drm_device *dev, pm_message_t state); extern int i915_resume(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index a973f35..617e934 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5785,7 +5785,7 @@ void intel_runtime_pm_get(struct drm_i915_private *dev_priv) struct drm_device *dev = dev_priv->dev; struct device *device = &dev->pdev->dev; - if (!HAS_RUNTIME_PM(dev)) + if (!HAS_RUNTIME_PM(dev) || !i915_enable_runtime_pm) return; pm_runtime_mark_last_busy(device); @@ -5798,7 +5798,7 @@ void intel_runtime_pm_put(struct drm_i915_private *dev_priv) struct drm_device *dev = dev_priv->dev; struct device *device = &dev->pdev->dev; - if (!HAS_RUNTIME_PM(dev)) + if (!HAS_RUNTIME_PM(dev) || !i915_enable_runtime_pm) return; pm_runtime_mark_last_busy(device);