From 23b2f8bb92feb83127679c53633def32d3108e70 Mon Sep 17 00:00:00 2001
From: Jesse Barnes <jbarnes@virtuousgeek.org>
Date: Tue, 28 Jun 2011 13:04:16 -0700
Subject: [PATCH] drm/i915: load a ring frequency scaling table v3
Patch-mainline: 3.1-rc1
References: bnc#728329

The ring frequency scaling table tells the PCU to treat certain GPU
frequencies as if they were a given CPU frequency for purposes of
scaling the ring frequency.  Normally the PCU will scale the ring
frequency based on the CPU P-state, but with the table present, it will
also take the GPU frequency into account.

The main downside of keeping the ring frequency high while the CPU is
at a low frequency (or asleep altogether) is increased power
consumption.  But then if you're keeping your GPU busy, you probably
want the extra performance.

V2: - add units to debug table header (from Eric)
  - use tsc_khz as a fallback if the cpufreq driver doesn't give us a freq
    (from Chris)
V3: - fix comments & debug output
  - remove unneeded force wake get/put

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Takashi Iwai <tiwai@suse.de>

Automatically created from "patches.drivers/drm-i915-load-a-ring-frequency-scaling-table-v3" by xen-port-patches.py

--- sle11sp3.orig/drivers/gpu/drm/i915/intel_pm.c	2013-12-16 12:40:34.000000000 +0100
+++ sle11sp3/drivers/gpu/drm/i915/intel_pm.c	2013-12-16 12:48:40.000000000 +0100
@@ -2678,7 +2678,11 @@ static void gen6_update_ring_freq(struct
 	 * over
 	 */
 	if (!max_ia_freq)
+#ifndef CONFIG_XEN
 		max_ia_freq = tsc_khz;
+#else
+		max_ia_freq = cpu_khz;
+#endif
 
 	/* Convert from kHz to MHz */
 	max_ia_freq /= 1000;
