Received: by 2002:a17:505:a60a:b0:1be9:327d:8ee3 with SMTP id qv10csp2453256njc; Mon, 18 Nov 2024 01:15:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWkm9bSqq2ObsbAbmtU5kDDjHboHElG65oAx/uYy449s77eBgtkHsCI+pcyXDgJc/x/OebkcdkBTNEF7A==@linaro.org X-Google-Smtp-Source: AGHT+IFB82taDZdkazaWA8qRzG3EAxlgbbTM8JVJdxc3sonUpIXAcERewNxEqVMUuxdSqSyq9z4I X-Received: by 2002:a05:6214:5687:b0:6ce:3af7:3593 with SMTP id 6a1803df08f44-6d3fb847018mr141426996d6.29.1731921329588; Mon, 18 Nov 2024 01:15:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731921329; cv=none; d=google.com; s=arc-20240605; b=LPDhrw4aT6gLwODx/LqVh7raHbUpFRoEmQScjBvsVSBNmTPE+ESvB4SOIekoX4Epy8 0GmJgBbcr7A5QUnNDlfhfG8MluWq//WeYcfsJlrjWgNd0mGlzmexqPSaTbAuBHQ+lGg3 XOYs5PhRZuBMvDbhK/HLSefaqMJyq9lq61D/93xJtbmBN8j8DMMr6gKLqStGMCPKTIV8 7hQlyfRTnGENjKaehdE3pJcE5JB54Y9IG3IVk9KzePd3i9YbWrs7wNmPUeKOws+PsR1T xThA/N/MgHvTnZjhTr8oHjGlNTISealruj1HmHQuwuxezJ1OL1bpfVfsrJj7HyW3daUj 1ipQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :in-reply-to:autocrypt:content-language:references:cc:to:subject :from:user-agent:mime-version:date:message-id; bh=IB2Ld8QsxBQ0nYZXw2Tx7QdgiAhW5HvU7BVF90kei6U=; fh=TURViqy3K1XvuNZe84OqoeD7o7EPiMW5S65v9dvDmlk=; b=Eu01boOCyBjo9MZn4hcsguDM9XCIyKh2+Ux3dTdbKygUQuZowaq0rrCFZ9BBPemZey lRayQHds62q++uwEJRC2I3ZKmhwDYsp5cOCheqhiMpzYpyppIDEI1VszenBn81Ml4Ixg GMs99/9pkvhvuDGyeo7aiwVhfs6xxPXSycWxfBLbQfg2gcDcyEY9y5cUGAufa3VYyGpE tiTIowGtB1+VVGsAsd9s3glbKD59aARoGP3T0/rPYSyGJ29qhehnIOpDB7IpA7Gum62X 7Umyq07xeAThaRbMLX2LaMIP61t+UGjaQ7E65AtfPrvjIoLzkzf+qZBCp2/AfmWJQ124 3eCQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d40ddbe749si58496776d6.562.2024.11.18.01.15.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 01:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCxqo-0002jg-CJ; Mon, 18 Nov 2024 04:15:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCxqD-0002fC-7U; Mon, 18 Nov 2024 04:14:41 -0500 Received: from mail.ozlabs.org ([2404:9400:2221:ea00::3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCxq9-0000cE-NF; Mon, 18 Nov 2024 04:14:40 -0500 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4XsMQ10p99z4xg6; Mon, 18 Nov 2024 20:14:17 +1100 (AEDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.ozlabs.org (Postfix) with ESMTPSA id 4XsMPx2wsRz4xfs; Mon, 18 Nov 2024 20:14:13 +1100 (AEDT) Message-ID: <7c8658ef-e61b-4a46-91cf-6dc26e78158c@kaod.org> Date: Mon, 18 Nov 2024 10:14:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: =?UTF-8?Q?C=C3=A9dric_Le_Goater?= Subject: Re: backing storage for eMMC boot partitions To: =?UTF-8?Q?Jan_L=C3=BCbbe?= , Guenter Roeck , =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, Thomas Huth , Joel Stanley , qemu-block References: <20241017163247.711244-1-peter.maydell@linaro.org> <5262a33d-d0c5-452b-9869-f8f482b1c857@linaro.org> <07664ec3-6b46-4b27-9d8c-9e2ff34c9dbe@kaod.org> <600baa43c3dd3547338934717cfb57c5e12b0d23.camel@pengutronix.de> <84c32f2d-7d9a-4e5a-8b67-1f954dd493f6@roeck-us.net> <53cbb597-e7f2-4742-bf85-928c704ddbcf@linaro.org> <443f1b0c-8184-4bf4-9f68-c23d7de3bc36@roeck-us.net> <1bce4c22-9281-44c5-8acb-860881dc271c@kaod.org> <86fa6e68-5861-4d4d-941f-95b278074eb6@kaod.org> <1c917e4a-de50-45b9-ac9c-eb04d51401a2@roeck-us.net> <00997cca-6f4a-4b99-9616-2af6a25cd4fb@kaod.org> <4246f82b-597c-4a5d-9a55-18a584e7d8c7@roeck-us.net> <670fa7bf052d8f292f9bd25c330c8d7bdba02770.camel@pengutronix.de> <9046a4327336d4425f1e7e7a973edef9e9948e80.camel@pengutronix.de> Content-Language: en-US, fr Autocrypt: addr=clg@kaod.org; keydata= xsFNBFu8o3UBEADP+oJVJaWm5vzZa/iLgpBAuzxSmNYhURZH+guITvSySk30YWfLYGBWQgeo 8NzNXBY3cH7JX3/a0jzmhDc0U61qFxVgrPqs1PQOjp7yRSFuDAnjtRqNvWkvlnRWLFq4+U5t yzYe4SFMjFb6Oc0xkQmaK2flmiJNnnxPttYwKBPd98WfXMmjwAv7QfwW+OL3VlTPADgzkcqj 53bfZ4VblAQrq6Ctbtu7JuUGAxSIL3XqeQlAwwLTfFGrmpY7MroE7n9Rl+hy/kuIrb/TO8n0 ZxYXvvhT7OmRKvbYuc5Jze6o7op/bJHlufY+AquYQ4dPxjPPVUT/DLiUYJ3oVBWFYNbzfOrV RxEwNuRbycttMiZWxgflsQoHF06q/2l4ttS3zsV4TDZudMq0TbCH/uJFPFsbHUN91qwwaN/+ gy1j7o6aWMz+Ib3O9dK2M/j/O/Ube95mdCqN4N/uSnDlca3YDEWrV9jO1mUS/ndOkjxa34ia 70FjwiSQAsyIwqbRO3CGmiOJqDa9qNvd2TJgAaS2WCw/TlBALjVQ7AyoPEoBPj31K74Wc4GS Rm+FSch32ei61yFu6ACdZ12i5Edt+To+hkElzjt6db/UgRUeKfzlMB7PodK7o8NBD8outJGS tsL2GRX24QvvBuusJdMiLGpNz3uqyqwzC5w0Fd34E6G94806fwARAQABzSBDw6lkcmljIExl IEdvYXRlciA8Y2xnQGthb2Qub3JnPsLBeAQTAQIAIgUCW7yjdQIbAwYLCQgHAwIGFQgCCQoL BBYCAwECHgECF4AACgkQUaNDx8/77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948e80.camel@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2404:9400:2221:ea00::3; envelope-from=SRS0=CkxU=SN=kaod.org=clg@ozlabs.org; helo=mail.ozlabs.org X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: W6MWvQPjidnK Hello, [ ... ] >> also boots from the emmc controller. How do I provide the >> bus and bus index ? "bus=sdhci-bus.2" doesn't work for me. >> There is "sd-bus", but it does not have an index. Yes. Changes are required in the sdhci model and in the boards using it. > I've not really understood how to assemble more complex setups using > qemu's commandline when the board already creates some of the devices. Yes. That's a "problem" to fix for emmc/sd devices. They should only be created when defaults_enabled(), just like the flash devices. > Perhaps Cédric can explain how the different boot options are > configured for aspeed? See https://qemu.readthedocs.io/en/v9.1.0/system/arm/aspeed.html#boot-options and the avocado/functional tests for examples. The eMMC case is missing from the docs. Here is a proposal : https://lore.kernel.org/qemu-devel/20241118090648.187720-1-clg@redhat.com/ Thanks, C. > > I see three cases: > 1. specify the blockdev driver and options in the simple case where the > board already creates the SD or eMMC device > 2. specify some custom options for the eMMC > 3. create a custom eMMC config on a generic machine via sdhci-pci > > > Case 1 is probably most common. The user has chosen a board and just > wants to boot a rootfs image and doesn't care about boot partitions or > anything else eMMC-specific. > > > Some users may want to emulate an eMMC with boot partitions, as that > allows them to emulate their physical boards more closely (case 2). > Note that eMMC boot partitions are usually *not* used for storing a > Linux kernel, but for the bootloader (including things like u-boot, TF- > A, OP-TEE, ...). The ROM-code on many SoCs supports loading directly > from eMMC boot partitions. One of the two boot partitions can be > activated with an atomic eMMC EXT CSD register write, allowing atomic > bootloader updates. I think this case was the motivation for Cédric's > eea55625df83 ("aspeed: Introduce a AspeedSoCClass 'boot_from_emmc' > handler"). > > > These users are likely fine with assembling a backing file consisting > of e.g. > - bootloader image (boot0) @ offset 0MiB > - empty space for bootloader updates (boot1) @ offset 1MiB > - partitioned disk image (rootfs, ...) @ offset 2MiB > to get the same setup as their real hardware. > > > Case 3 is what I want to use the eMMC emulator for: Test eMMC-specific > functionality in Linux userspace, specifically the boot partition > update backend for RAUC, in a CI setup. To improve performance and > because we don't need to emulate any specific board for CI, we use an > x86 guest (q35). As it has PCIe, the easiest way to add the necessary > eMMC emulation is to use sdhci-pci. That was the motivation behind my > patch "hw/sd/sdcard: Allow user creation of eMMCs" [1]. > > For that case, having one backing file for boot partitions + main area > is fine as well. > > > If we wanted more flexibility via separate backing files per eMMC > partitions, it might work similar to NVMe Namespaces [2]. For me, that > seems like a lot of complexity a very niche case like eMMC boot > partitions. > > > Potential future features such as more eMMC data partitions, RPMB > support or separate backing files could be support in QEMU by new eMCC > device options or even additional devices (following the NVMe > approach), without breaking backwards compatibility. > > So it seems to me, that Cédric's approach of enabling boot partitions > in hw/arm/aspeed.c only when configured to boot from them via the "hw- > strap1" property should solve cases 1 and 2 without introducing > backwards compatibility issues. Case 3 has explicit configuration (if a > boot partition is emulated), so shouldn't be a problem either. > > > Thanks, > Jan > > [1] https://lore.kernel.org/qemu-devel/20241015135649.4189256-1-jlu@pengutronix.de/T/ > [2] https://qemu-project.gitlab.io/qemu/system/devices/nvme.html#additional-namespaces >