Bug 92768 - [BXT-P] [IGT Basic] pm_rps / basic-api fails
Summary: [BXT-P] [IGT Basic] pm_rps / basic-api fails
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: highest blocker
Assignee: Mika Kuoppala
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-01 17:33 UTC by cprigent
Modified: 2016-01-29 19:10 UTC (History)
2 users (show)

See Also:
i915 platform: BXT
i915 features:


Attachments
kern.log (333.22 KB, text/plain)
2015-11-02 13:31 UTC, cprigent
no flags Details

Description cprigent 2015-11-01 17:33:35 UTC
BXT-P
Hardware 
Platform: Broxton P A0 Platform 
CPU Name : Intel(R) @ 1.2 GHz (family: 6, model: 92, stepping: 8) – 4 cores
SoC : BROXTON-P A0
CRB : Apollo Lake RVP Fab1
Software 
Linux distribution: Ubuntu 15.04 64 bits 
Kernel: 26f82bd8 4.3-rc5 from https://github.com/ideak/linux.git 
BIOS: APLKRVPA.X64.0104.R43.1510080446 
BIOS (IFWI Version): APLK_IFWI_X64_R_2015_41_5_02
CSE : 3.0.0.1044
KSC : 1.02

Steps:
-------
Execute command:
./pm_rps --run-subtest basic-api

Actual result:
---------------
Test result is fail

Expected result:
----------------
Test is Pass
Comment 1 cprigent 2015-11-01 17:34:16 UTC
Assigned to me. I will attached the log.
Comment 2 cprigent 2015-11-02 13:31:43 UTC
Created attachment 119342 [details]
kern.log

/var/log/kern.log attached, tested with:
kernel 4.3.0-rc5 (26f82bd8) from https://github.com/ideak/linux.git BXT branch
commit 26f82bd872901733b739480e8899a92966ae9292
Author: Imre Deak <imre.deak@intel.com>
Date:   Tue Oct 20 16:44:03 2015 +0300
drm/i915/bxt: update bxt_defconfig
Enable Kconfig options needed for UART/eMMC.
Signed-off-by: Imre Deak <imre.deak@intel.com>

Log from the IGT:
./pm_rps --run-subtest basic-api
IGT-Version: 1.12-NOT-GIT (x86_64) (Linux: 4.3.0-rc5-intel-bxt+ x86_64)
Test assertion failure function do_writeval, file pm_rps.c:136:
Failed assertion: readval(filp) == val
error: 350 != 366
Stack trace:
  #0 [__igt_fail_assert+0xf1]
  #1 [do_writeval+0xf7]
  #2 [min_max_config+0x107]
  #3 [__real_main655+0x21f]
  #4 [main+0x29]
  #5 [__libc_start_main+0xf0]
  #6 [_start+0x29]
  #7 [<unknown>+0x29]
Subtest basic-api failed.
**** DEBUG ****

Check original min and max...
gt freq (MHz):  cur=100  min=100  max=650  RP0=650  RP1=200  RPn=100

Set min=RPn and max=RP0...
gt freq (MHz):  cur=100  min=100  max=650  RP0=650  RP1=200  RPn=100

