All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] drm/i915: Remove memory frequency calculation" failed to apply to 5.14-stable tree
@ 2021-10-30 13:05 gregkh
  2021-11-01 18:32 ` [PATCH] drm/i915: Remove memory frequency calculation José Roberto de Souza
  0 siblings, 1 reply; 6+ messages in thread
From: gregkh @ 2021-10-30 13:05 UTC (permalink / raw)
  To: jose.souza, jani.nikula, matthew.d.roper, yakui.zhao; +Cc: stable


The patch below does not apply to the 5.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 59be177a909ac320e5f4b2a461ac09e20f35b2d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= <jose.souza@intel.com>
Date: Tue, 12 Oct 2021 18:00:46 -0700
Subject: [PATCH] drm/i915: Remove memory frequency calculation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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.

v2:
- Also remove memory frequency calculation for gen9 LP platforms

Cc: Yakui Zhao <yakui.zhao@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Fixes: 5d0c938ec9cc ("drm/i915/gen11+: Only load DRAM information from pcode")
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211013010046.91858-1-jose.souza@intel.com
(cherry picked from commit 83f52364b15265aec47d07e02b0fbf4093ab8554)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 4037030f0984..9023d4ecf3b3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -11048,12 +11048,6 @@ enum skl_power_gate {
 #define  DC_STATE_DEBUG_MASK_CORES	(1 << 0)
 #define  DC_STATE_DEBUG_MASK_MEMORY_UP	(1 << 1)
 
-#define BXT_P_CR_MC_BIOS_REQ_0_0_0	_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x7114)
-#define  BXT_REQ_DATA_MASK			0x3F
-#define  BXT_DRAM_CHANNEL_ACTIVE_SHIFT		12
-#define  BXT_DRAM_CHANNEL_ACTIVE_MASK		(0xF << 12)
-#define  BXT_MEMORY_FREQ_MULTIPLIER_HZ		133333333
-
 #define BXT_D_CR_DRP0_DUNIT8			0x1000
 #define BXT_D_CR_DRP0_DUNIT9			0x1200
 #define  BXT_D_CR_DRP0_DUNIT_START		8
@@ -11084,9 +11078,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)
diff --git a/drivers/gpu/drm/i915/intel_dram.c b/drivers/gpu/drm/i915/intel_dram.c
index 91866520c173..7acce64b0941 100644
--- a/drivers/gpu/drm/i915/intel_dram.c
+++ b/drivers/gpu/drm/i915/intel_dram.c
@@ -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;
 }
 
@@ -350,24 +338,10 @@ static void bxt_get_dimm_info(struct dram_dimm_info *dimm, u32 val)
 static int bxt_get_dram_info(struct drm_i915_private *i915)
 {
 	struct dram_info *dram_info = &i915->dram_info;
-	u32 dram_channels;
-	u32 mem_freq_khz, val;
-	u8 num_active_channels, valid_ranks = 0;
+	u32 val;
+	u8 valid_ranks = 0;
 	int i;
 
-	val = intel_uncore_read(&i915->uncore, BXT_P_CR_MC_BIOS_REQ_0_0_0);
-	mem_freq_khz = DIV_ROUND_UP((val & BXT_REQ_DATA_MASK) *
-				    BXT_MEMORY_FREQ_MULTIPLIER_HZ, 1000);
-
-	dram_channels = val & BXT_DRAM_CHANNEL_ACTIVE_MASK;
-	num_active_channels = hweight32(dram_channels);
-
-	if (mem_freq_khz * num_active_channels == 0) {
-		drm_info(&i915->drm,
-			 "Couldn't get system memory bandwidth\n");
-		return -EINVAL;
-	}
-
 	/*
 	 * Now read each DUNIT8/9/10/11 to check the rank of each dimms.
 	 */


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] drm/i915: Remove memory frequency calculation
  2021-10-30 13:05 FAILED: patch "[PATCH] drm/i915: Remove memory frequency calculation" failed to apply to 5.14-stable tree gregkh
@ 2021-11-01 18:32 ` José Roberto de Souza
  2021-11-03  9:46   ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: José Roberto de Souza @ 2021-11-01 18:32 UTC (permalink / raw)
  To: gregkh, stable
  Cc: jani.nikula, Yakui Zhao, Matt Roper, 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.

v2:
- Also remove memory frequency calculation for gen9 LP platforms

