Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1ABAC4332F for ; Wed, 14 Dec 2022 02:01:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EE25A85098; Wed, 14 Dec 2022 03:01:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nVzYs8wu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B1F64850D4; Wed, 14 Dec 2022 03:01:19 +0100 (CET) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8D89285061 for ; Wed, 14 Dec 2022 03:01:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x82b.google.com with SMTP id fu10so1544502qtb.0 for ; Tue, 13 Dec 2022 18:01:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=c6Kjzgi9CAHBrx+BPq9yutg9VJPXBH5Zkd4dtf19Ff0=; b=nVzYs8wuJXEhH0pV5MY0zBVb8RX9rl3uc687K3s6egOOOKaGETELnSg8BhPwSCCSDi XscskT/rtfmcx5RE0sVMvmU4xKk8HtNfGBHP+FJN4RQnjlEaArUFxblmbB38KwQgNVEk ugjPieUI2FAErD3fIczkgrAlB+8g/SgZ3N/wu66qE9kM+4vQNst+WE22tSfGat4hyOQ4 5DeJrHLWFssbQGQ5gBs6hfspA8bdLr65jGjDcgkd+zBPKBLU6Eeme7ekorqmaZchCnpP 9sJsR+EJ0P96laeaLeC7kl2rE5ohSmrahjwNPoJI+FC2DhZRlyB6Xligl6BYPqjisZfR bPxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c6Kjzgi9CAHBrx+BPq9yutg9VJPXBH5Zkd4dtf19Ff0=; b=aCAEvGLUyXYhm8ijKLB59W2c9su0mmyw+OzVOusE+3mMz0JAx5YqHisVtHrq7xNFM+ djoj0y2GuLhfZRQ5rK3WSltBTPeo7353Rb0A4aaxv7dYb2Tj/l4Qq3yLvJ6Z2FLQmrU+ 06izkvynARGmUU0nyiIEdFA9d0jqssnvpgiU5dm7OQGM4BzI4B0JXnmgrWFyjoqp1jH3 TVS0g7K9JPJMGXyGFHiHmzJbBFgTqANn6dCkczuO8fcpVijVQeANgOBA6UJXe3MsvmrK SzAkvPwRWbY/StPGY8Lqpo3ZypRXKKfSnpGtI9HuOnUmMfck9PW/LBuYzgglHtTObEZa C2aw== X-Gm-Message-State: ANoB5pkI1T/29fkQNvHQ0oL3gvaNUaUM+QbAWjgm8ylf72brxJ/mVZrb wNCr/RhEiI5IdbJwDzAM+1Y= X-Google-Smtp-Source: AA0mqf5RJ1q6FZsFSY5QsEePICGd91Eon49BzlQ33DCK7EJRu8FxX6k0bdgrv1XCPJpkupXZp7S0bQ== X-Received: by 2002:ac8:44ab:0:b0:3a5:f932:f167 with SMTP id a11-20020ac844ab000000b003a5f932f167mr32248942qto.52.1670983274335; Tue, 13 Dec 2022 18:01:14 -0800 (PST) Received: from [192.168.1.201] (pool-173-73-95-180.washdc.fios.verizon.net. [173.73.95.180]) by smtp.gmail.com with ESMTPSA id l2-20020ac81482000000b003a50c9993e1sm891139qtj.16.2022.12.13.18.01.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Dec 2022 18:01:13 -0800 (PST) Message-ID: <2806e0d0-b434-08bd-0ee6-cc3e4fd704c4@gmail.com> Date: Tue, 13 Dec 2022 21:01:13 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 1/4] riscv: spl: Introduce SPL_OPENSBI_OS_BOOT Content-Language: en-US To: Tom Rini , Rick Chen Cc: Rick Chen , ycliang@andestech.com, u-boot@lists.denx.de, sjg@chromium.org, xypron.glpk@gmx.de References: <20221207062334.21292-1-rick@andestech.com> <1162c5df-dcfc-0908-1d07-32145e3a6aaa@gmail.com> <20221209220723.GS3787616@bill-the-cat> <20221212150315.GS3787616@bill-the-cat> <20221213162452.GX3787616@bill-the-cat> From: Sean Anderson In-Reply-To: <20221213162452.GX3787616@bill-the-cat> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 12/13/22 11:24, Tom Rini wrote: > On Tue, Dec 13, 2022 at 08:42:47AM +0800, Rick Chen wrote: >> Hi Sean, >> >>> On 12/12/22 10:03, Tom Rini wrote: >>>> On Mon, Dec 12, 2022 at 02:45:10PM +0800, Rick Chen wrote: >>>>> Hi Tom >>>>> >>>>>> On Fri, Dec 09, 2022 at 08:48:37AM -0500, Sean Anderson wrote: >>>>>>> On 12/7/22 01:23, Rick Chen wrote: >>>>>>>> In RISC-V, it only provide normal mode booting currently. >>>>>>>> To speed up the booting process, here provide SPL_OPENSBI_OS_BOOT >>>>>>>> to achieve this feature which will be call Fast-Boot mode. By >>>>>>> >>>>>>> Can you name this something different. We already have something called >>>>>>> fastboot in-tree (the Android-derived protocol) and there's a Microsoft >>>>>>> technology called fastboot (some kind of hibernation). "OS Boot" isn't >>>>>>> very specific either, since we (almost always) boot an OS. Maybe "Eagle >>>>>>> mode" by analogy to Falcon mode, which lets SPL directly boot an OS. >>>>>>> >>>>>>> (Is this substantially different from falcon mode anyway?) >>>>>> >>>>>> I was kind of wondering if this is different, really, from Falcon Mode. >>>>>> Falcon Mode didn't initially have to factor in other-firmware as that's >>>>>> not a hard requirement on arm32 like it is on arm64 or risc-v. But my >>>>>> first read of this was that it seems like the RISC-V specific side of >>>>>> doing Falcon Mode and dealing with the prior stage needs correctly. >>>>>> >>>>> >>>>> Yes. It is a little bit different from the Falcon mode (SPL_OS_BOOT=y). >>>>> When I try to enable SPL_OS_BOOT, it will encounter that SYS_SPL_ARGS_ADDR and >>>>> jump_to_image_linux() shall be defined but they are un-necessary for RISC-V. >>>>> Because the flow of OpenSBI and SPL_OS_BOOT are totally different code >>>>> flow in board_init_r() of common/spl/spl.c. >>>>> That is why I added a new symbol called SPL_OPENSBI_OS_BOOT for this >>>>> RISC-V fast boot implementation. >>>> >>>> Those sound like fairly minor challenges for the same fundamental >>>> concept. We have SYS_SPL_ARGS_ADDR for "where is the device tree to >>>> pass along". We might need to do a little code re-factoring here. But >>>> maybe also a little bit of explaining why we wouldn't be booting to the >>>> OS directly but instead passing back to openSBI to do this? That's not >>>> normally how RISC-V boots the OS, right? Or am I miss-understanding >>>> something here? >>>> >>> >>> The usual process is >>> >>> ROM -> SPL -> SBI -> U-Boot -> Linux >> >> In RISC-V, Linux runs in S-mode, it needs the OpenSBI which plays as >> M-mode to deal with SBI calls at run-time. >> So the fast boot idea, I just want to bypass U-Boot and jump to Linux >> directly and Linux still needs OpenSBI. >> Hence SPL_OPENSBI can't be disabled here. > > So is the flow here: > a) ROM -> SPL -> SBI -> SPL -> Linux > or > b) ROM -> SPL -> SBI -> Linux The latter. The regular boot is (M) Boot ROM loads SPL and executes it (M) SPL loads SBI and U-Boot proper and executes SBI (M) SBI performs initialization and executes U-Boot (S) U-Boot loads Linux and executes it (S) Linux boots And this would change that to (M) Boot ROM loads SPL and executes it (M) SPL loads SBI and Linux and executes SBI (M) SBI performs initialization and executes Linux (S) Linux boots So the idea here is to load Linux in SPL instead of U-Boot. But I think this is the only way to go for platforms which use OpenSBI. Regular falcon mode would require a Linux which runs in M-mode. So I don't think we need a separate config. --Sean > It's not clear to me, and I think that'll help figure out what's best > here. Since I kinda think we're looking at a more generic issue that we > see with newer architectures and maybe we already had to solve this (but > didn't name things well enough) for aarch64. >