qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Lübbe" <jlu@pengutronix.de>
To: "Guenter Roeck" <linux@roeck-us.net>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	Thomas Huth <thuth@redhat.com>,
	 Peter Maydell <peter.maydell@linaro.org>,
	Joel Stanley <joel@jms.id.au>
Subject: Re: [PATCH 0/2] arm: Add collie and sx functional tests
Date: Fri, 25 Oct 2024 17:25:24 +0200	[thread overview]
Message-ID: <b67f302a11a679c3fdb02318eb9ef0be559d14ce.camel@pengutronix.de> (raw)
In-Reply-To: <84c32f2d-7d9a-4e5a-8b67-1f954dd493f6@roeck-us.net>

On Fri, 2024-10-25 at 06:59 -0700, Guenter Roeck wrote:
> On 10/25/24 02:57, Jan Lübbe wrote:
> > On Fri, 2024-10-25 at 08:55 +0200, Cédric Le Goater wrote:
> > > On 10/24/24 19:59, Philippe Mathieu-Daudé wrote:
> > > > Cc'ing Jan.
> > > > 
> > > > On 22/10/24 12:04, Guenter Roeck wrote:
> > > > 
> > > > > I have no idea how this is supposed to work, and I don't think it works
> > > > > as implemented. I'll revert commit e32ac563b83 in my local copy of qemu.
> > > > > Jan, can you have a look at this bug report please? Otherwise I'll
> > > > > have a look during soft freeze.
> > 
> > Guenter, just to make sure: In your case [1], you had "boot-emmc" (see
> > aspeed_machine_ast2600_class_emmc_init) enabled, right? Otherwise the
> 
> I tried both enabled and disabled.
> 
> > boot partition size would be 0, meaning that the eMMC has no boot
> > partitions.
> 
> That is what I would have expected, but it does not reflect reality.
> 
> > In that configuration, your backing file needs to have space for the
> > boot partitions at the start (2*1MiB) and the rootfs starts at the 2
> > MiB offset.
> > 
> 
> boot-emmc doesn't make a difference, because
> 
>          if (emmc) {
>              qdev_prop_set_uint64(card, "boot-partition-size", 1 * MiB);
>              qdev_prop_set_uint8(card, "boot-config",
>                                  boot_emmc ? 0x1 << 3 : 0x0);
>          }
> 
> in hw/arm/aspeed.c sets the boot partition size independently of the
> boot-emmc flag. 

Ah, yes. :/

So you can have SD, eMMC with boot from boot partition *disabled* or
eMMC with boot from boot partition *enabled*.

> I suspect that the expectation is that I always provide
> an emmc image with a 2 MB gap at the beginning, but in my opinion that is
> really hyper-clumsy, and I simply won't do it, sorry.

I was surprised that the boot partitions' contents are stored in the
same backing file as the main area (instead of being separate files).
But I've not researched why it was designed this way.

> I can work around
> the problem by changing the above code to only set boot-partition-size if
> boot_emmc is set, or I can revert commit e32ac563b83. For now I chose the
> latter.

With e32ac563b83 reverted, your backing file layout will change *at
runtime* depending on whether booting from the boot partition is
enabled via EXT CSD registers. You should be able to try that using
'mmc bootpart enable <boot_part> 0 /dev/mmcblk0' (with boot_part=0 for
disabled and boot_part=1/2 for enabled).


I'm not sure what the best way forward is... perhaps make the boot-
partition-size zero if boot_emmc is false? e.g.

@@ -339,7 +339,12 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
         }
         card = qdev_new(emmc ? TYPE_EMMC : TYPE_SD_CARD);
         if (emmc) {
-            qdev_prop_set_uint64(card, "boot-partition-size", 1 * MiB);
+            /*
+             * Avoid the requirement for a padded disk image if booting from
+             * eMMC boot partitions is not needed.
+             */
+            qdev_prop_set_uint64(card, "boot-partition-size",
+                                boot_emmc ? 1 * MiB : 0);
             qdev_prop_set_uint8(card, "boot-config",
                                 boot_emmc ? 0x1 << 3 : 0x0);
         }


Then you'd have the choice between:
- an eMMC, but without boot partitions (and simple backing file layout)
- an eMMC with boot partitions and need a backing file with 
  the boot partitions at the beginning

That might be the lesser evil. :)

Jan

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




  reply	other threads:[~2024-10-25 15:26 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 16:32 [PATCH 0/2] arm: Add collie and sx functional tests Peter Maydell
2024-10-17 16:32 ` [PATCH 1/2] tests/functional: Add a functional test for the collie board Peter Maydell
2024-10-17 17:15   ` Thomas Huth
2024-10-22  4:11   ` Philippe Mathieu-Daudé
2024-10-22  7:09     ` Daniel P. Berrangé
2024-10-22  9:02       ` Peter Maydell
2024-10-22 21:45         ` Philippe Mathieu-Daudé
2024-10-17 16:32 ` [PATCH 2/2] tests/functional: Add a functional test for the sx1 board Peter Maydell
2024-10-17 17:18   ` Thomas Huth
2024-10-21  7:15 ` [PATCH 0/2] arm: Add collie and sx functional tests Thomas Huth
2024-10-21  8:01   ` Thomas Huth
2024-10-21  9:17     ` Peter Maydell
2024-10-21  9:40       ` Thomas Huth
2024-10-21 14:02       ` Guenter Roeck
2024-10-22  4:09         ` Philippe Mathieu-Daudé
2024-10-22  5:24           ` Guenter Roeck
2024-10-22 15:04           ` Guenter Roeck
2024-10-24 17:59             ` Philippe Mathieu-Daudé
2024-10-25  6:55               ` Cédric Le Goater
2024-10-25  9:57                 ` Jan Lübbe
2024-10-25 13:59                   ` Guenter Roeck
2024-10-25 15:25                     ` Jan Lübbe [this message]
2024-10-25 17:05                       ` Guenter Roeck
2024-10-26  4:47                       ` Philippe Mathieu-Daudé
2024-10-26  5:54                         ` Guenter Roeck
2024-10-26 10:02                           ` Cédric Le Goater
2024-10-26 15:32                             ` Guenter Roeck
2024-10-27 21:13                               ` Cédric Le Goater
2024-10-27 22:11                                 ` Guenter Roeck
2024-10-27 22:26                                   ` Cédric Le Goater
2024-10-28  3:32                                     ` Guenter Roeck
2024-10-28  8:41                                       ` Jan Lübbe
2024-10-29 14:40                                         ` Guenter Roeck
2024-11-01 14:14                                           ` backing storage for eMMC boot partitions Jan Lübbe
2024-11-18  9:14                                             ` Cédric Le Goater
2024-11-18 12:15                                               ` Jan Lübbe
2024-11-18 12:36                                                 ` Cédric Le Goater
2024-10-28 16:23                             ` [PATCH] hw/sd/sdcard: Fix calculation of size when using " Jan Luebbe
2024-10-29  8:31                               ` Cédric Le Goater
2024-11-02 15:06                               ` Cédric Le Goater
2024-11-04 10:33                                 ` Philippe Mathieu-Daudé
2024-11-05 16:13                               ` Michael Tokarev
2024-11-05 16:31                                 ` Cédric Le Goater

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=b67f302a11a679c3fdb02318eb9ef0be559d14ce.camel@pengutronix.de \
    --to=jlu@pengutronix.de \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=linux@roeck-us.net \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.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).