summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap/linus/0008-drm-i915-intel_ips-When-i915-loads-after-IPS-make-IP.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/linus/0008-drm-i915-intel_ips-When-i915-loads-after-IPS-make-IP.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap/linus/0008-drm-i915-intel_ips-When-i915-loads-after-IPS-make-IP.patch190
1 files changed, 190 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/linus/0008-drm-i915-intel_ips-When-i915-loads-after-IPS-make-IP.patch b/extras/recipes-kernel/linux/linux-omap/linus/0008-drm-i915-intel_ips-When-i915-loads-after-IPS-make-IP.patch
new file mode 100644
index 00000000..9fecb7b8
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap/linus/0008-drm-i915-intel_ips-When-i915-loads-after-IPS-make-IP.patch
@@ -0,0 +1,190 @@
1From 38684934e58030113d3e89a3f60472e22e2e1ea6 Mon Sep 17 00:00:00 2001
2From: Eric Anholt <eric@anholt.net>
3Date: Mon, 20 Dec 2010 18:40:06 -0800
4Subject: [PATCH 08/65] drm/i915, intel_ips: When i915 loads after IPS, make IPS relink to i915.
5
6The IPS driver is designed to be able to run detached from i915 and
7just not enable GPU turbo in that case, in order to avoid module
8dependencies between the two drivers. This means that we don't know
9what the load order between the two is going to be, and we had
10previously only supported IPS after (optionally) i915, but not i915
11after IPS. If the wrong order was chosen, you'd get no GPU turbo, and
12something like half the possible graphics performance.
13
14Signed-off-by: Eric Anholt <eric@anholt.net>
15Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
16Cc: stable@kernel.org
17---
18 drivers/gpu/drm/i915/i915_dma.c | 23 +++++++++++++++++++++++
19 drivers/platform/x86/intel_ips.c | 36 +++++++++++++++++++++++++++++++++---
20 drivers/platform/x86/intel_ips.h | 21 +++++++++++++++++++++
21 3 files changed, 77 insertions(+), 3 deletions(-)
22 create mode 100644 drivers/platform/x86/intel_ips.h
23
24diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
25index e680081..cb900dc 100644
26--- a/drivers/gpu/drm/i915/i915_dma.c
27+++ b/drivers/gpu/drm/i915/i915_dma.c
28@@ -34,6 +34,7 @@
29 #include "i915_drm.h"
30 #include "i915_drv.h"
31 #include "i915_trace.h"
32+#include "../../../platform/x86/intel_ips.h"
33 #include <linux/pci.h>
34 #include <linux/vgaarb.h>
35 #include <linux/acpi.h>
36@@ -1871,6 +1872,26 @@ out_unlock:
37 EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
38
39 /**
40+ * Tells the intel_ips driver that the i915 driver is now loaded, if
41+ * IPS got loaded first.
42+ *
43+ * This awkward dance is so that neither module has to depend on the
44+ * other in order for IPS to do the appropriate communication of
45+ * GPU turbo limits to i915.
46+ */
47+static void
48+ips_ping_for_i915_load(void)
49+{
50+ void (*link)(void);
51+
52+ link = symbol_get(ips_link_to_i915_driver);
53+ if (link) {
54+ link();
55+ symbol_put(ips_link_to_i915_driver);
56+ }
57+}
58+
59+/**
60 * i915_driver_load - setup chip and create an initial config
61 * @dev: DRM device
62 * @flags: startup flags
63@@ -2075,6 +2096,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
64 dev_priv->mchdev_lock = &mchdev_lock;
65 spin_unlock(&mchdev_lock);
66
67+ ips_ping_for_i915_load();
68+
69 return 0;
70
71 out_workqueue_free:
72diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
73index c44a5e8..f0b3ad1 100644
74--- a/drivers/platform/x86/intel_ips.c
75+++ b/drivers/platform/x86/intel_ips.c
76@@ -75,6 +75,7 @@
77 #include <drm/i915_drm.h>
78 #include <asm/msr.h>
79 #include <asm/processor.h>
80+#include "intel_ips.h"
81
82 #define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32
83
84@@ -245,6 +246,7 @@
85 #define thm_writel(off, val) writel((val), ips->regmap + (off))
86
87 static const int IPS_ADJUST_PERIOD = 5000; /* ms */
88+static bool late_i915_load = false;
89
90 /* For initial average collection */
91 static const int IPS_SAMPLE_PERIOD = 200; /* ms */
92@@ -339,6 +341,9 @@ struct ips_driver {
93 u64 orig_turbo_ratios;
94 };
95
96+static bool
97+ips_gpu_turbo_enabled(struct ips_driver *ips);
98+
99 /**
100 * ips_cpu_busy - is CPU busy?
101 * @ips: IPS driver struct
102@@ -517,7 +522,7 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips)
103 */
104 static bool ips_gpu_busy(struct ips_driver *ips)
105 {
106- if (!ips->gpu_turbo_enabled)
107+ if (!ips_gpu_turbo_enabled(ips))
108 return false;
109
110 return ips->gpu_busy();
111@@ -532,7 +537,7 @@ static bool ips_gpu_busy(struct ips_driver *ips)
112 */
113 static void ips_gpu_raise(struct ips_driver *ips)
114 {
115- if (!ips->gpu_turbo_enabled)
116+ if (!ips_gpu_turbo_enabled(ips))
117 return;
118
119 if (!ips->gpu_raise())
120@@ -549,7 +554,7 @@ static void ips_gpu_raise(struct ips_driver *ips)
121 */
122 static void ips_gpu_lower(struct ips_driver *ips)
123 {
124- if (!ips->gpu_turbo_enabled)
125+ if (!ips_gpu_turbo_enabled(ips))
126 return;
127
128 if (!ips->gpu_lower())
129@@ -1454,6 +1459,31 @@ out_err:
130 return false;
131 }
132
133+static bool
134+ips_gpu_turbo_enabled(struct ips_driver *ips)
135+{
136+ if (!ips->gpu_busy && late_i915_load) {
137+ if (ips_get_i915_syms(ips)) {
138+ dev_info(&ips->dev->dev,
139+ "i915 driver attached, reenabling gpu turbo\n");
140+ ips->gpu_turbo_enabled = !(thm_readl(THM_HTS) & HTS_GTD_DIS);
141+ }
142+ }
143+
144+ return ips->gpu_turbo_enabled;
145+}
146+
147+void
148+ips_link_to_i915_driver()
149+{
150+ /* We can't cleanly get at the various ips_driver structs from
151+ * this caller (the i915 driver), so just set a flag saying
152+ * that it's time to try getting the symbols again.
153+ */
154+ late_i915_load = true;
155+}
156+EXPORT_SYMBOL_GPL(ips_link_to_i915_driver);
157+
158 static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = {
159 { PCI_DEVICE(PCI_VENDOR_ID_INTEL,
160 PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), },
161diff --git a/drivers/platform/x86/intel_ips.h b/drivers/platform/x86/intel_ips.h
162new file mode 100644
163index 0000000..73299be
164--- /dev/null
165+++ b/drivers/platform/x86/intel_ips.h
166@@ -0,0 +1,21 @@
167+/*
168+ * Copyright (c) 2010 Intel Corporation
169+ *
170+ * This program is free software; you can redistribute it and/or modify it
171+ * under the terms and conditions of the GNU General Public License,
172+ * version 2, as published by the Free Software Foundation.
173+ *
174+ * This program is distributed in the hope it will be useful, but WITHOUT
175+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
176+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
177+ * more details.
178+ *
179+ * You should have received a copy of the GNU General Public License along with
180+ * this program; if not, write to the Free Software Foundation, Inc.,
181+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
182+ *
183+ * The full GNU General Public License is included in this distribution in
184+ * the file called "COPYING".
185+ */
186+
187+void ips_link_to_i915_driver(void);
188--
1891.6.6.1
190