Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-10 Thread Tom Rini
On Sat, Sep 10, 2022 at 10:59:20PM +0300, Sergei Antonov wrote:
> On Sat, 10 Sept 2022 at 17:18, Tom Rini  wrote:
> >
> > On Sun, Sep 04, 2022 at 06:54:29PM +0300, Sergei Antonov wrote:
> > > On Sun, 4 Sept 2022 at 18:30, Tom Rini  wrote:
> > > >
> > > > On Sun, Sep 04, 2022 at 06:28:56PM +0300, Sergei Antonov wrote:
> > > > > On Sun, 4 Sept 2022 at 18:23, Tom Rini  wrote:
> > > > > > > > > > What type must it be in Kconfig? Note, it is an array 
> > > > > > > > > > initializer
> > > > > > > > > > similar to CONFIG_SYS_BAUDRATE_TABLE.
> > > > > > > > >
> > > > > > > > > Ah, ugh. So, it's also currently unused code, what does it 
> > > > > > > > > look like in
> > > > > > > > > the platform you're making use of this on?
> > > > > > > >
> > > > > > > > In my _defconfig I use this line:
> > > > > > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
> > > > > > > > To protect the first 256 KB of flash memory.
> > > > > > >
> > > > > > > Please, disregard the previous message. I was too hasty to reply.
> > > > > > >
> > > > > > > I have include/configs/myplatform.h file which contains this line:
> > > > > > > #define CONFIG_SYS_FLASH_AUTOPROTECT_LIST {{0x8000, 0x4}}
> > > > > > >
> > > > > > > And I could not convert it to Kconfig string parameter.
> > > > > >
> > > > > > Can this information be obtained from an existing device tree 
> > > > > > binding on
> > > > > > the platform?
> > > > >
> > > > > Device tree exists. No, DT does not currently contain this
> > > > > information. But it can be added.
> > > >
> > > > OK. But, is there an existing binding, or would it be a new one?
> > >
> > > I am using an existing "cfi-flash" driver:
> > > nor@8000 {
> > > #address-cells = <1>;
> > > #size-cells = <1>;
> > > compatible = "cfi-flash";
> > > reg = <0x8000 0x0>;
> > > ...
> > > }
> >
> > Getting back to this, sorry, I meant if there was a property we could
> > use or some other way to infer this from the device tree. I see the
> > partition binding has a way to mark things as read-only, which we could
> > use as a hint (and with a new Kconfig option) to say that partitions
> > that are marked as read only are then also protected.
> 
> Can "read-only;" in .dts be such a hint? Here is what I have in .my .dts:
>   nor@8000 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "cfi-flash";
> reg = <0x8000 0x0>;
> partitions {
>   ...
>   mtd1 {
> label = "bios";
> reg = <0x0 0x4>;
> read-only;
>   };

Yes, that's what I was trying to suggest. If you're interested in
implementing it, that's great!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-10 Thread Sergei Antonov
On Sat, 10 Sept 2022 at 17:18, Tom Rini  wrote:
>
> On Sun, Sep 04, 2022 at 06:54:29PM +0300, Sergei Antonov wrote:
> > On Sun, 4 Sept 2022 at 18:30, Tom Rini  wrote:
> > >
> > > On Sun, Sep 04, 2022 at 06:28:56PM +0300, Sergei Antonov wrote:
> > > > On Sun, 4 Sept 2022 at 18:23, Tom Rini  wrote:
> > > > > > > > > What type must it be in Kconfig? Note, it is an array 
> > > > > > > > > initializer
> > > > > > > > > similar to CONFIG_SYS_BAUDRATE_TABLE.
> > > > > > > >
> > > > > > > > Ah, ugh. So, it's also currently unused code, what does it look 
> > > > > > > > like in
> > > > > > > > the platform you're making use of this on?
> > > > > > >
> > > > > > > In my _defconfig I use this line:
> > > > > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
> > > > > > > To protect the first 256 KB of flash memory.
> > > > > >
> > > > > > Please, disregard the previous message. I was too hasty to reply.
> > > > > >
> > > > > > I have include/configs/myplatform.h file which contains this line:
> > > > > > #define CONFIG_SYS_FLASH_AUTOPROTECT_LIST {{0x8000, 0x4}}
> > > > > >
> > > > > > And I could not convert it to Kconfig string parameter.
> > > > >
> > > > > Can this information be obtained from an existing device tree binding 
> > > > > on
> > > > > the platform?
> > > >
> > > > Device tree exists. No, DT does not currently contain this
> > > > information. But it can be added.
> > >
> > > OK. But, is there an existing binding, or would it be a new one?
> >
> > I am using an existing "cfi-flash" driver:
> > nor@8000 {
> > #address-cells = <1>;
> > #size-cells = <1>;
> > compatible = "cfi-flash";
> > reg = <0x8000 0x0>;
> > ...
> > }
>
> Getting back to this, sorry, I meant if there was a property we could
> use or some other way to infer this from the device tree. I see the
> partition binding has a way to mark things as read-only, which we could
> use as a hint (and with a new Kconfig option) to say that partitions
> that are marked as read only are then also protected.

Can "read-only;" in .dts be such a hint? Here is what I have in .my .dts:
  nor@8000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0x8000 0x0>;
partitions {
  ...
  mtd1 {
label = "bios";
reg = <0x0 0x4>;
read-only;
  };


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-10 Thread Tom Rini
On Sun, Sep 04, 2022 at 06:54:29PM +0300, Sergei Antonov wrote:
> On Sun, 4 Sept 2022 at 18:30, Tom Rini  wrote:
> >
> > On Sun, Sep 04, 2022 at 06:28:56PM +0300, Sergei Antonov wrote:
> > > On Sun, 4 Sept 2022 at 18:23, Tom Rini  wrote:
> > > > > > > > What type must it be in Kconfig? Note, it is an array 
> > > > > > > > initializer
> > > > > > > > similar to CONFIG_SYS_BAUDRATE_TABLE.
> > > > > > >
> > > > > > > Ah, ugh. So, it's also currently unused code, what does it look 
> > > > > > > like in
> > > > > > > the platform you're making use of this on?
> > > > > >
> > > > > > In my _defconfig I use this line:
> > > > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
> > > > > > To protect the first 256 KB of flash memory.
> > > > >
> > > > > Please, disregard the previous message. I was too hasty to reply.
> > > > >
> > > > > I have include/configs/myplatform.h file which contains this line:
> > > > > #define CONFIG_SYS_FLASH_AUTOPROTECT_LIST {{0x8000, 0x4}}
> > > > >
> > > > > And I could not convert it to Kconfig string parameter.
> > > >
> > > > Can this information be obtained from an existing device tree binding on
> > > > the platform?
> > >
> > > Device tree exists. No, DT does not currently contain this
> > > information. But it can be added.
> >
> > OK. But, is there an existing binding, or would it be a new one?
> 
> I am using an existing "cfi-flash" driver:
> nor@8000 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "cfi-flash";
> reg = <0x8000 0x0>;
> ...
> }

Getting back to this, sorry, I meant if there was a property we could
use or some other way to infer this from the device tree. I see the
partition binding has a way to mark things as read-only, which we could
use as a hint (and with a new Kconfig option) to say that partitions
that are marked as read only are then also protected. But it's also fine
to go with renaming this to be CFG_SYS_... and continue to #define it,
instead.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-04 Thread Sergei Antonov
On Sun, 4 Sept 2022 at 18:30, Tom Rini  wrote:
>
> On Sun, Sep 04, 2022 at 06:28:56PM +0300, Sergei Antonov wrote:
> > On Sun, 4 Sept 2022 at 18:23, Tom Rini  wrote:
> > > > > > > What type must it be in Kconfig? Note, it is an array initializer
> > > > > > > similar to CONFIG_SYS_BAUDRATE_TABLE.
> > > > > >
> > > > > > Ah, ugh. So, it's also currently unused code, what does it look 
> > > > > > like in
> > > > > > the platform you're making use of this on?
> > > > >
> > > > > In my _defconfig I use this line:
> > > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
> > > > > To protect the first 256 KB of flash memory.
> > > >
> > > > Please, disregard the previous message. I was too hasty to reply.
> > > >
> > > > I have include/configs/myplatform.h file which contains this line:
> > > > #define CONFIG_SYS_FLASH_AUTOPROTECT_LIST {{0x8000, 0x4}}
> > > >
> > > > And I could not convert it to Kconfig string parameter.
> > >
> > > Can this information be obtained from an existing device tree binding on
> > > the platform?
> >
> > Device tree exists. No, DT does not currently contain this
> > information. But it can be added.
>
> OK. But, is there an existing binding, or would it be a new one?

I am using an existing "cfi-flash" driver:
nor@8000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0x8000 0x0>;
...
}


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-04 Thread Tom Rini
On Sun, Sep 04, 2022 at 06:28:56PM +0300, Sergei Antonov wrote:
> On Sun, 4 Sept 2022 at 18:23, Tom Rini  wrote:
> > > > > > What type must it be in Kconfig? Note, it is an array initializer
> > > > > > similar to CONFIG_SYS_BAUDRATE_TABLE.
> > > > >
> > > > > Ah, ugh. So, it's also currently unused code, what does it look like 
> > > > > in
> > > > > the platform you're making use of this on?
> > > >
> > > > In my _defconfig I use this line:
> > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
> > > > To protect the first 256 KB of flash memory.
> > >
> > > Please, disregard the previous message. I was too hasty to reply.
> > >
> > > I have include/configs/myplatform.h file which contains this line:
> > > #define CONFIG_SYS_FLASH_AUTOPROTECT_LIST {{0x8000, 0x4}}
> > >
> > > And I could not convert it to Kconfig string parameter.
> >
> > Can this information be obtained from an existing device tree binding on
> > the platform?
> 
> Device tree exists. No, DT does not currently contain this
> information. But it can be added.

OK. But, is there an existing binding, or would it be a new one? I'm
wary of adding and upstreaming a new binding here, as the next option
would be to rename this to CFG_SYS_FLASH_AUTOPROTECT_LIST and continue
to #define it.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-04 Thread Sergei Antonov
On Sun, 4 Sept 2022 at 18:23, Tom Rini  wrote:
> > > > > What type must it be in Kconfig? Note, it is an array initializer
> > > > > similar to CONFIG_SYS_BAUDRATE_TABLE.
> > > >
> > > > Ah, ugh. So, it's also currently unused code, what does it look like in
> > > > the platform you're making use of this on?
> > >
> > > In my _defconfig I use this line:
> > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
> > > To protect the first 256 KB of flash memory.
> >
> > Please, disregard the previous message. I was too hasty to reply.
> >
> > I have include/configs/myplatform.h file which contains this line:
> > #define CONFIG_SYS_FLASH_AUTOPROTECT_LIST {{0x8000, 0x4}}
> >
> > And I could not convert it to Kconfig string parameter.
>
> Can this information be obtained from an existing device tree binding on
> the platform?

Device tree exists. No, DT does not currently contain this
information. But it can be added.


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-04 Thread Tom Rini
On Sun, Sep 04, 2022 at 12:26:04PM +0300, Sergei Antonov wrote:
> On Sun, 4 Sept 2022 at 12:23, Sergei Antonov  wrote:
> >
> > On Sat, 3 Sept 2022 at 19:16, Tom Rini  wrote:
> > >
> > > On Sat, Sep 03, 2022 at 05:49:50PM +0300, Sergei Antonov wrote:
> > > > On Sat, 3 Sept 2022 at 17:31, Tom Rini  wrote:
> > > > >
> > > > > On Sat, Sep 03, 2022 at 05:30:30PM +0300, Sergei Antonov wrote:
> > > > >
> > > > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST is a feature of 
> > > > > > drivers/mtd/cfi_flash.c
> > > > > > driver. It allows to specify a range of protected eraseblocks on 
> > > > > > flash memory.
> > > > > >
> > > > > > Fixes build error:
> > > > > > Error: You must add new CONFIG options using Kconfig
> > > > > > The following new ad-hoc CONFIG options were detected:
> > > > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST
> > > > > >
> > > > > > Signed-off-by: Sergei Antonov 
> > > > > > ---
> > > > > >  scripts/config_whitelist.txt | 1 +
> > > > > >  1 file changed, 1 insertion(+)
> > > > >
> > > > > Please move this to Kconfig so that it can be enabled, thanks.
> > > >
> > > > What type must it be in Kconfig? Note, it is an array initializer
> > > > similar to CONFIG_SYS_BAUDRATE_TABLE.
> > >
> > > Ah, ugh. So, it's also currently unused code, what does it look like in
> > > the platform you're making use of this on?
> >
> > In my _defconfig I use this line:
> > CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
> > To protect the first 256 KB of flash memory.
> 
> Please, disregard the previous message. I was too hasty to reply.
> 
> I have include/configs/myplatform.h file which contains this line:
> #define CONFIG_SYS_FLASH_AUTOPROTECT_LIST {{0x8000, 0x4}}
> 
> And I could not convert it to Kconfig string parameter.

Can this information be obtained from an existing device tree binding on
the platform?

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-04 Thread Sergei Antonov
On Sun, 4 Sept 2022 at 12:23, Sergei Antonov  wrote:
>
> On Sat, 3 Sept 2022 at 19:16, Tom Rini  wrote:
> >
> > On Sat, Sep 03, 2022 at 05:49:50PM +0300, Sergei Antonov wrote:
> > > On Sat, 3 Sept 2022 at 17:31, Tom Rini  wrote:
> > > >
> > > > On Sat, Sep 03, 2022 at 05:30:30PM +0300, Sergei Antonov wrote:
> > > >
> > > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST is a feature of 
> > > > > drivers/mtd/cfi_flash.c
> > > > > driver. It allows to specify a range of protected eraseblocks on 
> > > > > flash memory.
> > > > >
> > > > > Fixes build error:
> > > > > Error: You must add new CONFIG options using Kconfig
> > > > > The following new ad-hoc CONFIG options were detected:
> > > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST
> > > > >
> > > > > Signed-off-by: Sergei Antonov 
> > > > > ---
> > > > >  scripts/config_whitelist.txt | 1 +
> > > > >  1 file changed, 1 insertion(+)
> > > >
> > > > Please move this to Kconfig so that it can be enabled, thanks.
> > >
> > > What type must it be in Kconfig? Note, it is an array initializer
> > > similar to CONFIG_SYS_BAUDRATE_TABLE.
> >
> > Ah, ugh. So, it's also currently unused code, what does it look like in
> > the platform you're making use of this on?
>
> In my _defconfig I use this line:
> CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
> To protect the first 256 KB of flash memory.

