From: Sean Edmond <seanedmond@linux.microsoft.com>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de, dphadke@linux.microsoft.com,
macromorgan@hotmail.com
Subject: Re: [PATCH 1/3] fdt: common API to populate kaslr seed
Date: Fri, 11 Aug 2023 10:14:01 -0700 [thread overview]
Message-ID: <a0e2fd89-accf-78b5-2a9a-4a19b72b976e@linux.microsoft.com> (raw)
In-Reply-To: <CAPnjgZ1vZKO7OFwnmQaOhm0ivxYC1BzYEv0tnj8asvDchEb-uw@mail.gmail.com>
On 2023-08-09 6:49 p.m., Simon Glass wrote:
> Hi Sean,
>
> On Wed, 9 Aug 2023 at 16:35, Sean Edmond <seanedmond@linux.microsoft.com> wrote:
>>
>> On 2023-08-08 7:03 p.m., Simon Glass wrote:
>>> Hi,
>>>
>>> On Fri, 4 Aug 2023 at 17:34, <seanedmond@linux.microsoft.com> wrote:
>>>> From: Dhananjay Phadke <dphadke@linux.microsoft.com>
>>>>
>>>> fdt_fixup_kaslr_seed() will update given FDT with random seed value.
>>>> Source for random seed can be TPM or RNG driver in u-boot or sec
>>>> firmware (ARM).
>>>>
>>>> Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
>>>> ---
>>>> arch/arm/cpu/armv8/sec_firmware.c | 32 +++++++------------------------
>>>> common/fdt_support.c | 31 ++++++++++++++++++++++++++++++
>>>> include/fdt_support.h | 3 +++
>>>> 3 files changed, 41 insertions(+), 25 deletions(-)
>>> We need to find a way to use the ofnode API here.
>>>
>>>> diff --git a/arch/arm/cpu/armv8/sec_firmware.c b/arch/arm/cpu/armv8/sec_firmware.c
>>>> index c0e8726346..84ba49924e 100644
>>>> --- a/arch/arm/cpu/armv8/sec_firmware.c
>>>> +++ b/arch/arm/cpu/armv8/sec_firmware.c
>>>> @@ -411,46 +411,28 @@ int sec_firmware_init(const void *sec_firmware_img,
>>>> /*
>>>> * fdt_fix_kaslr - Add kalsr-seed node in Device tree
>>>> * @fdt: Device tree
>>>> - * @eret: 0 in case of error, 1 for success
>>>> + * @eret: 0 for success
>>>> */
>>>> int fdt_fixup_kaslr(void *fdt)
>>> You could pass an oftree to this function, e.g. obtained with:
>>>
>>> oftree_from_fdt(fdt)
>> The common API I added is fdt_fixup_kaslr_seed(), which was added to
>> "common/fdt_support.c".
>>
>> There are 3 callers:
>> sec_firmware_init()->fdt_fixup_kaslr_seed()
>> do_kaslr_seed()->fdt_fixup_kaslr_seed()
>> image_setup_libfdt()->fdt_tpm_kaslr_seed->fdt_fixup_kaslr_seed()
>>
>> I think the ask is to create a common API that uses the ofnode API. So,
>> instead of fdt_fixup_kaslr_seed() I can create
>> ofnode_fixup_kaslr_seed()? Where should it live?
> If you like you could add common/ofnode_support.c ?
>
> But it is OK to have it in the same file, I think.
>
>> Are you also wanting
>> the callers (eg. fdt_tpm_kaslr_seed, fdt_fixup_kaslr) to take oftree as
>> input too?
> So far as you can go, yes. Also you may want to pass an ofnode (the
> root node) so that things can deal with adding their stuff to any
> node.
>
> Regards,
> Simon
I re-worked the API to use the ofnode API and tested it on our board. I
was required to explicitly enable CONFIG_OFNODE_MULTI_TREE in order for
it to work.
I have concerns this will create a breaking change for users of the
kaslr fdt touch up. In our case, if CONFIG_OFNODE_MULTI_TREE isn't set,
the control FDT gets touched up, not the kernel FDT as required.
Everything runs to completion, but "/proc/device-tree/chosen/kaslr-seed"
isn't present after boot.
Am I missing something? Perhaps there's a way to modify the default
value for CONFIG_OFNODE_MULTI_TREE to ensure this works out-of-the-box?
next prev parent reply other threads:[~2023-08-11 17:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 23:33 [PATCH 0/3] Populate kaslr seed with TPM seanedmond
2023-08-04 23:33 ` [PATCH 1/3] fdt: common API to populate kaslr seed seanedmond
2023-08-09 2:03 ` Simon Glass
2023-08-09 22:35 ` Sean Edmond
2023-08-10 1:49 ` Simon Glass
2023-08-10 18:17 ` Chris Morgan
2023-08-11 17:14 ` Sean Edmond [this message]
2023-08-12 13:09 ` Simon Glass
2023-08-14 19:12 ` Sean Edmond
2023-08-15 14:44 ` Simon Glass
2023-08-15 17:46 ` Sean Edmond
2023-08-17 16:03 ` Sean Edmond
2023-08-18 3:09 ` Simon Glass
2023-08-04 23:33 ` [PATCH 2/3] fdt: kaslr seed from tpm entropy seanedmond
2023-08-09 2:03 ` Simon Glass
2023-09-08 16:42 ` Ilias Apalodimas
2023-08-04 23:33 ` [PATCH 3/3] cmd: kaslrseed: Use common API to fixup FDT seanedmond
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a0e2fd89-accf-78b5-2a9a-4a19b72b976e@linux.microsoft.com \
--to=seanedmond@linux.microsoft.com \
--cc=dphadke@linux.microsoft.com \
--cc=macromorgan@hotmail.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox