qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Lübbe" <jlu@pengutronix.de>
To: "Jan Kiszka" <jan.kiszka@siemens.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Cédric Le Goater" <clg@kaod.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Joel Stanley" <joel@jms.id.au>
Cc: Bin Meng <bmeng.cn@gmail.com>,
	qemu-block@nongnu.org,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	Alistair Francis <alistair@alistair23.me>,
	Alexander Bulekov <alxndr@bu.edu>
Subject: Re: [PATCH v2 1/8] hw/sd/sdcard: Fix size check for backing block image
Date: Tue, 02 Sep 2025 18:47:59 +0200	[thread overview]
Message-ID: <a1463f9e36d8b3e6289859bec9a0a5a758709316.camel@pengutronix.de> (raw)
In-Reply-To: <21b6726a-1ceb-4782-a219-36f32cebb774@siemens.com>

On Tue, 2025-09-02 at 18:39 +0200, Jan Kiszka wrote:
> > > I expect us to be safe and able to deal with non-pow2 regions if we use
> > > QEMUSGList from the "system/dma.h" API. But this is a rework nobody had
> > > time to do so far.
> > 
> > We have to tell two things apart: partitions sizes on the one side and
> > backing storage sizes. The partitions sizes are (to my reading) clearly
> > defined in the spec, and the user partition (alone!) has to be power of
> > 2. The boot and RPMB partitions are multiples of 128K. The sum of them
> > all is nowhere limited to power of 2 or even only multiples of 128K.
> > 
> 
> Re-reading the part of the device capacity, the rules are more complex:
>  - power of two up to 2 GB
>  - multiple of 512 bytes beyond that
> 
> So that power-of-two enforcement was and still is likely too strict.
>
> But I still see no indication, neither in the existing eMMC code of QEMU
> nor the spec, that the boot and RPMB partition sizes are included in that.

Correct. Non-power-of-two sizes are very common for real eMMCs. Taking a random
one from our lab:
[    1.220588] mmcblk1: mmc1:0001 S0J56X 14.8 GiB
[    1.228055]  mmcblk1: p1 p2 p3 p4
[    1.230375] mmcblk1boot0: mmc1:0001 S0J56X 31.5 MiB
[    1.233651] mmcblk1boot1: mmc1:0001 S0J56X 31.5 MiB
[    1.236682] mmcblk1rpmb: mmc1:0001 S0J56X 4.00 MiB, chardev (244:0)

For eMMCs using MLC NAND, you can also configure part of the user data area to
be pSLC (pseudo single level cell), which changes the available capacity (after
a required power cycle).

Regards,
Jan


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


  reply	other threads:[~2025-09-02 16:49 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  5:56 [PATCH v2 0/8] sd: Add RPMB emulation to eMMC model Jan Kiszka
2025-09-01  5:56 ` [PATCH v2 1/8] hw/sd/sdcard: Fix size check for backing block image Jan Kiszka
2025-09-02 15:06   ` Philippe Mathieu-Daudé
2025-09-02 15:34     ` Jan Kiszka
2025-09-02 15:43       ` Philippe Mathieu-Daudé
2025-09-02 15:45         ` Philippe Mathieu-Daudé
2025-09-02 15:47           ` Cédric Le Goater
2025-09-02 15:55             ` Philippe Mathieu-Daudé
2025-09-02 16:00               ` Cédric Le Goater
2025-09-02 16:14                 ` Philippe Mathieu-Daudé
2025-09-02 16:19                   ` Cédric Le Goater
2025-09-02 16:20                   ` Philippe Mathieu-Daudé
2025-09-02 16:24                     ` Jan Kiszka
2025-09-02 16:39                       ` Jan Kiszka
2025-09-02 16:47                         ` Jan Lübbe [this message]
2025-09-02 16:52                           ` Jan Kiszka
2025-09-02 17:07                           ` Warner Losh
2025-09-02 17:18                             ` Jan Kiszka
2025-09-02 17:22                               ` Warner Losh
2025-09-02 17:30                                 ` Warner Losh
2025-09-02 17:37                                   ` Jan Kiszka
2025-09-02 17:48                                     ` Warner Losh
2025-09-02 17:53                                       ` Jan Kiszka
2025-09-02 17:55                                         ` Warner Losh
2025-09-02 17:59                                         ` Philippe Mathieu-Daudé
2025-09-02 18:07                                           ` Warner Losh
2025-09-02 17:20                         ` Warner Losh
2025-09-02 17:39                           ` Jan Kiszka
2025-09-02 17:53                             ` Warner Losh
2025-09-02 15:43       ` Cédric Le Goater
2025-09-02 15:47         ` Philippe Mathieu-Daudé
2025-09-02 15:59       ` Cédric Le Goater
2025-09-01  5:56 ` [PATCH v2 2/8] hw/sd/sdcard: Add validation for boot-partition-size Jan Kiszka
2025-09-01 17:19   ` Alex Bennée
2025-09-01  5:56 ` [PATCH v2 3/8] hw/sd/sdcard: Allow user-instantiated eMMC Jan Kiszka
2025-09-01  5:56 ` [PATCH v2 4/8] hw/sd/sdcard: Refactor sd_bootpart_offset Jan Kiszka
2025-09-01  5:56 ` [PATCH v2 5/8] hw/sd/sdcard: Add basic support for RPMB partition Jan Kiszka
2025-09-01  5:56 ` [PATCH v2 6/8] crypto/hmac: Allow to build hmac over multiple qcrypto_gnutls_hmac_bytes[v] calls Jan Kiszka
2025-09-01  8:55   ` Daniel P. Berrangé
2025-09-01  5:56 ` [PATCH v2 7/8] hw/sd/sdcard: Handle RPMB MAC field Jan Kiszka
2025-09-01  5:56 ` [PATCH v2 8/8] scripts: Add helper script to generate eMMC block device images Jan Kiszka
2025-09-01 17:24   ` Alex Bennée
2025-09-01 20:58 ` [PATCH v2 0/8] sd: Add RPMB emulation to eMMC model Philippe Mathieu-Daudé
2025-09-02 11:42   ` Jan Kiszka
2025-09-02 13:28     ` Philippe Mathieu-Daudé

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=a1463f9e36d8b3e6289859bec9a0a5a758709316.camel@pengutronix.de \
    --to=jlu@pengutronix.de \
    --cc=alistair@alistair23.me \
    --cc=alxndr@bu.edu \
    --cc=bmeng.cn@gmail.com \
    --cc=clg@kaod.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jan.kiszka@siemens.com \
    --cc=joel@jms.id.au \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).