All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Stefan Herbrechtsmeier
	<stefan.herbrechtsmeier-oss@weidmueller.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>,
	trini@konsulko.com
Cc: Joe Hershberger <joe.hershberger@ni.com>, Marek Vasut <marex@denx.de>
Subject: Re: [PATCH V2 01/13] env: Complete generic support for writable list
Date: Thu, 27 Oct 2022 14:38:50 +0200	[thread overview]
Message-ID: <0d3a134e-c065-77e5-3e00-75d84d3fd308@siemens.com> (raw)
In-Reply-To: <13650240-e754-a597-b551-752ce779ebaa@weidmueller.com>

On 27.10.22 09:49, Stefan Herbrechtsmeier wrote:
> Hi,
> 
> Am 05.10.2022 um 10:33 schrieb Jan Kiszka:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> This completes what 890feecaab72 started by selecting ENV_APPEND and
>> ENV_IS_NOWHERE and by moving this driver to top if the list. This
>> ensures that load operations pick up both the default env and the
>> permitted parts of the next-prio location. When writing though, we must
>> use the regular ordering.
>>
>> With this change, boards only need to define the list of writable
>> variables but no longer have to provide a custom env_get_location
>> implementation.
>>
>> CC: Joe Hershberger <joe.hershberger@ni.com>
>> CC: Marek Vasut <marex@denx.de>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>   env/Kconfig |  2 ++
>>   env/env.c   | 22 ++++++++++++++++++++++
>>   2 files changed, 24 insertions(+)
>>
>> diff --git a/env/Kconfig b/env/Kconfig
>> index 24111dfaf47..05b5fbf17d1 100644
>> --- a/env/Kconfig
>> +++ b/env/Kconfig
>> @@ -715,6 +715,8 @@ config ENV_APPEND
>>     config ENV_WRITEABLE_LIST
>>       bool "Permit write access only to listed variables"
>> +    select ENV_IS_NOWHERE
>> +    select ENV_APPEND
>>       help
>>         If defined, only environment variables which explicitly set
>> the 'w'
>>         writeable flag can be written and modified at runtime. No
>> variables
>> diff --git a/env/env.c b/env/env.c
>> index 69848fb0608..d0649f9540d 100644
>> --- a/env/env.c
>> +++ b/env/env.c
>> @@ -133,6 +133,28 @@ __weak enum env_location
>> arch_env_get_location(enum env_operation op, int prio)
>>       if (prio >= ARRAY_SIZE(env_locations))
>>           return ENVL_UNKNOWN;
>>   +    if (IS_ENABLED(CONFIG_ENV_WRITEABLE_LIST)) {
>> +        /*
>> +         * In writeable-list mode, ENVL_NOWHERE gains highest prio by
>> +         * virtually injecting it at prio 0.
>> +         */
>> +        if (prio == 0) {
>> +            /*
>> +             * Avoid the injection for write operations as that
>> +             * would block it.
>> +             */
>> +            if (op != ENVOP_SAVE && op != ENVOP_ERASE)
>> +                return ENVL_NOWHERE;
> 
> Is it consensus now to use ENVL_NOWHERE as synonym for default
> environment? If I remember correct this was rejected in the past and
> ENVL_NOWHERE  should only be used if no enviroment is available.
> 
> Why don't you call env_set_default(NULL, 0) in env_load() before
> env_driver_lookup()?

Worth to explore... if that should avoid this logic here... Let me try.

Jan

> 
>> +        } else {
>> +            /*
>> +             * always subtract 1, also for writing because
>> +             * env_load_prio, which is used for writing, was
>> +             * initialized with that offset.
>> +             */
>> +            prio--;
>> +        }
>> +    }
>> +
>>       return env_locations[prio];
>>   }
>>   
> 
> Regards
> 
>   Stefan
> 

-- 
Siemens AG, Technology
Competence Center Embedded Linux


  reply	other threads:[~2022-10-27 12:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05  8:33 [PATCH V2 00/13] IOT2050-related enhancements Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 01/13] env: Complete generic support for writable list Jan Kiszka
2022-10-27  7:49   ` Stefan Herbrechtsmeier
2022-10-27 12:38     ` Jan Kiszka [this message]
2022-10-28  8:34       ` Stefan Herbrechtsmeier
2022-10-05  8:33 ` [PATCH V2 02/13] env: Couple networking-related variable flags to CONFIG_NET Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 03/13] tools: Add script for converting public key into device tree include Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 04/13] board: siemens: iot2050: Split the build for PG1 and PG2 Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 05/13] arm: dts: iot2050: Use the auto generator nodes for fdt Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 06/13] iot2050: Update firmware layout Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 07/13] iot2050: Add watchdog start to bootcmd Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 08/13] iot2050: Add CONFIG_ENV_FLAGS_LIST_STATIC Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 09/13] arm: dts: iot2050: Allow verifying U-Boot proper by SPL Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 10/13] iot2050: Add script for signing artifacts Jan Kiszka
2022-10-05 15:58   ` Simon Glass
2022-10-05 16:04     ` Jan Kiszka
2022-10-05 16:16       ` Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 11/13] arm: dts: iot2050: Optionally embed OTP programming data into image Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 12/13] doc: iot2050: Add a note about the watchdog firmware Jan Kiszka
2022-10-05  8:33 ` [PATCH V2 13/13] board: siemens: iot2050: use the named gpio to control the user-button Jan Kiszka
2022-10-26  7:28 ` [PATCH V2 00/13] IOT2050-related enhancements Jan Kiszka
2022-10-26 13:54   ` Tom Rini
2022-10-26 14:03     ` Marek Vasut
2022-10-26 15:55       ` Jan Kiszka
2022-10-26 21:02         ` Marek Vasut
2022-10-27  4:32           ` Jan Kiszka

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=0d3a134e-c065-77e5-3e00-75d84d3fd308@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=joe.hershberger@ni.com \
    --cc=marex@denx.de \
    --cc=stefan.herbrechtsmeier-oss@weidmueller.com \
    --cc=trini@konsulko.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.