From: "Souza, Jose" <jose.souza@intel.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Read DIMM size in Gb rather than GB
Date: Wed, 30 Sep 2020 00:29:04 +0000 [thread overview]
Message-ID: <02a5b91b31675181820e8455bb9dd137da33a0a1.camel@intel.com> (raw)
In-Reply-To: <20200929131312.12999-1-ville.syrjala@linux.intel.com>
On Tue, 2020-09-29 at 16:13 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <
> ville.syrjala@linux.intel.com
> >
>
> CNL+ can report DIMM sizes in .5 GB units. In order to not trauncate
> away the .5 GB let's switch to storing the DIMM size in Gb units.
>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
> Cc: Swati Sharma <
> swati2.sharma@intel.com
> >
> Signed-off-by: Ville Syrjälä <
> ville.syrjala@linux.intel.com
> >
> ---
> drivers/gpu/drm/i915/intel_dram.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dram.c b/drivers/gpu/drm/i915/intel_dram.c
> index 8aa12cad93ce..4754296a250e 100644
> --- a/drivers/gpu/drm/i915/intel_dram.c
> +++ b/drivers/gpu/drm/i915/intel_dram.c
> @@ -7,7 +7,8 @@
> #include "intel_dram.h"
>
> struct dram_dimm_info {
> - u8 size, width, ranks;
> + u16 size;
> + u8 width, ranks;
> };
>
> struct dram_channel_info {
> @@ -41,10 +42,10 @@ static int intel_dimm_num_devices(const struct dram_dimm_info *dimm)
> return dimm->ranks * 64 / (dimm->width ?: 1);
> }
>
> -/* Returns total GB for the whole DIMM */
> +/* Returns total Gb for the whole DIMM */
> static int skl_get_dimm_size(u16 val)
> {
> - return val & SKL_DRAM_SIZE_MASK;
> + return (val & SKL_DRAM_SIZE_MASK) * 8;
> }
>
> static int skl_get_dimm_width(u16 val)
> @@ -74,10 +75,10 @@ static int skl_get_dimm_ranks(u16 val)
> return val + 1;
> }
>
> -/* Returns total GB for the whole DIMM */
> +/* Returns total Gb for the whole DIMM */
> static int cnl_get_dimm_size(u16 val)
> {
> - return (val & CNL_DRAM_SIZE_MASK) / 2;
> + return (val & CNL_DRAM_SIZE_MASK) * 8 / 2;
> }
>
> static int cnl_get_dimm_width(u16 val)
> @@ -110,8 +111,8 @@ static int cnl_get_dimm_ranks(u16 val)
> static bool
> skl_is_16gb_dimm(const struct dram_dimm_info *dimm)
> {
> - /* Convert total GB to Gb per DRAM device */
> - return 8 * dimm->size / (intel_dimm_num_devices(dimm) ?: 1) == 16;
> + /* Convert total Gb to Gb per DRAM device */
> + return dimm->size / (intel_dimm_num_devices(dimm) ?: 1) == 16;
> }
>
> static void
> @@ -130,7 +131,7 @@ skl_dram_get_dimm_info(struct drm_i915_private *i915,
> }
>
> drm_dbg_kms(&i915->drm,
> - "CH%u DIMM %c size: %u GB, width: X%u, ranks: %u, 16Gb DIMMs: %s\n",
> + "CH%u DIMM %c size: %u Gb, width: X%u, ranks: %u, 16Gb DIMMs: %s\n",
> channel, dimm_name, dimm->size, dimm->width, dimm->ranks,
> yesno(skl_is_16gb_dimm(dimm)));
> }
> @@ -354,9 +355,9 @@ static void bxt_get_dimm_info(struct dram_dimm_info *dimm, u32 val)
>
> /*
> * Size in register is Gb per DRAM device. Convert to total
> - * GB to match the way we report this for non-LP platforms.
> + * Gb to match the way we report this for non-LP platforms.
> */
> - dimm->size = bxt_get_dimm_size(val) * intel_dimm_num_devices(dimm) / 8;
> + dimm->size = bxt_get_dimm_size(val) * intel_dimm_num_devices(dimm);
> }
>
> static int bxt_get_dram_info(struct drm_i915_private *i915)
> @@ -404,7 +405,7 @@ static int bxt_get_dram_info(struct drm_i915_private *i915)
> dram_info->type != type);
>
> drm_dbg_kms(&i915->drm,
> - "CH%u DIMM size: %u GB, width: X%u, ranks: %u, type: %s\n",
> + "CH%u DIMM size: %u Gb, width: X%u, ranks: %u, type: %s\n",
> i - BXT_D_CR_DRP0_DUNIT_START,
> dimm.size, dimm.width, dimm.ranks,
> intel_dram_type_str(type));
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-09-30 0:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 13:13 [Intel-gfx] [PATCH] drm/i915: Read DIMM size in Gb rather than GB Ville Syrjala
2020-09-29 19:07 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-09-30 0:29 ` Souza, Jose [this message]
2020-09-30 11:24 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-09-30 20:29 ` Souza, Jose
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=02a5b91b31675181820e8455bb9dd137da33a0a1.camel@intel.com \
--to=jose.souza@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox