From owner-svn-src-head@freebsd.org Mon Mar 21 00:59:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDDC1AD6EC6; Mon, 21 Mar 2016 00:59:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9660DA87; Mon, 21 Mar 2016 00:59:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2L0xUiW048110; Mon, 21 Mar 2016 00:59:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2L0xUoQ048109; Mon, 21 Mar 2016 00:59:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201603210059.u2L0xUoQ048109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 21 Mar 2016 00:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297128 - head/sys/dev/drm2/i915 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2016 00:59:32 -0000 Author: emaste Date: Mon Mar 21 00:59:30 2016 New Revision: 297128 URL: https://svnweb.freebsd.org/changeset/base/297128 Log: i915: disable GEN6_MBCTL write in gen6_init_clock_gating This write came from Linux commit b4ae3f22d238 which has been implicated in Sandy Bridge power consumption issues (albeit under different conditions on Linux). Disabling it restores normal power consumption on my Sandy Bridge laptop (Thinkpad X220). PR: 207889 Reviewed by: cem, dumbbell Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5665 Modified: head/sys/dev/drm2/i915/intel_pm.c Modified: head/sys/dev/drm2/i915/intel_pm.c ============================================================================== --- head/sys/dev/drm2/i915/intel_pm.c Mon Mar 21 00:52:24 2016 (r297127) +++ head/sys/dev/drm2/i915/intel_pm.c Mon Mar 21 00:59:30 2016 (r297128) @@ -3672,9 +3672,39 @@ static void gen6_init_clock_gating(struc ILK_DPARBUNIT_CLOCK_GATE_ENABLE | ILK_DPFDUNIT_CLOCK_GATE_ENABLE); + +#ifdef FREEBSD_WIP + /* NOTE Linux<->FreeBSD: Disable GEN6_MBCTL write. + * + * This arrived in Linux 3.6 in commit + * b4ae3f22d238617ca11610b29fde16cf8c0bc6e0 and causes significantly + * increased power consumption after kldloading i915kms.ko on FreeBSD + * on (some) Sandy Bridge laptops. A Thinkpad X220 reported about 11W + * after booting while idle at the vt(4) console and about double that + * after loading the driver. + * + * There were reports in Linux of increased consumption after a suspend + * and resume cycle due to that change. + * + * Linux bug reports: + * https://bugs.freedesktop.org/show_bug.cgi?id=54089 + * https://bugzilla.kernel.org/show_bug.cgi?id=58971 + * + * This suspend and resume issue is reportedly fixed in Linux with + * commits 7dcd2677ea912573d9ed4bcd629b0023b2d11505 and + * 7dcd2677ea912573d9ed4bcd629b0023b2d11505 (Linux 3.11). However, I + * found that those changes did not help on FreeBSD, where increased + * power consumption is observed after loading i915kms.ko without + * suspending and resuming. + * + * This workaround should be removed after updating to a future Linux + * i915 version and verifying normal power consumption on Sandy Bridge. + */ + /* WaMbcDriverBootEnable */ I915_WRITE(GEN6_MBCTL, I915_READ(GEN6_MBCTL) | GEN6_MBCTL_ENABLE_BOOT_FETCH); +#endif /* FREEBSD_WIP */ for_each_pipe(pipe) { I915_WRITE(DSPCNTR(pipe),