Skip to contentSkip to conversation

drm/i915: Remove memory frequency calculation

PATCH Superseded José Roberto de Souza 3 participants 4 messages Oct 13, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Remove memory frequency calculation

This memory frequency calculated is only used to check if it is zero, what is not useful as it will never actually be zero.

Also the calculation is wrong, we should be checking other bit to select the appropriate frequency multiplier while this code is stuck with a fixed multiplier.

So here dropping it as whole.

Cc Yakui Zhao <[email protected]>
Cc Matt Roper <[email protected]>
Fixes f8112cb9574b ("drm/i915/gen11+: Only load DRAM information from pcode")
---
 drivers/gpu/drm/i915/i915_reg.h   |  2 --
 drivers/gpu/drm/i915/intel_dram.c | 12 ------------
 2 files changed, 14 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +0 -2
index a897f4abea0c3..03b6c505249dc 100644
@@ -11145,9 +11145,7 @@ enum skl_power_gate {
 #define  BXT_DRAM_TYPE_LPDDR4			(0x2 << 22)
 #define  BXT_DRAM_TYPE_DDR4			(0x4 << 22)
 
-#define SKL_MEMORY_FREQ_MULTIPLIER_HZ		266666666
 #define SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU	_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5E04)
-#define  SKL_REQ_DATA_MASK			(0xF << 0)
 #define  DG1_GEAR_TYPE				REG_BIT(16)
 
 #define SKL_MAD_INTER_CHANNEL_0_0_0_MCHBAR_MCMAIN _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5000)
drivers/gpu/drm/i915/intel_dram.c +0 -12
index 30a0cab5eff46..31933b1e7277b 100644
@@ -244,7 +244,6 @@ static int
 skl_get_dram_info(struct drm_i915_private *i915)
 {
 	struct dram_info *dram_info = &i915->dram_info;
-	u32 mem_freq_khz, val;
 	int ret;
 
 	dram_info->type = skl_get_dram_type(i915);
@@ -255,17 +254,6 @@ skl_get_dram_info(struct drm_i915_private *i915)
 	if (ret)
 		return ret;
 
-	val = intel_uncore_read(&i915->uncore,
-				SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU);
-	mem_freq_khz = DIV_ROUND_UP((val & SKL_REQ_DATA_MASK) *
-				    SKL_MEMORY_FREQ_MULTIPLIER_HZ, 1000);
-
-	if (dram_info->num_channels * mem_freq_khz == 0) {
-		drm_info(&i915->drm,
-			 "Couldn't get system memory bandwidth\n");
-		return -EINVAL;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.33.0
#1 lore raw
Quoted 8 lines · José Roberto de Souza

This memory frequency calculated is only used to check if it is zero, what is not useful as it will never actually be zero.

Also the calculation is wrong, we should be checking other bit to select the appropriate frequency multiplier while this code is stuck with a fixed multiplier.

So here dropping it as whole.

I think we can do similar cleanup in bxt_get_dram_info() too. The value of BXT_P_CR_MC_BIOS_REQ_0_0_0 that we read is used to obtain mem_freq_khz and dram_channels/num_active_channels, but none of those variables are ever used for anything except a needless zero-check.

Matt

Quoted 56 lines
Cc Yakui Zhao <[email protected]>
Cc Matt Roper <[email protected]>
Fixes f8112cb9574b ("drm/i915/gen11+: Only load DRAM information from pcode")
---
 drivers/gpu/drm/i915/i915_reg.h   |  2 --
 drivers/gpu/drm/i915/intel_dram.c | 12 ------------
 2 files changed, 14 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +0 -2
index a897f4abea0c3..03b6c505249dc 100644
@@ -11145,9 +11145,7 @@ enum skl_power_gate {
 #define  BXT_DRAM_TYPE_LPDDR4			(0x2 << 22)
 #define  BXT_DRAM_TYPE_DDR4			(0x4 << 22)
 
-#define SKL_MEMORY_FREQ_MULTIPLIER_HZ		266666666
 #define SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU	_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5E04)
-#define  SKL_REQ_DATA_MASK			(0xF << 0)
 #define  DG1_GEAR_TYPE				REG_BIT(16)
 
 #define SKL_MAD_INTER_CHANNEL_0_0_0_MCHBAR_MCMAIN _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5000)
drivers/gpu/drm/i915/intel_dram.c +0 -12
index 30a0cab5eff46..31933b1e7277b 100644
@@ -244,7 +244,6 @@ static int
 skl_get_dram_info(struct drm_i915_private *i915)
 {
 	struct dram_info *dram_info = &i915->dram_info;
-	u32 mem_freq_khz, val;
 	int ret;
 
 	dram_info->type = skl_get_dram_type(i915);
@@ -255,17 +254,6 @@ skl_get_dram_info(struct drm_i915_private *i915)
 	if (ret)
 		return ret;
 
-	val = intel_uncore_read(&i915->uncore,
-				SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU);
-	mem_freq_khz = DIV_ROUND_UP((val & SKL_REQ_DATA_MASK) *
-				    SKL_MEMORY_FREQ_MULTIPLIER_HZ, 1000);
-
-	if (dram_info->num_channels * mem_freq_khz == 0) {
-		drm_info(&i915->drm,
-			 "Couldn't get system memory bandwidth\n");
-		return -EINVAL;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.33.0
Signature · 5 lines
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
#2 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Remove memory frequency calculation

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: drm/i915: Remove memory frequency calculation
URL : https://patchwork.freedesktop.org/series/95748/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
2fbf85e7741f drm/i915: Remove memory frequency calculation
-:19: WARNING:UNKNOWN_COMMIT_ID: Unknown commit id 'f8112cb9574b', maybe rebased or not pulled?
#19: 
Fixes: f8112cb9574b ("drm/i915/gen11+: Only load DRAM information from pcode")

total: 0 errors, 1 warnings, 0 checks, 33 lines checked

#3 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Remove memory frequency calculation

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: drm/i915: Remove memory frequency calculation
URL : https://patchwork.freedesktop.org/series/95748/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10728 -> Patchwork_21323
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/index.html

Known issues
------------

Here are the changes found in Patchwork_21323 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@execlists:
- fi-bsw-nick: [PASS][1] -> [INCOMPLETE][2] ([i915#2940])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10728/fi-bsw-nick/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/fi-bsw-nick/igt@i915_selftest@[email protected]

* igt@kms_flip@basic-plain-flip@c-dp1:
- fi-cfl-8109u: [PASS][3] -> [FAIL][4] ([i915#4165])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10728/fi-cfl-8109u/igt@kms_flip@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/fi-cfl-8109u/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-cml-u2: [PASS][5] -> [DMESG-WARN][6] ([i915#4269])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10728/fi-cml-u2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/fi-cml-u2/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:
- fi-cfl-8109u: [PASS][7] -> [DMESG-WARN][8] ([i915#295]) +14 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10728/fi-cfl-8109u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/fi-cfl-8109u/igt@[email protected]

* igt@runner@aborted:
- fi-bsw-nick: NOTRUN -> [FAIL][9] ([fdo#109271] / [i915#1436] / [i915#3428])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/fi-bsw-nick/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@hangcheck:
- {fi-hsw-gt1}: [DMESG-WARN][10] ([i915#3303]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10728/fi-hsw-gt1/igt@i915_selftest@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/fi-hsw-gt1/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@perf:
- {fi-tgl-dsi}: [DMESG-WARN][12] ([i915#2867]) -> [PASS][13] +9 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10728/fi-tgl-dsi/igt@i915_selftest@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/fi-tgl-dsi/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
[i915#295]: https://gitlab.freedesktop.org/drm/intel/issues/295
[i915#3057]: https://gitlab.freedesktop.org/drm/intel/issues/3057
[i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
[i915#3428]: https://gitlab.freedesktop.org/drm/intel/issues/3428
[i915#3970]: https://gitlab.freedesktop.org/drm/intel/issues/3970
[i915#4165]: https://gitlab.freedesktop.org/drm/intel/issues/4165
[i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269

Participating hosts (41 -> 37)
------------------------------

Missing (4): fi-ctg-p8600 fi-ilk-m540 fi-bsw-cyan fi-hsw-4200u

Build changes
-------------

* Linux: CI_DRM_10728 -> Patchwork_21323

CI-20190529: 20190529
CI_DRM_10728: 82a9f298afec66c882e710078138891826ce5e22 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6242: 721fd85ee95225ed5df322f7182bdfa9b86a3e68 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21323: 2fbf85e7741f5f7b83caa5c6314900be1c303d04 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

2fbf85e7741f drm/i915: Remove memory frequency calculation

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21323/index.html