From: Warner Losh <imp@bsdimp.com>
To: Tom Yan <tom.ty89@gmail.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
alistair.francis@wdc.com,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: Regarding commit a9bcedd (SD card size has to be power of 2)
Date: Mon, 7 Jun 2021 10:33:26 -0600 [thread overview]
Message-ID: <CANCZdfoxTXpm_5pbnLPUTCRhgJFH_1Pa2MjpsGDcoHf_Z-1AxQ@mail.gmail.com> (raw)
In-Reply-To: <CAGnHSEnpEpnNHtryR=gMTxcGUd0EGW5h5KQeJvkYHp1Fw844fA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1899 bytes --]
On Mon, Jun 7, 2021 at 2:31 AM Tom Yan <tom.ty89@gmail.com> wrote:
> Hi philmd (and others),
>
> So I just noticed your commit of requiring the size of an emulated SD
> card to be a power of 2, when I was trying to emulate one for an
> actual one (well, it's a microSD, but still), as it errored out.
>
> You claim that the kernel will consider it to be a firmware bug and
> "correct" the capacity by rounding it up. Could you provide a concrete
> reference to the code that does such a thing? I'm not ruling out that
> some crazy code could have gone upstream because some reviewers might
> not be doing their job right, but if that really happened, it's a
> kernel bug/regression and qemu should not do an equally-crazy thing to
> "fix" it.
>
> No offense but what you claimed really sounds absurd and ridiculous.
> Although I don't have hundreds of SD cards in hand, I owned quite a
> few at least, like most people do, with capacities ranging from ~2G to
> ~128G, and I don't even recall seeing a single one that has the
> capacity being a power of 2. (Just like vendors of HDDs and SSDs, they
> literally never do that AFAICT, for whatever reasons.)
>
> Besides, even if there's a proper reason for the kernel to "fix" the
> capacity, there's no reason for it to round it up either, because
> obviously there will never be actual storage for the "virtual blocks".
> I've never seen such a behavior so far either with the "mmcblk" hosts
> I've used so far.
>
Some data points: I have several 224GB SD cards. FreeBSD specifically uses
a size
just a little smaller than the rated size because so many capacity points
are a bit
smaller (1GB cards also tend to be only 1% larger 1E9 bytes, nowhere near a
power
of two). FreeBSD's kernel never adjusts the size of SD or MMC cards, and
there's
nothing in the Simplified SD standard nor in the various MMC standards
requiring a
power of two.
Warner
[-- Attachment #2: Type: text/html, Size: 2474 bytes --]
next prev parent reply other threads:[~2021-06-07 16:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 8:29 Regarding commit a9bcedd (SD card size has to be power of 2) Tom Yan
2021-06-07 16:33 ` Warner Losh [this message]
2021-06-23 9:28 ` Daniel P. Berrangé
2021-06-23 10:59 ` Philippe Mathieu-Daudé
2021-06-23 11:23 ` Michal Suchánek
2021-06-23 11:29 ` Daniel P. Berrangé
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=CANCZdfoxTXpm_5pbnLPUTCRhgJFH_1Pa2MjpsGDcoHf_Z-1AxQ@mail.gmail.com \
--to=imp@bsdimp.com \
--cc=alistair.francis@wdc.com \
--cc=f4bug@amsat.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=tom.ty89@gmail.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;
as well as URLs for NNTP newsgroup(s).