Increase min to midpoint...
Test assertion failure function do_writeval, file pm_rps.c:136:
Failed assertion: readval(filp) == val
error: 350 != 366
****  END  ****
Subtest basic-api: FAIL (0.008s)
Comment 3 Matt Roper 2015-11-07 00:23:46 UTC
Bob Paauwe from my team has a fix for this failure; he'll be posting a patch in the next day or two.
Comment 4 Imre Deak 2015-11-11 15:43:38 UTC
Could you test if the following fixes the basic-api subtest?:

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index e9d85b8..ea1ad4e 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -7139,7 +7139,8 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
 int intel_gpu_freq(struct drm_i915_private *dev_priv, int val)
 {
 	if (IS_GEN9(dev_priv->dev))
-		return (val * GT_FREQUENCY_MULTIPLIER) / GEN9_FREQ_SCALER;
+		return DIV_ROUND_CLOSEST(val * GT_FREQUENCY_MULTIPLIER,
+					 GEN9_FREQ_SCALER);
 	else if (IS_CHERRYVIEW(dev_priv->dev))
 		return chv_gpu_freq(dev_priv, val);
 	else if (IS_VALLEYVIEW(dev_priv->dev))
@@ -7151,13 +7152,14 @@ int intel_gpu_freq(struct drm_i915_private *dev_priv, int val)
 int intel_freq_opcode(struct drm_i915_private *dev_priv, int val)
 {
 	if (IS_GEN9(dev_priv->dev))
-		return (val * GEN9_FREQ_SCALER) / GT_FREQUENCY_MULTIPLIER;
+		return DIV_ROUND_CLOSEST(val * GEN9_FREQ_SCALER,
+					 GT_FREQUENCY_MULTIPLIER);
 	else if (IS_CHERRYVIEW(dev_priv->dev))
 		return chv_freq_opcode(dev_priv, val);
 	else if (IS_VALLEYVIEW(dev_priv->dev))
 		return byt_freq_opcode(dev_priv, val);
 	else
-		return val / GT_FREQUENCY_MULTIPLIER;
+		return DIV_ROUND_CLOSEST(val, GT_FREQUENCY_MULTIPLIER);
 }
 
 struct request_boost {
Comment 5 Bob Paauwe 2015-11-12 18:12:48 UTC
Imre,  That patch does allow the basic-api test to succeed for me.
Comment 6 Jani Nikula 2015-11-13 08:54:49 UTC
(In reply to Bob Paauwe from comment #5)
> Imre,  That patch does allow the basic-api test to succeed for me.

Imre, please post this as a proper patch to the ml.
Comment 7 Imre Deak 2015-11-13 09:01:53 UTC
Mika, is preparing a patchset, he will include this as the first patch in that.
Comment 8 Mika Kuoppala 2015-11-17 16:22:40 UTC
commit 500a3d2eb3883b71350036e15aad286cc6e5df21
Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Date:   Fri Nov 13 19:29:41 2015 +0200

    drm/i915: Fix GT frequency rounding
Comment 9 cprigent 2016-01-29 19:10:03 UTC
Test is Pass.

Setup:
======
Platform: Broxton P A0 Platform
CPU Name : Intel(R) @ 1.2 GHz (family: 6, model: 92, stepping: 8) – 4 cores
SoC : BROXTON-P A0
CRB :  Apollo Lake RVPC1 Fab1 
Reworks : R14, R06C and R16

Software:
=========
BIOS (IFWI Version): APLK_IFWI_X64_R_2015_41_5_02 
KSC : 1.02
Linux distribution: Ubuntu 15.10 64 bits
Kernel: drm-intel-nightly 4.4.0 8114b00 from http://cgit.freedesktop.org/drm-intel/
drm: tag libdrm-2.4.66 e342c0f from http://cgit.freedesktop.org/mesa/drm/
mesa: tag mesa-11.0.8 261daab from http://cgit.freedesktop.org/mesa/mesa/
cairo: tag 1.15.2 db8a7f1 from http://cgit.freedesktop.org/cairo
waffle: master bb29b2a from https://github.com/waffle-gl/waffle
xorg-server-macros: master d7acec2 from git://git.freedesktop.org/git/xorg/util/macros
libva: tag libva-1.6.1 cb418f6 from http://cgit.freedesktop.org/libva/
vaapi-intel-driver: tag 1.6.1 2110b3a from http://cgit.freedesktop.org/vaapi/intel-driver
DMC from https://01.org/linuxgraphics/downloads/broxton-dmc-1.06

Tool:
======
intel-gpu-tool: tag intel-gpu-tools-1.13 51e965f from http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/
Monitors: Asus PB287Q (4K), Samsung S24C650


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.