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 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 CD97DC32772 for ; Tue, 23 Aug 2022 14:36:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8992484803; Tue, 23 Aug 2022 16:36:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TMKuqgBQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 402A5840AB; Tue, 23 Aug 2022 16:36:02 +0200 (CEST) Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) (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 8741983F93 for ; Tue, 23 Aug 2022 16:35:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-3378303138bso344306117b3.9 for ; Tue, 23 Aug 2022 07:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=3UfjI4EHfdNfVh7xjiY6NjeCOGzEtY8+IHCibsY43/M=; b=TMKuqgBQNyk8sTmzhwcY0jKxM4YKm0DENDZSr/IGOO32Hw1WXgMOEZNNj1Gdna/g+2 rZsNuVYq0e3MrbZpow7Wof2N407meU25HIuxJ8F6zwvFKV+C6Ccf068wMUosT+DtPXkd bRAq2OAFR+WFe7JUL90lUVB5jzohM15xOrs5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=3UfjI4EHfdNfVh7xjiY6NjeCOGzEtY8+IHCibsY43/M=; b=YAtl7VCeZyBFVsYr3ja1QL4EEi9xcSqt9aQc+oO+2mCoC4xfrKFuyrBvDlvU+dtICQ WTEmoGECswUGl7gIUNntSsHe8alKHcvdmrQo2mQzpEvWS1HXUOU7bPaivS0VrwCTMY4s wnMS/IB9I4yL4dSE499gj6q+EIRkZ+lmkt0ympRyAIkbgoIH3Y9cL6DUEuXm2Wm1YEOq snPI8nt0GFo9RrO4PP2DlLvs03C0xMwIydRdgLFzyTxeZFUymTeNzMuGmzEQ/zJ+9hAo 0X2cmKyAU+2NRPPAR6e8kLFmZDYEWC6X19StLOuGIf+qZuJA9mABYhPCjLUgaCS5NvJf f2Zg== X-Gm-Message-State: ACgBeo3zEeTdWekLFaR8E0nTmuRbMZEQ3PABk0Pij+6ipR/eg0zEB9Sv GiOxNIvDouKzCXxdpj14w34yD2ktfstciQKr+kK1MQ== X-Google-Smtp-Source: AA6agR7UEHvagMX1K3TjnWhwekqLEVJp+yyWzKAAZcRGzILsheFpuX+maW06kB7SkFb2CcQu5Xbm7ltYbofZe01SMqs= X-Received: by 2002:a25:6003:0:b0:68c:870b:2405 with SMTP id u3-20020a256003000000b0068c870b2405mr24115909ybb.9.1661265357785; Tue, 23 Aug 2022 07:35:57 -0700 (PDT) MIME-Version: 1.0 References: <20220822073423.3663582-1-rasmus.villemoes@prevas.dk> <4557fbd0-812c-27eb-78b3-b8fc6a1201a8@prevas.dk> In-Reply-To: <4557fbd0-812c-27eb-78b3-b8fc6a1201a8@prevas.dk> From: Simon Glass Date: Tue, 23 Aug 2022 07:35:46 -0700 Message-ID: Subject: Re: [PATCH] fdt_support: add optional board_rng_seed() hook To: Rasmus Villemoes Cc: U-Boot Mailing List , Michal Simek , Tom Rini Content-Type: text/plain; charset="UTF-8" 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 Hi Rasmus, On Tue, 23 Aug 2022 at 07:06, Rasmus Villemoes wrote: > > On 23/08/2022 15.38, Simon Glass wrote: > > >> +/** > >> + * board_rng_seed() - Provide a seed to be passed via /chosen/rng-seed > >> + * > >> + * This function is called if CONFIG_BOARD_RNG_SEED is set, and must > >> + * be provided by the board. It should return, via @buf, some suitable > >> + * seed value to pass to the kernel. > >> + * > >> + * @param buf A struct abuf for returning the seed and its size. > >> + * @return 0 if ok, negative on error. > >> + */ > >> +int board_rng_seed(struct abuf *buf); > > > > Instead of yet another hook, can we use EVT_FT_FIXUP? An even better > > option might be to use EVT_FT_FIXUP and then call a UCLASS_BOARD > > method to obtain the information. > > I didn't know there was anything called EVT_FT_FIXUP, and from grepping, > it seems suffer the same problem as ft_board_setup() as I mention, > namely running after the command line (aka /chosen/bootargs) has been > set up. If that is the only problem, then you could add another event for doing an earlier fixup. > > Also, I can't see how it can actually affect the blob being passed to > the kernel, doesn't > > fixup.tree = oftree_default(); > ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup)); > > mean that fixup.tree points at U-Boot's control fdt rather than the blob > that will be passed as the kernel's fdt? That seems wrong. Yes that is wrong for many platforms. We should probably just change it, but there is a complication. My recent series made a start at supporting writing to a DT using the ofnode interface. See vbe_simple_test_base() for some comments on the current state. You could require OF_LIVE to be enabled for your new feature. Ideally I'd like to see ofnode used for all devicetree access, but it will need to be done in stages. In the meantime we should try to head in that direction. Regards, Simon