Cc: <stable@vger.kernel.org> # 5.14-stable
Cc: Yakui Zhao <yakui.zhao@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Fixes: 5d0c938ec9cc ("drm/i915/gen11+: Only load DRAM information from pcode")
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211013010046.91858-1-jose.souza@intel.com
(cherry picked from commit 83f52364b15265aec47d07e02b0fbf4093ab8554)
---
 drivers/gpu/drm/i915/i915_reg.h   |  8 --------
 drivers/gpu/drm/i915/intel_dram.c | 30 ++----------------------------
 2 files changed, 2 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 5aa5ddefd22d2..f0f073bf72a48 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -11021,12 +11021,6 @@ enum skl_power_gate {
 #define  DC_STATE_DEBUG_MASK_CORES	(1 << 0)
 #define  DC_STATE_DEBUG_MASK_MEMORY_UP	(1 << 1)
 
-#define BXT_P_CR_MC_BIOS_REQ_0_0_0	_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x7114)
-#define  BXT_REQ_DATA_MASK			0x3F
-#define  BXT_DRAM_CHANNEL_ACTIVE_SHIFT		12
-#define  BXT_DRAM_CHANNEL_ACTIVE_MASK		(0xF << 12)
-#define  BXT_MEMORY_FREQ_MULTIPLIER_HZ		133333333
-
 #define BXT_D_CR_DRP0_DUNIT8			0x1000
 #define BXT_D_CR_DRP0_DUNIT9			0x1200
 #define  BXT_D_CR_DRP0_DUNIT_START		8
@@ -11057,9 +11051,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 SKL_MAD_INTER_CHANNEL_0_0_0_MCHBAR_MCMAIN _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5000)
 #define  SKL_DRAM_DDR_TYPE_MASK			(0x3 << 0)
diff --git a/drivers/gpu/drm/i915/intel_dram.c b/drivers/gpu/drm/i915/intel_dram.c
index 50fdea84ba706..300dfe239b8cc 100644
--- a/drivers/gpu/drm/i915/intel_dram.c
+++ b/drivers/gpu/drm/i915/intel_dram.c
@@ -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;
 }
 
