From patchwork Sat Jan 6 19:53:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10147999 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5395A60134 for ; Sat, 6 Jan 2018 19:53:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43B3C28970 for ; Sat, 6 Jan 2018 19:53:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38C02289AC; Sat, 6 Jan 2018 19:53:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D3D3F28970 for ; Sat, 6 Jan 2018 19:53:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E62386E376; Sat, 6 Jan 2018 19:53:23 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1ADDA6E32B; Sat, 6 Jan 2018 19:53:22 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id 64so7829010wme.3; Sat, 06 Jan 2018 11:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1ghUpt+HdIEZ65WEIdo23t7XOHAipD0//yw3PcymgrE=; b=COtexaFODErCQWABB891hZQg6jS8ku+kAGqzNYRl2V6EpWCQAJ42TLGUAjthtiuCsk xzwbYArz9SV4AbMzuiOFG42BFfglMBKeVdxC2VRnCFIumSexvp82+hFvA4bMUGUAziFw ZISQSeglmDHGoNfs6535ftXejs/pkTGD0LjhwfPhE8o60FnTBJ4a+FltA/DfHDTkevjF Y5zluwdwUYOfZYv53qIy1zaPEY9/wm4JeoNwvPiVWeeyER5dw4KbzbFDaH1Ic8yl3UWI qBNjFEpbsw6cddV1+lyeIwoPqAbssDwUegQm0irNyCZc8lopXAewaqt2nPaTMr2laFTw bRbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1ghUpt+HdIEZ65WEIdo23t7XOHAipD0//yw3PcymgrE=; b=az6W6+No0phlqS/GZSYMSPR4wx9e+mUq6eEsStGbeJjdBU/xboqKPM6f4PkDoJOj1S 41sxwpRDG6MaqlpJjFGOnIcQf7dGKuIQw24C8oPvUgimtJhJoussCqAq1weGSiaMbYc4 zh6u4Epr0eVVtEJW6rk9CojMjOOaBw9cFoNv4FHRxANzheIPMrjcNpaPV/zU9yRS7bai rQb+3jncaSa4ZZvyTntuDIPMz7bu2U4pboWOCXtVv1fO4CYh5KmIaP9NfJXnrwXPVjey aE7yATHod1xl1CHEp2fVjnS4fCx4c1i4PftRk/ruDIXRsqvtoTap1SByQlkBqF6OGymn q9Ng== X-Gm-Message-State: AKGB3mJPSCOgRb9xkEpYPMgYjvRH3J2mK3ZpUHlHKyR7wP06QwHEQO6O BwFqNukumtjgcmtrcjF3soE= X-Google-Smtp-Source: ACJfBoteIQQ3t2mzTMSUqkqEx3gFb0xCG6LmtTy2Onphq59z32galrqYX2nEIgVh9EOkmDZuJIml+w== X-Received: by 10.80.180.18 with SMTP id b18mr9668151edh.260.1515268401639; Sat, 06 Jan 2018 11:53:21 -0800 (PST) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id q10sm5159368edc.32.2018.01.06.11.53.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Jan 2018 11:53:20 -0800 (PST) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Mika Kuoppala Date: Sat, 6 Jan 2018 20:53:14 +0100 Message-Id: <20180106195314.4242-2-hdegoede@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180106195314.4242-1-hdegoede@redhat.com> References: <20180106195314.4242-1-hdegoede@redhat.com> Cc: Hans de Goede , intel-gfx , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] i915: pm: Be less agressive with clockfreq changes on Bay Trail X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Bay Trail devices are known to hang when changing the frequency often, this is discussed in great length in: https://bugzilla.kernel.org/show_bug.cgi?id=109051 Commit 6067a27d1f01 ("drm/i915: Avoid tweaking evaluation thresholds on Baytrail v3") is an attempt to workaround this. Several users in bko109051 report that an earlier version of this patch, v1: https://bugzilla.kernel.org/attachment.cgi?id=251471 Works better for them and they still see hangs with the merged v3. Comparing the 2 versions shows that they are indeed not equivalent, v1 not only skips writing the GEN6_RP* registers from valleyview_set_rps, as v3 does. It also contained these modifications to i915_irq.c: if (pm_iir & GEN6_PM_RP_DOWN_EI_EXPIRED) { if (!vlv_c0_above(dev_priv, &dev_priv->rps.down_ei, &now, - dev_priv->rps.down_threshold)) + VLV_RP_DOWN_EI_THRESHOLD)) events |= GEN6_PM_RP_DOWN_THRESHOLD; dev_priv->rps.down_ei = now; } if (pm_iir & GEN6_PM_RP_UP_EI_EXPIRED) { if (vlv_c0_above(dev_priv, &dev_priv->rps.up_ei, &now, - dev_priv->rps.up_threshold)) + VLV_RP_UP_EI_THRESHOLD)) events |= GEN6_PM_RP_UP_THRESHOLD; dev_priv->rps.up_ei = now; } Which use less aggressive up/down thresholds, which results in less GEN6_PM_RP_*_THRESHOLD events and thus in less calls to intel_set_rps() -> valleyview_set_rps() -> vlv_punit_write(PUNIT_REG_GPU_FREQ_REQ). With the last call being the likely cause of the hang. This commit hardcodes the threshold_up and _down values for Bay Trail to less aggressive values, reducing the amount of clock frequency changes, thus avoiding the hangs some people are still seeing with the merged fix. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=109051 Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 505c605eff98..acafc8408e43 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -1390,6 +1390,9 @@ enum i915_power_well_id { #define VLV_BIAS_CPU_125_SOC_875 (6 << 2) #define CHV_BIAS_CPU_50_SOC_50 (3 << 2) +#define VLV_RP_UP_EI_THRESHOLD 90 +#define VLV_RP_DOWN_EI_THRESHOLD 70 + /* vlv2 north clock has */ #define CCK_FUSE_REG 0x8 #define CCK_FUSE_HPLL_FREQ_MASK 0x3 diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 1db79a860b96..b06379622301 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -6116,8 +6116,11 @@ static void gen6_set_rps_thresholds(struct drm_i915_private *dev_priv, u8 val) /* When byt can survive without system hang with dynamic * sw freq adjustments, this restriction can be lifted. */ - if (IS_VALLEYVIEW(dev_priv)) + if (IS_VALLEYVIEW(dev_priv)) { + threshold_up = VLV_RP_UP_EI_THRESHOLD; + threshold_down = VLV_RP_DOWN_EI_THRESHOLD; goto skip_hw_write; + } I915_WRITE(GEN6_RP_UP_EI, GT_INTERVAL_FROM_US(dev_priv, ei_up));