Please, disregard the previous message. I was too hasty to reply.

I have include/configs/myplatform.h file which contains this line:
#define CONFIG_SYS_FLASH_AUTOPROTECT_LIST {{0x8000, 0x4}}

And I could not convert it to Kconfig string parameter.


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-04 Thread Sergei Antonov
On Sat, 3 Sept 2022 at 19:16, Tom Rini  wrote:
>
> On Sat, Sep 03, 2022 at 05:49:50PM +0300, Sergei Antonov wrote:
> > On Sat, 3 Sept 2022 at 17:31, Tom Rini  wrote:
> > >
> > > On Sat, Sep 03, 2022 at 05:30:30PM +0300, Sergei Antonov wrote:
> > >
> > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST is a feature of 
> > > > drivers/mtd/cfi_flash.c
> > > > driver. It allows to specify a range of protected eraseblocks on flash 
> > > > memory.
> > > >
> > > > Fixes build error:
> > > > Error: You must add new CONFIG options using Kconfig
> > > > The following new ad-hoc CONFIG options were detected:
> > > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST
> > > >
> > > > Signed-off-by: Sergei Antonov 
> > > > ---
> > > >  scripts/config_whitelist.txt | 1 +
> > > >  1 file changed, 1 insertion(+)
> > >
> > > Please move this to Kconfig so that it can be enabled, thanks.
> >
> > What type must it be in Kconfig? Note, it is an array initializer
> > similar to CONFIG_SYS_BAUDRATE_TABLE.
>
> Ah, ugh. So, it's also currently unused code, what does it look like in
> the platform you're making use of this on?

