[kernel] make intel_ips work

Kyle McMartin kyle at fedoraproject.org
Thu Sep 30 17:55:43 UTC 2010


commit a1ae90088001391a0a1d4892f5850a02564102cc
Author: Kyle McMartin <kyle at dreadnought.i.jkkm.org>
Date:   Thu Sep 30 13:14:30 2010 -0400

    make intel_ips work

 fix-intel_ips-to-work-properly.patch |  105 ++++++++++++++++++++++++++++++++++
 kernel.spec                          |    9 +++-
 2 files changed, 113 insertions(+), 1 deletions(-)
---
diff --git a/fix-intel_ips-to-work-properly.patch b/fix-intel_ips-to-work-properly.patch
new file mode 100644
index 0000000..a5e03d2
--- /dev/null
+++ b/fix-intel_ips-to-work-properly.patch
@@ -0,0 +1,105 @@
+diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
+index 9d67b48..c74e4e8 100644
+--- a/drivers/gpu/drm/i915/i915_dma.c
++++ b/drivers/gpu/drm/i915/i915_dma.c
+@@ -1787,9 +1787,9 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv)
+ 		}
+ 	}
+ 
+-	div_u64(diff, diff1);
++	diff = div_u64(diff, diff1);
+ 	ret = ((m * diff) + c);
+-	div_u64(ret, 10);
++	ret = div_u64(ret, 10);
+ 
+ 	dev_priv->last_count1 = total_count;
+ 	dev_priv->last_time1 = now;
+@@ -1858,7 +1858,7 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv)
+ 
+ 	/* More magic constants... */
+ 	diff = diff * 1181;
+-	div_u64(diff, diffms * 10);
++	diff = div_u64(diff, diffms * 10);
+ 	dev_priv->gfx_power = diff;
+ }
+ 
+diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
+index 9024480..bfa9c72 100644
+--- a/drivers/platform/x86/intel_ips.c
++++ b/drivers/platform/x86/intel_ips.c
+@@ -230,7 +230,7 @@
+ #define THM_TC2		0xac
+ #define THM_DTV		0xb0
+ #define THM_ITV		0xd8
+-#define   ITV_ME_SEQNO_MASK 0x000f0000 /* ME should update every ~200ms */
++#define   ITV_ME_SEQNO_MASK 0x00ff0000 /* ME should update every ~200ms */
+ #define   ITV_ME_SEQNO_SHIFT (16)
+ #define   ITV_MCH_TEMP_MASK 0x0000ff00
+ #define   ITV_MCH_TEMP_SHIFT (8)
+@@ -940,7 +940,6 @@ static int ips_monitor(void *data)
+ 		kfree(mch_samples);
+ 		kfree(cpu_samples);
+ 		kfree(mchp_samples);
+-		kthread_stop(ips->adjust);
+ 		return -ENOMEM;
+ 	}
+ 
+@@ -948,7 +947,7 @@ static int ips_monitor(void *data)
+ 		ITV_ME_SEQNO_SHIFT;
+ 	seqno_timestamp = get_jiffies_64();
+ 
+-	old_cpu_power = thm_readl(THM_CEC) / 65535;
++	old_cpu_power = thm_readl(THM_CEC);
+ 	schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD));
+ 
+ 	/* Collect an initial average */
+@@ -1390,7 +1389,7 @@ static bool ips_get_i915_syms(struct ips_driver *ips)
+ 	return true;
+ 
+ out_put_busy:
+-	symbol_put(i915_gpu_turbo_disable);
++	symbol_put(i915_gpu_busy);
+ out_put_lower:
+ 	symbol_put(i915_gpu_lower);
+ out_put_raise:
+@@ -1535,19 +1534,24 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
+ 	ips_enable_cpu_turbo(ips);
+ 	ips->cpu_turbo_enabled = true;
+ 
+-	/* Set up the work queue and monitor/adjust threads */
+-	ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor");
+-	if (IS_ERR(ips->monitor)) {
++	/* Create thermal adjust thread */
++	ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust");
++	if (IS_ERR(ips->adjust)) {
+ 		dev_err(&dev->dev,
+-			"failed to create thermal monitor thread, aborting\n");
++			"failed to create thermal adjust thread, aborting\n");
+ 		ret = -ENOMEM;
+ 		goto error_free_irq;
++
+ 	}
+ 
+-	ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust");
+-	if (IS_ERR(ips->adjust)) {
++	/*
++	 * Set up the work queue and monitor thread. The monitor thread
++	 * will wake up ips_adjust thread.
++	 */
++	ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor");
++	if (IS_ERR(ips->monitor)) {
+ 		dev_err(&dev->dev,
+-			"failed to create thermal adjust thread, aborting\n");
++			"failed to create thermal monitor thread, aborting\n");
+ 		ret = -ENOMEM;
+ 		goto error_thread_cleanup;
+ 	}
+@@ -1566,7 +1570,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
+ 	return ret;
+ 
+ error_thread_cleanup:
+-	kthread_stop(ips->monitor);
++	kthread_stop(ips->adjust);
+ error_free_irq:
+ 	free_irq(ips->dev->irq, ips);
+ error_unmap:
diff --git a/kernel.spec b/kernel.spec
index 1be1b8a..3613ec7 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -51,7 +51,7 @@ Summary: The Linux kernel
 # For non-released -rc kernels, this will be prepended with "0.", so
 # for example a 3 here will become 0.3
 #
-%global baserelease 28
+%global baserelease 30
 %global fedora_build %{baserelease}
 
 # base_sublevel is the kernel version we're starting with and patching
@@ -723,6 +723,8 @@ Patch12224: pci-v2-4-4-PCI-allocate-bus-resources-from-the-top-down.patch
 Patch12300: btusb-macbookpro-7-1.patch
 Patch12301: btusb-macbookpro-6-2.patch
 
+Patch12310: fix-intel_ips-to-work-properly.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1328,6 +1330,8 @@ ApplyPatch pci-v2-4-4-PCI-allocate-bus-resources-from-the-top-down.patch
 ApplyPatch btusb-macbookpro-7-1.patch
 ApplyPatch btusb-macbookpro-6-2.patch
 
+ApplyPatch fix-intel_ips-to-work-properly.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -1935,6 +1939,9 @@ fi
 #                 ||     ||
 
 %changelog
+* Thu Sep 30 2010 Kyle McMartin <kyle at redhat.com> 2.6.36-0.30.rc6
+- Collection of patches to make intel_ips work properly.
+
 * Wed Sep 29 2010 Dave Jones <davej at redhat.com>
 - Add back an old hack to make an SDV e1000e variant work.
 


More information about the scm-commits mailing list