@@ -350,24 +338,10 @@ static void bxt_get_dimm_info(struct dram_dimm_info *dimm, u32 val)
 static int bxt_get_dram_info(struct drm_i915_private *i915)
 {
 	struct dram_info *dram_info = &i915->dram_info;
-	u32 dram_channels;
-	u32 mem_freq_khz, val;
-	u8 num_active_channels, valid_ranks = 0;
+	u32 val;
+	u8 valid_ranks = 0;
 	int i;
 
-	val = intel_uncore_read(&i915->uncore, BXT_P_CR_MC_BIOS_REQ_0_0_0);
-	mem_freq_khz = DIV_ROUND_UP((val & BXT_REQ_DATA_MASK) *
-				    BXT_MEMORY_FREQ_MULTIPLIER_HZ, 1000);
-
-	dram_channels = val & BXT_DRAM_CHANNEL_ACTIVE_MASK;
-	num_active_channels = hweight32(dram_channels);
-
-	if (mem_freq_khz * num_active_channels == 0) {
-		drm_info(&i915->drm,
-			 "Couldn't get system memory bandwidth\n");
-		return -EINVAL;
-	}
-
 	/*
 	 * Now read each DUNIT8/9/10/11 to check the rank of each dimms.
 	 */
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/i915: Remove memory frequency calculation
  2021-11-01 18:32 ` [PATCH] drm/i915: Remove memory frequency calculation José Roberto de Souza
@ 2021-11-03  9:46   ` Greg KH
  2021-11-04  0:30     ` Souza, Jose
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2021-11-03  9:46 UTC (permalink / raw)
  To: José Roberto de Souza; +Cc: stable, jani.nikula, Yakui Zhao, Matt Roper

On Mon, Nov 01, 2021 at 11:32:30AM -0700, José Roberto de Souza wrote:
> 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.
> 
> v2:
> - Also remove memory frequency calculation for gen9 LP platforms
> 
> Cc: <stable@vger.kernel.org> # 5.14-stable
> Cc: Yakui Zhao <yakui.zhao@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Fixes: 5d0c938ec9cc ("drm/i915/gen11+: Only load DRAM information from pcode")
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> Link: https://patchwork.freedesktop.org/patch/msgid/20211013010046.91858-1-jose.souza@intel.com
> (cherry picked from commit 83f52364b15265aec47d07e02b0fbf4093ab8554)

There is no such commit in Linus's tree.

What commit is this that is being backported?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/i915: Remove memory frequency calculation
  2021-11-03  9:46   ` Greg KH
@ 2021-11-04  0:30     ` Souza, Jose
  2021-11-04  8:14       ` gregkh
  2021-11-04  8:16       ` gregkh
  0 siblings, 2 replies; 6+ messages in thread
From: Souza, Jose @ 2021-11-04  0:30 UTC (permalink / raw)
  To: gregkh; +Cc: Zhao, Yakui, stable, Nikula, Jani, Roper, Matthew D

On Wed, 2021-11-03 at 10:46 +0100, Greg KH wrote:
> On Mon, Nov 01, 2021 at 11:32:30AM -0700, José Roberto de Souza wrote:
> > 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.
> > 
> > v2:
> > - Also remove memory frequency calculation for gen9 LP platforms
> > 
> > Cc: <stable@vger.kernel.org> # 5.14-stable
> > Cc: Yakui Zhao <yakui.zhao@intel.com>
> > Cc: Matt Roper <matthew.d.roper@intel.com>
> > Fixes: 5d0c938ec9cc ("drm/i915/gen11+: Only load DRAM information from pcode")
> > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> > Link: https://patchwork.freedesktop.org/patch/msgid/20211013010046.91858-1-jose.souza@intel.com
> > (cherry picked from commit 83f52364b15265aec47d07e02b0fbf4093ab8554)
> 
> There is no such commit in Linus's tree.
> 
> What commit is this that is being backported?

It is on Linus's tree:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=83f52364b15265aec47d07e02b0fbf4093ab8554

> 
> confused,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/i915: Remove memory frequency calculation
  2021-11-04  0:30     ` Souza, Jose
@ 2021-11-04  8:14       ` gregkh
  2021-11-04  8:16       ` gregkh
  1 sibling, 0 replies; 6+ messages in thread
From: gregkh @ 2021-11-04  8:14 UTC (permalink / raw)
  To: Souza, Jose; +Cc: Zhao, Yakui, stable, Nikula, Jani, Roper, Matthew D

On Thu, Nov 04, 2021 at 12:30:18AM +0000, Souza, Jose wrote:
> On Wed, 2021-11-03 at 10:46 +0100, Greg KH wrote:
> > On Mon, Nov 01, 2021 at 11:32:30AM -0700, José Roberto de Souza wrote:
> > > 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.
> > > 
> > > v2:
> > > - Also remove memory frequency calculation for gen9 LP platforms
> > > 
> > > Cc: <stable@vger.kernel.org> # 5.14-stable
> > > Cc: Yakui Zhao <yakui.zhao@intel.com>
> > > Cc: Matt Roper <matthew.d.roper@intel.com>
> > > Fixes: 5d0c938ec9cc ("drm/i915/gen11+: Only load DRAM information from pcode")
> > > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > > Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> > > Link: https://patchwork.freedesktop.org/patch/msgid/20211013010046.91858-1-jose.souza@intel.com
> > > (cherry picked from commit 83f52364b15265aec47d07e02b0fbf4093ab8554)
> > 
> > There is no such commit in Linus's tree.
> > 
> > What commit is this that is being backported?
> 
> It is on Linus's tree:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=83f52364b15265aec47d07e02b0fbf4093ab8554

Now it is, yes, sorry.  It is not in a public release yet, which is why
my tools didn't catch this.

I guess you all want this in "now", so I'll go queue it up, but next
time, please give us a hint as to what is going on...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/i915: Remove memory frequency calculation
  2021-11-04  0:30     ` Souza, Jose
  2021-11-04  8:14       ` gregkh
@ 2021-11-04  8:16       ` gregkh
  1 sibling, 0 replies; 6+ messages in thread
From: gregkh @ 2021-11-04  8:16 UTC (permalink / raw)
  To: Souza, Jose; +Cc: Zhao, Yakui, stable, Nikula, Jani, Roper, Matthew D

On Thu, Nov 04, 2021 at 12:30:18AM +0000, Souza, Jose wrote:
> On Wed, 2021-11-03 at 10:46 +0100, Greg KH wrote:
> > On Mon, Nov 01, 2021 at 11:32:30AM -0700, José Roberto de Souza wrote:
> > > 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.
> > > 
> > > v2:
> > > - Also remove memory frequency calculation for gen9 LP platforms
> > > 
> > > Cc: <stable@vger.kernel.org> # 5.14-stable
> > > Cc: Yakui Zhao <yakui.zhao@intel.com>
> > > Cc: Matt Roper <matthew.d.roper@intel.com>
> > > Fixes: 5d0c938ec9cc ("drm/i915/gen11+: Only load DRAM information from pcode")
> > > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > > Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> > > Link: https://patchwork.freedesktop.org/patch/msgid/20211013010046.91858-1-jose.souza@intel.com
> > > (cherry picked from commit 83f52364b15265aec47d07e02b0fbf4093ab8554)
> > 
> > There is no such commit in Linus's tree.
> > 
> > What commit is this that is being backported?
> 
> It is on Linus's tree:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=83f52364b15265aec47d07e02b0fbf4093ab8554

Ah, no, this is REALLY commit 59be177a909a ("drm/i915: Remove memory
frequency calculation"), which came in 5.15.

{sigh}

Someday the i915 developers will fix up how they reference git sha ids
and not do things that "look into the future" which causes so many
confusions over the years.

ugh.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-04  8:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-30 13:05 FAILED: patch "[PATCH] drm/i915: Remove memory frequency calculation" failed to apply to 5.14-stable tree gregkh
2021-11-01 18:32 ` [PATCH] drm/i915: Remove memory frequency calculation José Roberto de Souza
2021-11-03  9:46   ` Greg KH
2021-11-04  0:30     ` Souza, Jose
2021-11-04  8:14       ` gregkh
2021-11-04  8:16       ` gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.