linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mmc-utils mmc tool reports incorrect cache size
@ 2020-02-12 21:34 Patrick Oppenlander
  2020-02-13  7:35 ` Avri Altman
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Oppenlander @ 2020-02-12 21:34 UTC (permalink / raw)
  To: linux-mmc

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

Hi,

I recently noticed that 'mmc' reports cache size incorrectly. The unit
in the extended CSD is kilobits rather than kilobytes, so for a
display unit of 'KiB' it needs to be scaled appropriately.
Alternatively the unit could change to Kibit, but I think that's less
helpful.

I've attached a patch which fixes the issue & includes references to
the relevant parts of the JEDEC standard.

Hope someone finds this helpful,

Patrick

[-- Attachment #2: 0001-Scale-ext_csd-cache-size-from-kilobits-to-kilobytes.patch --]
[-- Type: text/x-patch, Size: 1133 bytes --]

From fd741374278ec64bb0c26780d043fab0d7bcf40e Mon Sep 17 00:00:00 2001
From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Date: Mon, 4 Nov 2019 13:51:12 +1100
Subject: [PATCH] Scale ext_csd cache size from kilobits to kilobytes

JESD84-B51 7.4.30 CACHE_SIZE [252:249] states that "the size is
indicated as multiple of kilobits". This is also supported by Table 39,
"e.MMC internal sizes and related Units / Granularities" which lists
"32Kb (=4KB)" as the cache size granularity for 4KiB native devices.
---
 mmc_cmds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mmc_cmds.c b/mmc_cmds.c
index fb37189..a1b1d75 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -1419,8 +1419,8 @@ int do_read_extcsd(int nargs, char **argv)
 		printf("Power off notification [POWER_OFF_LONG_TIME: 0x%02x]\n",
 			ext_csd[247]);
 		printf("Cache Size [CACHE_SIZE] is %d KiB\n",
-			ext_csd[249] << 0 | (ext_csd[250] << 8) |
-			(ext_csd[251] << 16) | (ext_csd[252] << 24));
+			(ext_csd[249] << 0 | (ext_csd[250] << 8) |
+			(ext_csd[251] << 16) | (ext_csd[252] << 24)) / 8);
 	}
 
 	/* A441: Reserved [501:247]
-- 
2.23.0


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

* RE: mmc-utils mmc tool reports incorrect cache size
  2020-02-12 21:34 mmc-utils mmc tool reports incorrect cache size Patrick Oppenlander
@ 2020-02-13  7:35 ` Avri Altman
  2020-02-13 22:14   ` Patrick Oppenlander
  0 siblings, 1 reply; 3+ messages in thread
From: Avri Altman @ 2020-02-13  7:35 UTC (permalink / raw)
  To: Patrick Oppenlander, linux-mmc

Patrick hi,
Yes, it is helpful, but you need to submit your patch in a way it can be reviewed.
Maybe you can look in https://www.kernel.org/doc/html/v5.5/process/5.Posting.html?highlight=submit%20patches#
For more info.

Thanks,
Avri

> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org <linux-mmc-
> owner@vger.kernel.org> On Behalf Of Patrick Oppenlander
> Sent: Wednesday, February 12, 2020 11:35 PM
> To: linux-mmc@vger.kernel.org
> Subject: mmc-utils mmc tool reports incorrect cache size
> 
> CAUTION: This email originated from outside of Western Digital. Do not click
> on links or open attachments unless you recognize the sender and know that
> the content is safe.
> 
> 
> Hi,
> 
> I recently noticed that 'mmc' reports cache size incorrectly. The unit
> in the extended CSD is kilobits rather than kilobytes, so for a
> display unit of 'KiB' it needs to be scaled appropriately.
> Alternatively the unit could change to Kibit, but I think that's less
> helpful.
> 
> I've attached a patch which fixes the issue & includes references to
> the relevant parts of the JEDEC standard.
> 
> Hope someone finds this helpful,
> 
> Patrick

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

* Re: mmc-utils mmc tool reports incorrect cache size
  2020-02-13  7:35 ` Avri Altman
@ 2020-02-13 22:14   ` Patrick Oppenlander
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Oppenlander @ 2020-02-13 22:14 UTC (permalink / raw)
  To: Avri Altman; +Cc: linux-mmc

Hi Avri,

I have resent the patch. Hopefully it looks better now.

Thanks for the reference,

Patrick

On Thu, Feb 13, 2020 at 6:35 PM Avri Altman <Avri.Altman@wdc.com> wrote:
>
> Patrick hi,
> Yes, it is helpful, but you need to submit your patch in a way it can be reviewed.
> Maybe you can look in https://www.kernel.org/doc/html/v5.5/process/5.Posting.html?highlight=submit%20patches#
> For more info.
>
> Thanks,
> Avri
>
> > -----Original Message-----
> > From: linux-mmc-owner@vger.kernel.org <linux-mmc-
> > owner@vger.kernel.org> On Behalf Of Patrick Oppenlander
> > Sent: Wednesday, February 12, 2020 11:35 PM
> > To: linux-mmc@vger.kernel.org
> > Subject: mmc-utils mmc tool reports incorrect cache size
> >
> > CAUTION: This email originated from outside of Western Digital. Do not click
> > on links or open attachments unless you recognize the sender and know that
> > the content is safe.
> >
> >
> > Hi,
> >
> > I recently noticed that 'mmc' reports cache size incorrectly. The unit
> > in the extended CSD is kilobits rather than kilobytes, so for a
> > display unit of 'KiB' it needs to be scaled appropriately.
> > Alternatively the unit could change to Kibit, but I think that's less
> > helpful.
> >
> > I've attached a patch which fixes the issue & includes references to
> > the relevant parts of the JEDEC standard.
> >
> > Hope someone finds this helpful,
> >
> > Patrick

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

end of thread, other threads:[~2020-02-13 22:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 21:34 mmc-utils mmc tool reports incorrect cache size Patrick Oppenlander
2020-02-13  7:35 ` Avri Altman
2020-02-13 22:14   ` Patrick Oppenlander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).