In my _defconfig I use this line:
CONFIG_SYS_FLASH_AUTOPROTECT_LIST="{{0x8000, 0x4}}"
To protect the first 256 KB of flash memory.


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-03 Thread Tom Rini
On Sat, Sep 03, 2022 at 05:49:50PM +0300, Sergei Antonov wrote:
> On Sat, 3 Sept 2022 at 17:31, Tom Rini  wrote:
> >
> > On Sat, Sep 03, 2022 at 05:30:30PM +0300, Sergei Antonov wrote:
> >
> > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST is a feature of drivers/mtd/cfi_flash.c
> > > driver. It allows to specify a range of protected eraseblocks on flash 
> > > memory.
> > >
> > > Fixes build error:
> > > Error: You must add new CONFIG options using Kconfig
> > > The following new ad-hoc CONFIG options were detected:
> > > CONFIG_SYS_FLASH_AUTOPROTECT_LIST
> > >
> > > Signed-off-by: Sergei Antonov 
> > > ---
> > >  scripts/config_whitelist.txt | 1 +
> > >  1 file changed, 1 insertion(+)
> >
> > Please move this to Kconfig so that it can be enabled, thanks.
> 
> What type must it be in Kconfig? Note, it is an array initializer
> similar to CONFIG_SYS_BAUDRATE_TABLE.

Ah, ugh. So, it's also currently unused code, what does it look like in
the platform you're making use of this on?

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-03 Thread Sergei Antonov
On Sat, 3 Sept 2022 at 17:31, Tom Rini  wrote:
>
> On Sat, Sep 03, 2022 at 05:30:30PM +0300, Sergei Antonov wrote:
>
> > CONFIG_SYS_FLASH_AUTOPROTECT_LIST is a feature of drivers/mtd/cfi_flash.c
> > driver. It allows to specify a range of protected eraseblocks on flash 
> > memory.
> >
> > Fixes build error:
> > Error: You must add new CONFIG options using Kconfig
> > The following new ad-hoc CONFIG options were detected:
> > CONFIG_SYS_FLASH_AUTOPROTECT_LIST
> >
> > Signed-off-by: Sergei Antonov 
> > ---
> >  scripts/config_whitelist.txt | 1 +
> >  1 file changed, 1 insertion(+)
>
> Please move this to Kconfig so that it can be enabled, thanks.

What type must it be in Kconfig? Note, it is an array initializer
similar to CONFIG_SYS_BAUDRATE_TABLE.


Re: [PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-03 Thread Tom Rini
On Sat, Sep 03, 2022 at 05:30:30PM +0300, Sergei Antonov wrote:

> CONFIG_SYS_FLASH_AUTOPROTECT_LIST is a feature of drivers/mtd/cfi_flash.c
> driver. It allows to specify a range of protected eraseblocks on flash memory.
> 
> Fixes build error:
> Error: You must add new CONFIG options using Kconfig
> The following new ad-hoc CONFIG options were detected:
> CONFIG_SYS_FLASH_AUTOPROTECT_LIST
> 
> Signed-off-by: Sergei Antonov 
> ---
>  scripts/config_whitelist.txt | 1 +
>  1 file changed, 1 insertion(+)

Please move this to Kconfig so that it can be enabled, thanks.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] scripts: config_whitelist: CONFIG_SYS_FLASH_AUTOPROTECT_LIST

2022-09-03 Thread Sergei Antonov
CONFIG_SYS_FLASH_AUTOPROTECT_LIST is a feature of drivers/mtd/cfi_flash.c
driver. It allows to specify a range of protected eraseblocks on flash memory.

Fixes build error:
Error: You must add new CONFIG options using Kconfig
The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_FLASH_AUTOPROTECT_LIST

Signed-off-by: Sergei Antonov 
---
 scripts/config_whitelist.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 22a0f2bf8a5d..d2e4e5375baf 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -633,6 +633,7 @@ CONFIG_SYS_FLASH0
 CONFIG_SYS_FLASH1
 CONFIG_SYS_FLASH1_BASE_PHYS
 CONFIG_SYS_FLASH1_BASE_PHYS_EARLY
+CONFIG_SYS_FLASH_AUTOPROTECT_LIST
 CONFIG_SYS_FLASH_BANKS_LIST
 CONFIG_SYS_FLASH_BANKS_SIZES
 CONFIG_SYS_FLASH_BASE
-- 
2.34.1