From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Cédric Le Goater" <clg@redhat.com>,
"Jan Luebbe" <jlu@pengutronix.de>,
"Guenter Roeck" <linux@roeck-us.net>
Subject: [PULL 10/10] aspeed: Don't set always boot properties of the emmc device
Date: Mon, 4 Nov 2024 11:15:01 +0100 [thread overview]
Message-ID: <20241104101501.2487001-11-clg@redhat.com> (raw)
In-Reply-To: <20241104101501.2487001-1-clg@redhat.com>
Commit e554e45b4478 ("aspeed: Tune eMMC device properties to reflect
HW strapping") added support to boot from an eMMC device by setting
the boot properties of the eMMC device. This change made the
assumption that the device always has boot areas.
However, if the machine boots from the flash device (or -kernel) and
uses an eMMC device without boot areas, support would be broken. This
impacts the ast2600-evb machine which can choose to boot from flash or
eMMC using the "boot-emmc" machine option.
To provide some flexibility for Aspeed machine users to use different
flavors of eMMC devices (with or without boot areas), do not set the
eMMC device boot properties when the machine is not configured to boot
from eMMC. However, this approach makes another assumption about eMMC
devices, namely that eMMC devices from which the machine does not boot
do not have boot areas.
A preferable alternative would be to add support for user creatable
eMMC devices and define the device boot properties on the QEMU command
line :
-blockdev node-name=emmc0,driver=file,filename=mmc-ast2600-evb.raw \
-device emmc,bus=sdhci-bus.2,drive=emmc0,boot-partition-size=1048576,boot-config=8
This is a global change requiring more thinking. Nevertheless, in the
case of the ast2600-evb machine booting from an eMMC device and when
default devices are created, the proposed change still makes sense
since the device is required to have boot areas.
Cc: Jan Luebbe <jlu@pengutronix.de>
Fixes: e554e45b4478 ("aspeed: Tune eMMC device properties to reflect
HW strapping")
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jan Luebbe <jlu@pengutronix.de>
---
hw/arm/aspeed.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index e447923536b4..6ca145362cbd 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -338,10 +338,20 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
return;
}
card = qdev_new(emmc ? TYPE_EMMC : TYPE_SD_CARD);
- if (emmc) {
+
+ /*
+ * Force the boot properties of the eMMC device only when the
+ * machine is strapped to boot from eMMC. Without these
+ * settings, the machine would not boot.
+ *
+ * This also allows the machine to use an eMMC device without
+ * boot areas when booting from the flash device (or -kernel)
+ * Ideally, the device and its properties should be defined on
+ * the command line.
+ */
+ if (emmc && boot_emmc) {
qdev_prop_set_uint64(card, "boot-partition-size", 1 * MiB);
- qdev_prop_set_uint8(card, "boot-config",
- boot_emmc ? 0x1 << 3 : 0x0);
+ qdev_prop_set_uint8(card, "boot-config", 0x1 << 3);
}
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
--
2.47.0
next prev parent reply other threads:[~2024-11-04 10:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 10:14 [PULL 00/10] aspeed queue Cédric Le Goater
2024-11-04 10:14 ` [PULL 01/10] hw/arm: enable at24c with aspeed Cédric Le Goater
2024-11-04 10:14 ` [PULL 02/10] hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions Cédric Le Goater
2024-11-04 10:14 ` [PULL 03/10] hw/arm/aspeed_ast27x0: Use bsa.h for PPI definitions Cédric Le Goater
2024-11-04 10:14 ` [PULL 04/10] hw/arm/aspeed_ast27x0: Avoid hardcoded '256' in IRQ calculation Cédric Le Goater
2024-11-04 10:14 ` [PULL 05/10] aspeed/soc: Support RTC for AST2700 Cédric Le Goater
2024-11-04 10:14 ` [PULL 06/10] hw/timer/aspeed: Fix coding style Cédric Le Goater
2024-11-04 10:14 ` [PULL 07/10] hw/timer/aspeed: Fix interrupt status does not be cleared for AST2600 Cédric Le Goater
2024-11-04 10:14 ` [PULL 08/10] hw/sd/aspeed_sdhci: Introduce Capabilities Register 2 for SD slot 0 and 1 Cédric Le Goater
2024-11-04 10:15 ` [PULL 09/10] aspeed: Support create flash devices via command line for AST1030 Cédric Le Goater
2024-11-04 10:15 ` Cédric Le Goater [this message]
2024-11-04 10:38 ` [PULL 00/10] aspeed queue Cédric Le Goater
2024-11-05 14:22 ` Peter Maydell
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=20241104101501.2487001-11-clg@redhat.com \
--to=clg@redhat.com \
--cc=jlu@pengutronix.de \
--cc=linux@roeck-us.net \
--cc=qemu-arm@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).