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 EDE73C4332F for ; Fri, 9 Dec 2022 13:48:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F13CB84FF0; Fri, 9 Dec 2022 14:48:45 +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="n0y5qSMp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB3748500F; Fri, 9 Dec 2022 14:48:43 +0100 (CET) Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (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 6D9C684E8F for ; Fri, 9 Dec 2022 14:48:40 +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-yb1-xb2c.google.com with SMTP id y135so5539126yby.12 for ; Fri, 09 Dec 2022 05:48:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=Dbn+D1Rkh2spTQgV9xo3MhFO/gShgTQ9qnqkhcVDscY=; b=n0y5qSMpuh83xzIrudlHPHOdCtbGYYN7R52a4f1iu9W34APSoNEUIBxzmSwGXlO+No 3p02PWr8oWDATjA4xkT4SG0hDKIz6BY3XbUI10tkVKqQPyXrxcmPhCi/AE8simMkXMNX A3qLexsg4PSsnDIEgmixu/wkbrJEMXrs23+3bu6Wxtfgvykn3kwUk7aNXoMtxb1Vd01f fVEE75XC2/suI/+OlaL0O1TGto+E/C9fLIco5kFIJVS4PiqweQgmr1Un3XidIEv6IXdk H3i8IJmZm3Xt4lNZirT3wLZxLIGQ7KSN8Y91yi9pRtvCZuBhStQGbymtAkj51xUAuf3B uOUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Dbn+D1Rkh2spTQgV9xo3MhFO/gShgTQ9qnqkhcVDscY=; b=rdyC7SCthLBeVdhLifHMs41aUangWlDCYxfgVmELTKZaBRikHsSXHh0VFOX7nKBTbC 4rMuMAeLHcRv3c7iNJ8viWDwnyAThi5FaRK8d4O3G2VDydV7844V9RVTOw2yAOlE9weP V3JghdpfVsizudHKCJACVteElEDhijlM0cnSS+tr4iP3QdYNi97mdVCnHh+zMW1spAwg w79C7q+LNqDV7rMErT7z24/DuOkaT2c1s1robzy/U6j2b12FDGourXjupqIJFBH14LSn 2L5pw4LLkVvAcHCM15zbn97IO9qhi9a8nfb733uvLEXD811ZRjSV+oksSqfNwRuTGF3r G+yA== X-Gm-Message-State: ANoB5plPnSpyPK5SYqD8ypQDd761HtE4vMtk0Gv8PG47UQ3gMOGfdUq9 MOw5jDA9lxIs8GQxnheqHGU= X-Google-Smtp-Source: AA0mqf7VbAxSbRgG0GdzYu74OqoOnThoSUuniQ5VS5AMh8+Q1mwPiEbu2uiKgT203Cncwe8bFCbA3g== X-Received: by 2002:a25:c0d2:0:b0:6f1:c60e:3004 with SMTP id c201-20020a25c0d2000000b006f1c60e3004mr5209441ybf.15.1670593719089; Fri, 09 Dec 2022 05:48:39 -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 d189-20020ae9efc6000000b006ce580c2663sm1142634qkg.35.2022.12.09.05.48.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Dec 2022 05:48:38 -0800 (PST) Message-ID: <1162c5df-dcfc-0908-1d07-32145e3a6aaa@gmail.com> Date: Fri, 9 Dec 2022 08:48:37 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: Sean Anderson Subject: Re: [PATCH 1/4] riscv: spl: Introduce SPL_OPENSBI_OS_BOOT To: Rick Chen , ycliang@andestech.com, rickchen36@gmail.com Cc: u-boot@lists.denx.de, trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de References: <20221207062334.21292-1-rick@andestech.com> Content-Language: en-US In-Reply-To: <20221207062334.21292-1-rick@andestech.com> 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/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?) > enabling SPL_OPENSBI_OS_BOOT, it will generate linux.itb instead > of default u-boot.itb after compiling. It initializes memory with > the U-Boot SPL at the first stage, just like what a regular booting > process (i.e. Normal Boot) does in the beginning. Instead of jumping > to the U-Boot proper from OpenSBI before booting Linux Kernel, the > Fast Boot process jumps directly to Linux Kernel to gain shorter > booting time. > > Signed-off-by: Rick Chen > --- > common/spl/Kconfig | 14 ++++++++++++++ > common/spl/spl_fit.c | 3 ++- > common/spl/spl_opensbi.c | 25 ++++++++++++------------- > 3 files changed, 28 insertions(+), 14 deletions(-) > > diff --git a/common/spl/Kconfig b/common/spl/Kconfig > index 05181bdba3..8805aba1b7 100644 > --- a/common/spl/Kconfig > +++ b/common/spl/Kconfig > @@ -1509,6 +1509,20 @@ config SPL_OPENSBI_SCRATCH_OPTIONS > Options passed to fw_dynamic, for example SBI_SCRATCH_NO_BOOT_PRINTS or > SBI_SCRATCH_DEBUG_PRINTS. > > +config SPL_OPENSBI_OS_BOOT Please use the same name for the config as for the description. > + bool "openSBI Fast Boot" > + depends on SPL_OPENSBI > + help > + Enable this openSBI can jump to Linux Kernel directly. Can you put some of the explanation from the commit message here? > + > +config SPL_OPENSBI_FIT_NAME > + string "SPL openSBI fit image name" > + depends on SPL_OPENSBI > + default "linux.itb" if SPL_OPENSBI_OS_BOOT > + default "u-boot.itb" > + help > + This will help to generate different fit name accordingly. Why not SPL_FS_LOAD_PAYLOAD_NAME? It looks like the code changes below do not use these configs. Can you move them to the next patch so it is clearer that they are for binman? --Sean > config SPL_TARGET > string "Addtional build targets for 'make'" > default "spl/u-boot-spl.srec" if RCAR_GEN2 > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c > index c1ed31e367..c5b1dfb3ba 100644 > --- a/common/spl/spl_fit.c > +++ b/common/spl/spl_fit.c > @@ -363,7 +363,8 @@ static bool os_takes_devicetree(uint8_t os) > case IH_OS_U_BOOT: > return true; > case IH_OS_LINUX: > - return IS_ENABLED(CONFIG_SPL_OS_BOOT); > + return IS_ENABLED(CONFIG_SPL_OS_BOOT) || > + IS_ENABLED(CONFIG_SPL_OPENSBI_OS_BOOT); > default: > return false; > } > diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c > index b0f40076c3..83869c6b18 100644 > --- a/common/spl/spl_opensbi.c > +++ b/common/spl/spl_opensbi.c > @@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR; > > struct fw_dynamic_info opensbi_info; > > -static int spl_opensbi_find_uboot_node(void *blob, int *uboot_node) > +static int spl_opensbi_find_os_node(void *blob, int *os_node) > { > int fit_images_node, node; > const char *fit_os; > @@ -34,10 +34,9 @@ static int spl_opensbi_find_uboot_node(void *blob, int *uboot_node) > if (!fit_os) > continue; > > - if (genimg_get_os_id(fit_os) == IH_OS_U_BOOT) { > - *uboot_node = node; > - return 0; > - } > + *os_node = node; > + > + return 0; > } > > return -ENODEV; > @@ -45,8 +44,8 @@ static int spl_opensbi_find_uboot_node(void *blob, int *uboot_node) > > void spl_invoke_opensbi(struct spl_image_info *spl_image) > { > - int ret, uboot_node; > - ulong uboot_entry; > + int ret, os_node; > + ulong os_entry; > void (*opensbi_entry)(ulong hartid, ulong dtb, ulong info); > > if (!spl_image->fdt_addr) { > @@ -54,22 +53,22 @@ void spl_invoke_opensbi(struct spl_image_info *spl_image) > hang(); > } > > - /* Find U-Boot image in /fit-images */ > - ret = spl_opensbi_find_uboot_node(spl_image->fdt_addr, &uboot_node); > + /* Find U-Boot or Linux image in /fit-images */ > + ret = spl_opensbi_find_os_node(spl_image->fdt_addr, &os_node); > if (ret) { > pr_err("Can't find U-Boot node, %d\n", ret); > hang(); > } > > - /* Get U-Boot entry point */ > - ret = fit_image_get_entry(spl_image->fdt_addr, uboot_node, &uboot_entry); > + /* Get os entry point */ > + ret = fit_image_get_entry(spl_image->fdt_addr, os_node, &os_entry); > if (ret) > - ret = fit_image_get_load(spl_image->fdt_addr, uboot_node, &uboot_entry); > + ret = fit_image_get_load(spl_image->fdt_addr, os_node, &os_entry); > > /* Prepare opensbi_info object */ > opensbi_info.magic = FW_DYNAMIC_INFO_MAGIC_VALUE; > opensbi_info.version = FW_DYNAMIC_INFO_VERSION; > - opensbi_info.next_addr = uboot_entry; > + opensbi_info.next_addr = os_entry; > opensbi_info.next_mode = FW_DYNAMIC_INFO_NEXT_MODE_S; > opensbi_info.options = CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS; > opensbi_info.boot_hart = gd->arch.boot_hart;