From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 5/5] drm/i915/dram: move fsb_freq and mem_freq to dram info
Date: Fri, 15 Aug 2025 11:49:08 -0400 [thread overview]
Message-ID: <aJ9W9JYeLiXPmHYo@intel.com> (raw)
In-Reply-To: <61895ad35a6d50a3028ff84d1eeabdf3e0eca4ef@intel.com>
On Wed, Aug 06, 2025 at 04:57:53PM +0300, Jani Nikula wrote:
> On Tue, 05 Aug 2025, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> > On Thu, Jul 31, 2025 at 05:21:25PM +0300, Jani Nikula wrote:
> >> Store fsb_freq and mem_freq in dram info the same way we do for other
> >> memory info on later platforms for a slightly more unified approach.
> >>
> >> This allows us to remove fsb_freq, mem_freq and is_ddr3 members from
> >> struct drm_i915_private and struct xe_device.
> >>
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >> ---
> >> drivers/gpu/drm/i915/display/i9xx_wm.c | 13 +++++----
> >> drivers/gpu/drm/i915/i915_drv.h | 2 --
> >> drivers/gpu/drm/i915/soc/intel_dram.c | 38 +++++++++++---------------
> >> drivers/gpu/drm/i915/soc/intel_dram.h | 2 ++
> >> drivers/gpu/drm/xe/xe_device_types.h | 1 -
> >> 5 files changed, 26 insertions(+), 30 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/display/i9xx_wm.c b/drivers/gpu/drm/i915/display/i9xx_wm.c
> >> index 1f9db5118777..591acce2a4b1 100644
> >> --- a/drivers/gpu/drm/i915/display/i9xx_wm.c
> >> +++ b/drivers/gpu/drm/i915/display/i9xx_wm.c
> >> @@ -3,6 +3,8 @@
> >> * Copyright © 2023 Intel Corporation
> >> */
> >>
> >> +#include "soc/intel_dram.h"
> >> +
> >> #include "i915_drv.h"
> >> #include "i915_reg.h"
> >> #include "i9xx_wm.h"
> >> @@ -85,7 +87,8 @@ static const struct cxsr_latency cxsr_latency_table[] = {
> >>
> >> static const struct cxsr_latency *pnv_get_cxsr_latency(struct intel_display *display)
> >> {
> >> - struct drm_i915_private *i915 = to_i915(display->drm);
> >> + const struct dram_info *dram_info = intel_dram_info(display->drm);
> >> + bool is_ddr3 = dram_info->type == INTEL_DRAM_DDR3;
> >
> > does this deserves a separate patch? I'm not sure if I followed here...
>
> The current check in the loop below is
>
> i915->is_ddr3 == latency->is_ddr3
>
> and with i915->is_ddr3 being replaced by dram_info->type, I thought it's
> simpler to have that variable.
oh, it makes sense now... what I was missing was the part where
that was getting set in the pnv block.
>
> The alternative is to convert the cxsr_latency_table to use enum
> intel_dram_type and INTEL_DRAM_DDR3, but I felt that's a bit much.
no need for that indeed.
Thanks for the explanation and patience
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>
> >
> >> int i;
> >>
> >> for (i = 0; i < ARRAY_SIZE(cxsr_latency_table); i++) {
> >> @@ -93,15 +96,15 @@ static const struct cxsr_latency *pnv_get_cxsr_latency(struct intel_display *dis
> >> bool is_desktop = !display->platform.mobile;
> >>
> >> if (is_desktop == latency->is_desktop &&
> >> - i915->is_ddr3 == latency->is_ddr3 &&
> >> - DIV_ROUND_CLOSEST(i915->fsb_freq, 1000) == latency->fsb_freq &&
> >> - DIV_ROUND_CLOSEST(i915->mem_freq, 1000) == latency->mem_freq)
> >> + is_ddr3 == latency->is_ddr3 &&
> >> + DIV_ROUND_CLOSEST(dram_info->fsb_freq, 1000) == latency->fsb_freq &&
> >> + DIV_ROUND_CLOSEST(dram_info->mem_freq, 1000) == latency->mem_freq)
> >> return latency;
> >> }
> >>
> >> drm_dbg_kms(display->drm,
> >> "Could not find CxSR latency for DDR%s, FSB %u kHz, MEM %u kHz\n",
> >> - i915->is_ddr3 ? "3" : "2", i915->fsb_freq, i915->mem_freq);
> >> + is_ddr3 ? "3" : "2", dram_info->fsb_freq, dram_info->mem_freq);
> >>
> >> return NULL;
> >> }
> >> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> >> index 4e4e89746aa6..2f3965feada1 100644
> >> --- a/drivers/gpu/drm/i915/i915_drv.h
> >> +++ b/drivers/gpu/drm/i915/i915_drv.h
> >> @@ -237,8 +237,6 @@ struct drm_i915_private {
> >>
> >> bool preserve_bios_swizzle;
> >>
> >> - unsigned int fsb_freq, mem_freq, is_ddr3;
> >> -
> >> unsigned int hpll_freq;
> >> unsigned int czclk_freq;
> >>
> >> diff --git a/drivers/gpu/drm/i915/soc/intel_dram.c b/drivers/gpu/drm/i915/soc/intel_dram.c
> >> index d896fb67270f..6405a3d0b930 100644
> >> --- a/drivers/gpu/drm/i915/soc/intel_dram.c
> >> +++ b/drivers/gpu/drm/i915/soc/intel_dram.c
> >> @@ -149,17 +149,6 @@ unsigned int intel_mem_freq(struct drm_i915_private *i915)
> >> return 0;
> >> }
> >>
> >> -static void detect_mem_freq(struct drm_i915_private *i915)
> >> -{
> >> - i915->mem_freq = intel_mem_freq(i915);
> >> -
> >> - if (IS_PINEVIEW(i915))
> >> - i915->is_ddr3 = pnv_is_ddr3(i915);
> >> -
> >> - if (i915->mem_freq)
> >> - drm_dbg(&i915->drm, "DDR speed: %d kHz\n", i915->mem_freq);
> >> -}
> >> -
> >> static unsigned int i9xx_fsb_freq(struct drm_i915_private *i915)
> >> {
> >> u32 fsb;
> >> @@ -252,11 +241,20 @@ unsigned int intel_fsb_freq(struct drm_i915_private *i915)
> >> return 0;
> >> }
> >>
> >> -static void detect_fsb_freq(struct drm_i915_private *i915)
> >> +static int i915_get_dram_info(struct drm_i915_private *i915, struct dram_info *dram_info)
> >> {
> >> - i915->fsb_freq = intel_fsb_freq(i915);
> >> - if (i915->fsb_freq)
> >> - drm_dbg(&i915->drm, "FSB frequency: %d kHz\n", i915->fsb_freq);
> >> + dram_info->fsb_freq = intel_fsb_freq(i915);
> >> + if (dram_info->fsb_freq)
> >> + drm_dbg(&i915->drm, "FSB frequency: %d kHz\n", dram_info->fsb_freq);
> >> +
> >> + dram_info->mem_freq = intel_mem_freq(i915);
> >> + if (dram_info->mem_freq)
> >> + drm_dbg(&i915->drm, "DDR speed: %d kHz\n", dram_info->mem_freq);
> >> +
> >> + if (IS_PINEVIEW(i915) && pnv_is_ddr3(i915))
> >> + dram_info->type = INTEL_DRAM_DDR3;
> >> +
> >> + return 0;
> >> }
> >>
> >> static int intel_dimm_num_devices(const struct dram_dimm_info *dimm)
> >> @@ -728,12 +726,6 @@ int intel_dram_detect(struct drm_i915_private *i915)
> >> if (IS_DG2(i915) || !HAS_DISPLAY(i915))
> >> return 0;
> >>
> >> - detect_fsb_freq(i915);
> >> - detect_mem_freq(i915);
> >> -
> >> - if (GRAPHICS_VER(i915) < 9)
> >> - return 0;
> >
> > oh! this responds my last question in the previous patch...
>
> Yeah, I could've referred to later changes there!
>
> >
> >> -
> >> dram_info = drmm_kzalloc(&i915->drm, sizeof(*dram_info), GFP_KERNEL);
> >> if (!dram_info)
> >> return -ENOMEM;
> >> @@ -754,8 +746,10 @@ int intel_dram_detect(struct drm_i915_private *i915)
> >> ret = gen11_get_dram_info(i915, dram_info);
> >> else if (IS_BROXTON(i915) || IS_GEMINILAKE(i915))
> >> ret = bxt_get_dram_info(i915, dram_info);
> >> - else
> >> + else if (GRAPHICS_VER(i915) >= 9)
> >> ret = skl_get_dram_info(i915, dram_info);
> >> + else
> >> + ret = i915_get_dram_info(i915, dram_info);
> >>
> >> drm_dbg_kms(&i915->drm, "DRAM type: %s\n",
> >> intel_dram_type_str(dram_info->type));
> >> diff --git a/drivers/gpu/drm/i915/soc/intel_dram.h b/drivers/gpu/drm/i915/soc/intel_dram.h
> >> index 5ba75e279e84..97d21894abdc 100644
> >> --- a/drivers/gpu/drm/i915/soc/intel_dram.h
> >> +++ b/drivers/gpu/drm/i915/soc/intel_dram.h
> >> @@ -29,6 +29,8 @@ struct dram_info {
> >> } type;
> >> u8 num_qgv_points;
> >> u8 num_psf_gv_points;
> >> + unsigned int fsb_freq;
> >> + unsigned int mem_freq;
> >> };
> >>
> >> void intel_dram_edram_detect(struct drm_i915_private *i915);
> >> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> >> index 38c8329b4d2c..e2206e867b33 100644
> >> --- a/drivers/gpu/drm/xe/xe_device_types.h
> >> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> >> @@ -609,7 +609,6 @@ struct xe_device {
> >> struct {
> >> unsigned int hpll_freq;
> >> unsigned int czclk_freq;
> >> - unsigned int fsb_freq, mem_freq, is_ddr3;
> >> };
> >> #endif
> >> };
> >> --
> >> 2.39.5
> >>
>
> --
> Jani Nikula, Intel
next prev parent reply other threads:[~2025-08-15 15:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-31 14:21 [PATCH 0/5] drm/i915 and drm/xe: remove fsb/mem freq cleanups Jani Nikula
2025-07-31 14:21 ` [PATCH 1/5] drm/i915/dram: add intel_fsb_freq() and use it Jani Nikula
2025-08-05 22:17 ` Rodrigo Vivi
2025-07-31 14:21 ` [PATCH 2/5] drm/i915/dram: add intel_mem_freq() Jani Nikula
2025-08-05 22:18 ` Rodrigo Vivi
2025-07-31 14:21 ` [PATCH 3/5] drm/i915/rps: use intel_fsb_freq() and intel_mem_freq() Jani Nikula
2025-08-05 22:20 ` Rodrigo Vivi
2025-07-31 14:21 ` [PATCH 4/5] drm/i915/dram: bypass fsb/mem freq detection on dg2 and no display Jani Nikula
2025-08-05 22:24 ` Rodrigo Vivi
2025-08-06 13:52 ` Jani Nikula
2025-08-15 15:43 ` Rodrigo Vivi
2025-07-31 14:21 ` [PATCH 5/5] drm/i915/dram: move fsb_freq and mem_freq to dram info Jani Nikula
2025-08-05 22:28 ` Rodrigo Vivi
2025-08-06 13:57 ` Jani Nikula
2025-08-15 15:49 ` Rodrigo Vivi [this message]
2025-07-31 16:58 ` ✗ i915.CI.BAT: failure for drm/i915 and drm/xe: remove fsb/mem freq cleanups Patchwork
2025-07-31 18:26 ` ✓ CI.KUnit: success " Patchwork
2025-07-31 19:44 ` ✓ Xe.CI.BAT: " Patchwork
2025-07-31 21:01 ` ✗ Xe.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aJ9W9JYeLiXPmHYo@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.