From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C166BC433F5 for ; Fri, 15 Oct 2021 11:21:09 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B9634611C2 for ; Fri, 15 Oct 2021 11:21:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B9634611C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AB5D883657; Fri, 15 Oct 2021 13:21:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 47F7C8365D; Fri, 15 Oct 2021 13:21:03 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 800B483656 for ; Fri, 15 Oct 2021 13:20:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B0A05147A; Fri, 15 Oct 2021 04:20:58 -0700 (PDT) Received: from donnerap.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BF86A3F70D; Fri, 15 Oct 2021 04:20:57 -0700 (PDT) Date: Fri, 15 Oct 2021 12:20:55 +0100 From: Andre Przywara To: Simon Glass Cc: Peter Hoyes , U-Boot Mailing List , Bin Meng , Kory Maincent , diego.sueiro@arm.com Subject: Re: [PATCH] cmd: pxe_utils: Check fdtcontroladdr in label_boot Message-ID: <20211015122055.18406866@donnerap.cambridge.arm.com> In-Reply-To: References: <20211014084004.3173835-1-peter.hoyes@arm.com> Organization: ARM X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On Thu, 14 Oct 2021 12:24:45 -0600 Simon Glass wrote: Hi Simon, > On Thu, 14 Oct 2021 at 02:40, Peter Hoyes wrote: > > > > From: Peter Hoyes > > > > If using OF_CONTROL, fdtcontroladdr is set to the fdt used to configure > > U-Boot. When using PXE, if no fdt is defined in the menu file, and > > there is no fdt at fdt_addr, add fall back on fdtcontroladdr too. > > > > We are developing board support for the Armv8r64 FVP using > > config_distro_bootcmd. We are also using OF_BOARD and would like the > > PXE boot option to default to the fdt provided by board_fdt_blob_setup. > > > > Signed-off-by: Peter Hoyes > > --- > > cmd/pxe_utils.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c > > index 067c24e5ff..8f8e69ca97 100644 > > --- a/cmd/pxe_utils.c > > +++ b/cmd/pxe_utils.c > > @@ -556,7 +556,10 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) > > * Scenario 2: If there is an fdt_addr specified, pass it along to > > * bootm, and adjust argc appropriately. > > * > > - * Scenario 3: fdt blob is not available. > > + * Scenario 3: If there is an fdtcontroladdr specified, pass it along to > > + * bootm, and adjust argc appropriately. > > + * > > + * Scenario 4: fdt blob is not available. > > */ > > bootm_argv[3] = env_get("fdt_addr_r"); > > > > @@ -646,6 +649,9 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) > > if (!bootm_argv[3]) > > bootm_argv[3] = env_get("fdt_addr"); > > > > + if (!bootm_argv[3]) > > + bootm_argv[3] = env_get("fdtcontroladdr"); > > + > > if (bootm_argv[3]) { > > if (!bootm_argv[2]) > > bootm_argv[2] = "-"; > > -- > > 2.25.1 > > > > This is a bit strange as fdtcontroladdr is the control dtb that U-Boot > uses. Yes, that is the idea. This DTB should be as good as any, and this is the last check before giving up on DTs completely, so "U-Boot's DTB" (actually there is no such thing) is better than none at all. In fact EFI boot does the very same thing: https://source.denx.de/u-boot/u-boot/-/blob/master/include/config_distro_bootcmd.h#L144-L148 > Can you not set fdt_addr to that, if you need to? Is it not > already set to that? According to doc/README.distro, fdt_addr is reserved for DTBs residing at a (fixed?) ROM address. We don't really know yet where the DT comes from, the cleanest seems to be to be passed down from TF-A, in which case this would definitely not be ROM. board_fdt_blob_setup() knows this address, and this is what will be written to $fdtcontroladdr. FWIW, this patch looks good to me. Cheers, Andre > Also, there is a clean-up series for this code outstanding. I will > send v3 and copy you, if you are able to review it. > > Regards, > Simon