[PATCH v5 1/9] tpm: rng: Change tpm_get_random to return an int

2022-03-13 Thread Sughosh Ganu
function. Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V4: None include/tpm_api.h | 4 ++-- lib/tpm_api.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tpm_api.h b/include

[PATCH v5 2/9] tpm: Fix the return type of tpm_startup

2022-03-13 Thread Sughosh Ganu
The tpm_startup function returns negative values for error conditions. Fix the return type of the function to a signed int instead of a u32. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V4: None include/tpm_api.h | 2 +- lib/tpm_api.c

[PATCH v5 3/9] tpm: rng: Add driver model interface for TPM RNG device

2022-03-13 Thread Sughosh Ganu
to comply with the driver model api. Signed-off-by: Sughosh Ganu --- Changes since V4: * Call the existing tpm_get_random API function from the TPM RNG driver, instead of the tpm{1,2}_get_random API's * Introduce a new Kconfig symbol TPM_RNG and build the corresponding driver if the s

[PATCH v5 4/9] tpm: Add the RNG child device

2022-03-13 Thread Sughosh Ganu
randomisation through the EFI_RNG_PROTOCOL interface. Signed-off-by: Sughosh Ganu --- Changes since V4: * Put a check for CONFIG_TPM_RNG for binding the RNG device with it's driver in the post_probe callback instead of putting CONFIG_{SPL,TPL}_BUILD guards drivers/tpm/tpm-uclass.c

[PATCH v5 5/9] qemu: arm: Remove platform specific function to get RNG device

2022-03-13 Thread Sughosh Ganu
-off-by: Sughosh Ganu Tested-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V4: None board/emulation/qemu-arm/qemu-arm.c | 42 - 1 file changed, 42 deletions(-) diff --git a/board/emulation/qemu-arm/qemu-arm.c b

[PATCH v5 7/9] cmd: rng: Use a statically allocated array for random bytes

2022-03-13 Thread Sughosh Ganu
Use a statically allocated buffer on stack instead of using malloc for reading the random bytes. Using a local array is faster than allocating heap memory on every initiation of the command. Signed-off-by: Sughosh Ganu --- Changes since V4: * New patch based on review comments from Simon to

[PATCH v5 6/9] cmd: rng: Add support for selecting RNG device

2022-03-13 Thread Sughosh Ganu
udo device through the TPM chip. Extend the 'rng' command so that the user can provide the RNG device number from which the random bytes are to be read. This will be the device index under the RNG uclass. Signed-off-by: Sughosh Ganu Tested-by: Heinrich Schuchardt Reviewed-by: Ilias Apal

[PATCH v5 8/9] doc: rng: Add documentation for the rng command

2022-03-13 Thread Sughosh Ganu
Add a usage document for the 'rng' u-boot command. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V4: * Reflect the fact that a maximum of 64 bytes can be read on each invocation of the 'rng' command doc/usage/i

[PATCH v5 9/9] test: rng: Add a UT testcase for the rng command

2022-03-13 Thread Sughosh Ganu
The 'rng' command dumps a number of random bytes on the console. Add a set of tests for the 'rng' command. The test function performs basic sanity testing of the command. Since a unit test is being added for the command, enable it by default in the sandbox platforms. Signed-

Re: [PATCH v5 7/9] cmd: rng: Use a statically allocated array for random bytes

2022-03-14 Thread Sughosh Ganu
hi Simon, On Mon, 14 Mar 2022 at 03:53, Simon Glass wrote: > > Hi Sughosh, > > On Sun, 13 Mar 2022 at 08:49, Sughosh Ganu wrote: > > > > Use a statically allocated buffer on stack instead of using malloc for > > reading the random bytes. Using a local array is f

Re: [PATCH v5 3/9] tpm: rng: Add driver model interface for TPM RNG device

2022-03-14 Thread Sughosh Ganu
hi Simon, On Mon, 14 Mar 2022 at 03:53, Simon Glass wrote: > > Hi Sughosh, > > On Sun, 13 Mar 2022 at 08:48, Sughosh Ganu wrote: > > > > The TPM device has a builtin random number generator(RNG) > > functionality. Expose the RNG functions of the TPM device to the

Re: [PATCH v5 4/9] tpm: Add the RNG child device

2022-03-14 Thread Sughosh Ganu
hi Simon, On Mon, 14 Mar 2022 at 03:53, Simon Glass wrote: > > Hi Sughosh, > > On Sun, 13 Mar 2022 at 08:48, Sughosh Ganu wrote: > > > > The TPM device comes with the random number generator(RNG) > > functionality which is built into the TPM device. Add logic to a

Re: [PATCH v5 4/9] tpm: Add the RNG child device

2022-03-15 Thread Sughosh Ganu
hi Simon, On Mon, 14 Mar 2022 at 23:54, Simon Glass wrote: > > Hi Sughosh, > > On Mon, 14 Mar 2022 at 05:43, Sughosh Ganu wrote: > > > > hi Simon, > > > > On Mon, 14 Mar 2022 at 03:53, Simon Glass wrote: > > > > > > Hi Sughosh,

Re: [PATCH v5 3/9] tpm: rng: Add driver model interface for TPM RNG device

2022-03-15 Thread Sughosh Ganu
hi Simon, On Mon, 14 Mar 2022 at 23:55, Simon Glass wrote: > > Hi Sughosh, > > On Mon, 14 Mar 2022 at 05:39, Sughosh Ganu wrote: > > > > hi Simon, > > > > On Mon, 14 Mar 2022 at 03:53, Simon Glass wrote: > > > > > > Hi Sughosh,

Re: [PATCH V3 2/2] ARM: dts: rockchip: rk3588s-u-boot: Add rng node

2023-04-17 Thread Sughosh Ganu
On Thu, 13 Apr 2023 at 19:43, Chris Morgan wrote: > > From: Chris Morgan > > Add a node for the trng found on RK3588 SoCs. > > Changes in V3: > - Added Reviewed-By tag. > > Changes in V2: > - None > > Signed-off-by: Chris Morgan > Reviewed-by: Kever Yang > --- > arch/arm/dts/rk3588s-u-boot.d

Re: [PATCH V3 2/2] ARM: dts: rockchip: rk3588s-u-boot: Add rng node

2023-04-17 Thread Sughosh Ganu
On Tue, 18 Apr 2023 at 00:15, Chris Morgan wrote: > > On Mon, Apr 17, 2023 at 06:13:18PM +0530, Sughosh Ganu wrote: > > On Thu, 13 Apr 2023 at 19:43, Chris Morgan wrote: > > > > > > From: Chris Morgan > > > > > > Add a node for the trng

Re: [PATCH] dt/bindings: fwu-mdata-mtd: drop changes outside FWU

2023-05-04 Thread Sughosh Ganu
hi Ilias, On Thu, 4 May 2023 at 16:15, Ilias Apalodimas wrote: > > Hi Rob, > > On Wed, May 03, 2023 at 12:24:39PM -0500, Rob Herring wrote: > > On Wed, May 3, 2023 at 9:37 AM Ilias Apalodimas > > wrote: > > > > > > Hi Krzysztof, > > > > > > On Tue, Apr 11, 2023 at 07:38:11AM +0200, Krzysztof Koz

Re: [PATCH 1/1] fwu: fix config FWU_MULTI_BANK_UPDATE

2023-05-08 Thread Sughosh Ganu
ixes: 86794052418b ("FWU: Add support for the FWU Multi Bank Update feature") > Fixes: 023d9c93932c ("efi_loader: remove CONFIG_EFI_SETUP_EARLY") > Signed-off-by: Heinrich Schuchardt > --- > lib/fwu_updates/Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1 dele

Re: Proposal: U-Boot memory management

2024-06-06 Thread Sughosh Ganu
hi Simon, On Wed, 29 May 2024 at 22:00, Simon Glass wrote: > > +Sughosh Ganu for reference > > > On Sun, 31 Dec 2023 at 09:16, Tom Rini wrote: > > > > On Sun, Dec 31, 2023 at 04:40:06PM +0100, Heinrich Schuchardt wrote: > > > > > > > > &

[RFC PATCH 00/31] Make U-Boot memory reservations coherent

2024-06-07 Thread Sughosh Ganu
ommon code, there is obviously an increase in the size of the image, moreover since the LMB memory is now persistent, and the variables do not reside on the stack. I want to check if there can be ways of decreasing the size impact of the changes. Sughosh Ganu (31): lmb: remove the unused lmb_is

[RFC PATCH 01/31] lmb: remove the unused lmb_is_reserved() function

2024-06-07 Thread Sughosh Ganu
The lmb_is_reserved() API is not used. There is another API, lmb_is_reserved_flags() which can be used to check if a particular memory region is reserved. Remove the unused API. Signed-off-by: Sughosh Ganu --- include/lmb.h | 11 --- lib/lmb.c | 5 - 2 files changed, 16

[RFC PATCH 02/31] lmb: staticize __lmb_alloc_base()

2024-06-07 Thread Sughosh Ganu
The __lmb_alloc_base() function is only called from within the lmb module. Moreover, the lmb_alloc() and lmb_alloc_base() API's are good enough for the allocation API calls. Make the __lmb_alloc_base() function static. Signed-off-by: Sughosh Ganu --- include/lmb.h | 2 -- lib/lmb.c

[RFC PATCH 03/31] lmb: make the lmb reservations persistent

2024-06-07 Thread Sughosh Ganu
ff-by: Sughosh Ganu --- Note: @Mark Kettenis, please review the changes made in the apple dart driver. I have removed the driver-local LMB instance, but I am not sure if the current logic makes sense. I would think that it would be possible to simply use memory region allocated by the LMB module(

[RFC PATCH 05/31] lmb: pass a flag to image_setup_libfdt() for lmb reservations

2024-06-07 Thread Sughosh Ganu
the region occupied by the FDT blob is to be marked as reserved by the LMB module. Signed-off-by: Sughosh Ganu --- arch/mips/lib/bootm.c | 2 +- boot/image-board.c| 2 +- boot/image-fdt.c | 7 +++ cmd/elf.c | 2 +- include/image.h

[RFC PATCH 04/31] lmb: remove local instances of the lmb structure variable

2024-06-07 Thread Sughosh Ganu
With the move of the LMB structure to a persistent state, there is no need to declare the variable locally, and pass it as part of the LMB API's. Remove all local variable instances and change the API's correspondingly. Signed-off-by: Sughosh Ganu --- arch/arc/lib/cache.c

[RFC PATCH 06/31] lmb: reserve and add common memory regions post relocation

2024-06-07 Thread Sughosh Ganu
been relocated. Also add the rest of the memory that is available for allocations to the LMB's memory map. Signed-off-by: Sughosh Ganu --- common/board_r.c | 15 +++ include/lmb.h| 14 ++ lib/lmb.c| 14 +- 3 files changed, 42 insertions(+), 1 deletio

[RFC PATCH 07/31] lmb: remove lmb_init_and_reserve_range() function

2024-06-07 Thread Sughosh Ganu
With the move to make the LMB allocations persistent and the common memory regions being reserved during board init, the lmb_init_and_reserve_range() API can be replaced with a simple lmb_add() call. Signed-off-by: Sughosh Ganu --- boot/bootm.c | 2 +- include/lmb.h | 2 -- lib/lmb.c | 8

[RFC PATCH 08/31] lmb: replcace the lmb_init_and_reserve() function

2024-06-07 Thread Sughosh Ganu
-off-by: Sughosh Ganu --- arch/arm/mach-apple/board.c | 2 +- arch/arm/mach-snapdragon/board.c | 2 +- arch/arm/mach-stm32mp/stm32mp1/cpu.c | 2 +- cmd/bdinfo.c | 2 +- cmd/load.c | 2 +- fs/fs.c | 2

[RFC PATCH 09/31] lmb: allow for resizing lmb regions

2024-06-07 Thread Sughosh Ganu
this attribute would indicate that the region cannot be resized. Signed-off-by: Sughosh Ganu --- include/lmb.h | 1 + lib/lmb.c | 120 -- 2 files changed, 107 insertions(+), 14 deletions(-) diff --git a/include/lmb.h b/include/lmb.h

[RFC PATCH 10/31] event: add events to notify memory map changes

2024-06-07 Thread Sughosh Ganu
Add events which would be used for notifying changes in the respective modules' memory map. This is to be used for having a synchronous view of the memory that is currently in use, and that is available for allocations. Signed-off-by: Sughosh Ganu --- common/event.c | 4 include/ev

[RFC PATCH 11/31] lib: Kconfig: add a config symbol for getting memory map updates

2024-06-07 Thread Sughosh Ganu
Add a Kconfig symbol to enable getting updates on any memory map changes that might be done by some other module. This notification mechanism can then be used to have a synchronous view of allocated and free memory. Signed-off-by: Sughosh Ganu --- lib/Kconfig | 9 + 1 file changed, 9

[RFC PATCH 12/31] add a function to check if an address is in RAM memory

2024-06-07 Thread Sughosh Ganu
Add a function to check if a given address falls within the RAM address used by U-Boot. This will be used to notify other modules if the address gets allocated, so as to not get re-allocated by some other module. Signed-off-by: Sughosh Ganu --- arch/sandbox/cpu/cpu.c | 5 + common/board_r.c

[RFC PATCH 13/31] efi_memory: notify of any changes to the EFI memory map

2024-06-07 Thread Sughosh Ganu
s can then be used by the other module to allocate memory only from available regions, instead of overwriting already allocated memory. Signed-off-by: Sughosh Ganu --- lib/efi_loader/efi_memory.c | 25 + 1 file changed, 25 insertions(+) diff --git a/lib/efi_loader/efi_memor

[RFC PATCH 14/31] lmb: notify of any changes to the LMB memory map

2024-06-07 Thread Sughosh Ganu
s can then be used by the other module to allocate memory only from available regions, instead of overwriting already allocated memory. Signed-off-by: Sughosh Ganu --- lib/lmb.c | 49 +++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/l

[RFC PATCH 15/31] efi_memory: add an event handler to update memory map

2024-06-07 Thread Sughosh Ganu
: Sughosh Ganu --- lib/efi_loader/efi_memory.c | 70 ++--- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 435e580fb3..93244161b0 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib

[RFC PATCH 16/31] lmb: add an event handler to update memory map

2024-06-07 Thread Sughosh Ganu
ff-by: Sughosh Ganu --- lib/Kconfig | 1 + lib/lmb.c | 34 ++ 2 files changed, 35 insertions(+) diff --git a/lib/Kconfig b/lib/Kconfig index 9ea02ae006..9e465a748b 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -,6 +,7 @@ config LMB bool "Enable t

[RFC PATCH 17/31] lmb: remove call to efi_lmb_reserve()

2024-06-07 Thread Sughosh Ganu
The changes in the EFI memory map are now notified to the LMB module. There is therefore no need to explicitly get the efi memory map and set aside the EFI allocated memory. Signed-off-by: Sughosh Ganu --- lib/lmb.c | 35 --- 1 file changed, 35 deletions(-) diff

[RFC PATCH 18/31] sandbox: iommu: remove lmb allocation in the driver

2024-06-07 Thread Sughosh Ganu
memory range has other side effects. On the other hand, the sandbox iommu test expects to see this particular value of the DVA. Use the DVA address directly, instead of mapping it in the LMB memory map, and then have it allocated. Signed-off-by: Sughosh Ganu --- drivers/iommu/sandbox_iommu.c | 7

[RFC PATCH 19/31] zynq: lmb: do not add to lmb map before relocation

2024-06-07 Thread Sughosh Ganu
The LMB memory is typically not needed very early in the platform's boot. Do not add memory to the LMB map before relocation. Reservation of common areas and adding of memory is done after relocation. Signed-off-by: Sughosh Ganu --- board/xilinx/common/board.c

[RFC PATCH 20/31] test: cedit: use allocated address for reading file

2024-06-07 Thread Sughosh Ganu
read the file to that address. Signed-off-by: Sughosh Ganu --- test/boot/cedit.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/boot/cedit.c b/test/boot/cedit.c index aa41719048..1f4147da89 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -8,6 +8,7

[RFC PATCH 21/31] test: event: update the expected event dump output

2024-06-07 Thread Sughosh Ganu
With the addition of two events for notification of any changes to memory that is occupied and is free, the output of the event_dump.py script has changed. Update the expected event log to incorporate this change. Signed-off-by: Sughosh Ganu --- test/py/tests/test_event_dump.py | 2 ++ 1 file

[RFC PATCH 22/31] test: lmb: run the LMB tests only on sandbox

2024-06-07 Thread Sughosh Ganu
tests. Signed-off-by: Sughosh Ganu --- test/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lib/Makefile b/test/lib/Makefile index e75a263e6a..9154e07993 100644 --- a/test/lib/Makefile +++ b/test/lib/Makefile @@ -9,7 +9,7 @@ obj-$(CONFIG_EFI_LOADER

[RFC PATCH 23/31] test: lmb: initialise the lmb structure before tests

2024-06-07 Thread Sughosh Ganu
every test. Signed-off-by: Sughosh Ganu --- include/lmb.h | 4 lib/lmb.c | 17 + test/lib/lmb.c | 18 ++ 3 files changed, 39 insertions(+) diff --git a/include/lmb.h b/include/lmb.h index 1d4cd255d2..08ece0a90b 100644 --- a/include/lmb.h +++ b/include

[RFC PATCH 24/31] test: lmb: add a test case for checking overlapping region add

2024-06-07 Thread Sughosh Ganu
Memory managed by LMB is now persistent and global. With that, it could be possible for multiple callers to try to add memory that has already been added. Add a test case to check that the LMB module handles it as expected. Signed-off-by: Sughosh Ganu --- test/lib/lmb.c | 16 1

[RFC PATCH 25/31] test: lmb: adjust the test case to handle overlapping regions

2024-06-07 Thread Sughosh Ganu
The LMB code can now accept reserving and adding overlapping regions of memory. Adjust the test for checking the reservation of overlapping memory regions to work with this corresponding change in the LMB code. Signed-off-by: Sughosh Ganu --- test/lib/lmb.c | 8 1 file changed, 4

[RFC PATCH 26/31] test: lmb: run lmb tests only manually

2024-06-07 Thread Sughosh Ganu
suite, and thus would not interfere with the running of the rest of the tests. Signed-off-by: Sughosh Ganu --- test/lib/lmb.c | 49 - 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/test/lib/lmb.c b/test/lib/lmb.c index 67a6be5bc3..813f7

[RFC PATCH 27/31] test: bdinfo: dump the global LMB memory map

2024-06-07 Thread Sughosh Ganu
The LMB code has been changed to make the memory reservations persistent and global. Make corresponding change the the lmb_test_dump_all() function to print the global LMB added and reserved memory. Signed-off-by: Sughosh Ganu --- test/cmd/bdinfo.c | 12 ++-- 1 file changed, 6

[RFC PATCH 28/31] cmd: bdinfo: only dump the current LMB memory

2024-06-07 Thread Sughosh Ganu
The LMB memory map is now persistent and global. There is therefore no need to add memory to the LMB memory map as part of the bdinfo command. Only dump the current available and reserved memory as part of the bdinfo command. Signed-off-by: Sughosh Ganu --- cmd/bdinfo.c | 1 - 1 file changed, 1

[RFC PATCH 29/31] temp: mx6sabresd: bump up the size limit of the board

2024-06-07 Thread Sughosh Ganu
With the changes to add notifications for any changes to the LMB map, the size of the image exceeds the limit set. Bump up the image size limit for now to get the platform to build. This is not for committing. Signed-off-by: Sughosh Ganu --- Note: @Fabio Estevam, please check if it would be

[RFC PATCH 30/31] temp: cmd: efi_mem: add a command to test efi alloc/free

2024-06-07 Thread Sughosh Ganu
Not for committing. Signed-off-by: Sughosh Ganu --- cmd/Makefile | 1 + cmd/efi_memory.c | 155 +++ 2 files changed, 156 insertions(+) create mode 100644 cmd/efi_memory.c diff --git a/cmd/Makefile b/cmd/Makefile index 87133cc27a..35fcc4af5a

[RFC PATCH 31/31] temp: cmd: efi: add a command to dump EFI memory map

2024-06-07 Thread Sughosh Ganu
Add a command to dump the EFI memory map. Not for committing. Signed-off-by: Sughosh Ganu --- cmd/Makefile| 1 + cmd/efi_map_dump.c | 28 include/efi_loader.h| 2 ++ lib/efi_loader/efi_memory.c | 32

Re: [RFC PATCH 26/31] test: lmb: run lmb tests only manually

2024-06-09 Thread Sughosh Ganu
On Sat, 8 Jun 2024 at 10:09, Heinrich Schuchardt wrote: > > On 6/7/24 20:52, Sughosh Ganu wrote: > > The LMB code has been changed so that the memory reservations and > > allocations are now persistent and global. With this change, the > > design of the LMB tests needs t

Re: [RFC PATCH 30/31] temp: cmd: efi_mem: add a command to test efi alloc/free

2024-06-09 Thread Sughosh Ganu
On Sat, 8 Jun 2024 at 09:07, Heinrich Schuchardt wrote: > > > > Am 7. Juni 2024 20:52:39 MESZ schrieb Sughosh Ganu : > >Not for committing. > > Best put "DON'T MERGE" into the title to avoid mishaps in future versions. Will do. > > In the final

Re: [RFC PATCH 31/31] temp: cmd: efi: add a command to dump EFI memory map

2024-06-09 Thread Sughosh Ganu
On Sat, 8 Jun 2024 at 09:03, Heinrich Schuchardt wrote: > > > > Am 7. Juni 2024 20:52:40 MESZ schrieb Sughosh Ganu : > >Add a command to dump the EFI memory map. > > What are you missing in 'efidebug memmap'? Nothing. I wasn't aware of this sub-command

Re: [RFC PATCH 11/31] lib: Kconfig: add a config symbol for getting memory map updates

2024-06-10 Thread Sughosh Ganu
hi Ilias, On Mon, 10 Jun 2024 at 17:15, Ilias Apalodimas wrote: > > On Fri, 7 Jun 2024 at 21:54, Sughosh Ganu wrote: > > > > Add a Kconfig symbol to enable getting updates on any memory map > > changes that might be done by some other module. This notification > >

Re: [RFC PATCH 09/31] lmb: allow for resizing lmb regions

2024-06-10 Thread Sughosh Ganu
hi Ilias, On Mon, 10 Jun 2024 at 17:34, Ilias Apalodimas wrote: > > Hi Sughosh > > > On Fri, 7 Jun 2024 at 21:54, Sughosh Ganu wrote: > > > > Allow for resizing of LMB regions if the region attributes match. The > > current code returns a failure status on det

Re: [RFC PATCH 15/31] efi_memory: add an event handler to update memory map

2024-06-10 Thread Sughosh Ganu
On Mon, 10 Jun 2024 at 17:40, Ilias Apalodimas wrote: > > On Fri, 7 Jun 2024 at 21:54, Sughosh Ganu wrote: > > > > There are events that would be used to notify other interested modules > > of any changes in available and occupied memory. This would happen > > when

Re: [RFC PATCH 09/31] lmb: allow for resizing lmb regions

2024-06-10 Thread Sughosh Ganu
On Mon, 10 Jun 2024 at 18:17, Ilias Apalodimas wrote: > > On Mon, 10 Jun 2024 at 15:20, Sughosh Ganu wrote: > > > > hi Ilias, > > > > On Mon, 10 Jun 2024 at 17:34, Ilias Apalodimas > > wrote: > > > > > > Hi Sughosh > > &g

Re: [RFC PATCH 09/31] lmb: allow for resizing lmb regions

2024-06-10 Thread Sughosh Ganu
On Mon, 10 Jun 2024 at 18:29, Heinrich Schuchardt wrote: > > On 10.06.24 14:20, Sughosh Ganu wrote: > > hi Ilias, > > > > On Mon, 10 Jun 2024 at 17:34, Ilias Apalodimas > > wrote: > >> > >> Hi Sughosh > >> > >> > >> On Fr

Re: [RFC PATCH 09/31] lmb: allow for resizing lmb regions

2024-06-10 Thread Sughosh Ganu
hi Ilias, On Mon, 10 Jun 2024 at 19:52, Ilias Apalodimas wrote: > > Hi Sughosh > > On Mon, 10 Jun 2024 at 15:57, Sughosh Ganu wrote: > > > > On Mon, 10 Jun 2024 at 18:17, Ilias Apalodimas > > wrote: > > > > > > On Mon, 10 Jun 2024 at 15:20, Sugh

Re: Proposal: U-Boot memory management

2024-06-10 Thread Sughosh Ganu
hi Simon, On Mon, 10 Jun 2024 at 19:25, Simon Glass wrote: > > Hi Sughosh, > > On Thu, 6 Jun 2024 at 13:18, Sughosh Ganu wrote: > > > > hi Simon, > > > > On Wed, 29 May 2024 at 22:00, Simon Glass wrote: > > > > > > +Sughosh Ganu for referen

Re: [RFC PATCH 15/31] efi_memory: add an event handler to update memory map

2024-06-10 Thread Sughosh Ganu
hi Ilias, On Mon, 10 Jun 2024 at 19:48, Ilias Apalodimas wrote: > > Hi Sughosh > > On Mon, 10 Jun 2024 at 15:25, Sughosh Ganu wrote: > > > > On Mon, 10 Jun 2024 at 17:40, Ilias Apalodimas > > wrote: > > > > > > On Fri, 7 Jun 2024 at 21:54, Sugho

Re: [RFC PATCH 15/31] efi_memory: add an event handler to update memory map

2024-06-10 Thread Sughosh Ganu
On Mon, 10 Jun 2024 at 20:22, Sughosh Ganu wrote: > > hi Ilias, > > On Mon, 10 Jun 2024 at 19:48, Ilias Apalodimas > wrote: > > > > Hi Sughosh > > > > On Mon, 10 Jun 2024 at 15:25, Sughosh Ganu wrote: > > > > > > On Mon, 10 Jun 2024 at

Re: Proposal: U-Boot memory management

2024-06-10 Thread Sughosh Ganu
hi Simon, On Mon, 10 Jun 2024 at 20:33, Simon Glass wrote: > > Hi Sughosh, > > On Mon, 10 Jun 2024 at 08:40, Sughosh Ganu wrote: > > > > hi Simon, > > > > On Mon, 10 Jun 2024 at 19:25, Simon Glass wrote: > > > > > > Hi Sughosh, > &

Re: [RFC PATCH 15/31] efi_memory: add an event handler to update memory map

2024-06-10 Thread Sughosh Ganu
On Mon, 10 Jun 2024 at 20:47, Heinrich Schuchardt wrote: > > On 07.06.24 20:52, Sughosh Ganu wrote: > > There are events that would be used to notify other interested modules > > of any changes in available and occupied memory. This would happen > > when a module allocate

Re: [RFC PATCH 08/31] lmb: replcace the lmb_init_and_reserve() function

2024-06-11 Thread Sughosh Ganu
On Mon, 10 Jun 2024 at 23:01, Tom Rini wrote: > > On Sat, Jun 08, 2024 at 12:22:17AM +0530, Sughosh Ganu wrote: > > With the changes to make the Logical Memory Block(LMB) allocations > > persistent and with the common memory regions being reserved during > > board init,

Re: [RFC PATCH 22/31] test: lmb: run the LMB tests only on sandbox

2024-06-11 Thread Sughosh Ganu
On Mon, 10 Jun 2024 at 23:14, Tom Rini wrote: > > On Sat, Jun 08, 2024 at 12:22:31AM +0530, Sughosh Ganu wrote: > > > The LMB memory map is now persistent and global. Running the tests for > > the LMB module will result in the memory map getting reset, and this > > wi

Re: [RFC PATCH 00/31] Make U-Boot memory reservations coherent

2024-06-11 Thread Sughosh Ganu
On Tue, 11 Jun 2024 at 02:35, Tom Rini wrote: > > On Sat, Jun 08, 2024 at 12:22:09AM +0530, Sughosh Ganu wrote: > > > The aim of this patch series is to fix the current state of > > incoherence between modules when it comes to memory usage. The primary > > issue that t

Re: [RFC PATCH 17/31] lmb: remove call to efi_lmb_reserve()

2024-06-11 Thread Sughosh Ganu
On Tue, 11 Jun 2024 at 14:42, Heinrich Schuchardt wrote: > > On 07.06.24 20:52, Sughosh Ganu wrote: > > The changes in the EFI memory map are now notified to the LMB > > module. There is therefore no need to explicitly get the efi memory > > map and set aside

Re: [RFC PATCH 09/31] lmb: allow for resizing lmb regions

2024-06-11 Thread Sughosh Ganu
On Tue, 11 Jun 2024 at 14:47, Heinrich Schuchardt wrote: > > On 07.06.24 20:52, Sughosh Ganu wrote: > > Allow for resizing of LMB regions if the region attributes match. The > > current code returns a failure status on detecting an overlapping > > address. This worked up

Re: [RFC PATCH 22/31] test: lmb: run the LMB tests only on sandbox

2024-06-11 Thread Sughosh Ganu
On Tue, 11 Jun 2024 at 15:31, Heinrich Schuchardt wrote: > > On 11.06.24 10:55, Sughosh Ganu wrote: > > On Mon, 10 Jun 2024 at 23:14, Tom Rini wrote: > >> > >> On Sat, Jun 08, 2024 at 12:22:31AM +0530, Sughosh Ganu wrote: > >> > >>> The LMB m

Re: [RFC PATCH 15/31] efi_memory: add an event handler to update memory map

2024-06-11 Thread Sughosh Ganu
On Tue, 11 Jun 2024 at 15:47, Heinrich Schuchardt wrote: > > On 07.06.24 20:52, Sughosh Ganu wrote: > > There are events that would be used to notify other interested modules > > of any changes in available and occupied memory. This would happen > > when a module allocate

Re: [RFC PATCH 15/31] efi_memory: add an event handler to update memory map

2024-06-11 Thread Sughosh Ganu
hi Ilias, On Wed, 12 Jun 2024 at 11:19, Ilias Apalodimas wrote: > > [...] > > > > > > > > > > + struct event_lmb_map_update *lmb_map = > > > > > > > > > &event->data.lmb_map; > > > > > > > > > + > > > > > > > > > + addr = (uintptr_t)map_sysmem(lmb_map->base, 0); > > > > > > > > > + pages =

Re: [RFC PATCH 15/31] efi_memory: add an event handler to update memory map

2024-06-12 Thread Sughosh Ganu
On Wed, 12 Jun 2024 at 12:16, Ilias Apalodimas wrote: > > On Mon, 10 Jun 2024 at 18:54, Simon Glass wrote: > > > > Hi, > > > > On Mon, 10 Jun 2024 at 09:42, Sughosh Ganu wrote: > > > > > > On Mon, 10 Jun 2024 at 20:47, Heinrich Schuchardt

Re: [RFC PATCH 04/31] lmb: remove local instances of the lmb structure variable

2024-06-13 Thread Sughosh Ganu
On Thu, 13 Jun 2024 at 22:57, Heinrich Schuchardt wrote: > > On 13.06.24 18:59, Simon Glass wrote: > > Hi Tom, > > > > On Thu, 13 Jun 2024 at 09:42, Tom Rini wrote: > >> > >> On Thu, Jun 13, 2024 at 09:22:15AM -0600, Simon Glass wrote: > >>> Hi Tom, > >>> > >>> On Wed, 12 Jun 2024 at 15:40, Tom R

Re: [PATCH v3 07/18] binman: Keep the efi_capsule input file

2024-06-20 Thread Sughosh Ganu
11b27a ("binman: capsule: Add support for generating...") > --- Acked-by: Sughosh Ganu Although I don't think this warrants a Fixes tag. It is not fixing any issue as such. -sughosh > > (no changes since v1) > > tools/binman/etype/efi_capsule.py | 1 - > 1 file c

[RFC PATCH v2 00/48] Make U-Boot memory reservations coherent

2024-07-04 Thread Sughosh Ganu
ial case with str_to_list() alist: Add support for an allocated pointer list lib: Convert str_to_list() to use alist Sughosh Ganu (44): alist: add a couple of helper functions alist: add a function declaration for alist_expand_by() lmb: remove the unused lmb_is_reserved() function lmb: s

[RFC PATCH v2 01/48] malloc: Support testing with realloc()

2024-07-04 Thread Sughosh Ganu
From: Simon Glass At present in tests it is possible to cause an out-of-memory condition with malloc() but not realloc(). Add support to realloc() too, so code which uses that function can be tested. Signed-off-by: Simon Glass Signed-off-by: Sughosh Ganu --- common/dlmalloc.c | 4 1

[RFC PATCH v2 02/48] lib: Handle a special case with str_to_list()

2024-07-04 Thread Sughosh Ganu
From: Simon Glass The current implementation can return an extra result at the end when the string ends with a space. Fix this by adding a special case. Signed-off-by: Simon Glass Signed-off-by: Sughosh Ganu --- lib/strto.c | 4 +++- test/str_ut.c | 4 +--- 2 files changed, 4 insertions

[RFC PATCH v2 03/48] alist: Add support for an allocated pointer list

2024-07-04 Thread Sughosh Ganu
the code. Introduce a new data structure, which is a variable-sized list of structs each of the same, pre-set size. It provides O(1) access and is reasonably efficient at expanding linearly, since it doubles in size when it runs out of space. Signed-off-by: Simon Glass Signed-off-by: Sughosh Ganu

[RFC PATCH v2 04/48] lib: Convert str_to_list() to use alist

2024-07-04 Thread Sughosh Ganu
From: Simon Glass Use this new data structure in the utility function. Signed-off-by: Simon Glass Signed-off-by: Sughosh Ganu --- lib/strto.c | 35 +++ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/strto.c b/lib/strto.c index f83ac67c66

[RFC PATCH v2 05/48] alist: add a couple of helper functions

2024-07-04 Thread Sughosh Ganu
Add a couple of helper functions to detect an empty and full alist. Signed-off-by: Sughosh Ganu --- Changes since V1: New patch include/alist.h | 22 ++ 1 file changed, 22 insertions(+) diff --git a/include/alist.h b/include/alist.h index a68afc9fff..bab146c35d 100644

[RFC PATCH v2 06/48] alist: add a function declaration for alist_expand_by()

2024-07-04 Thread Sughosh Ganu
The alist_expand_by() function is a global function. Add a declaration for the function in the header. Signed-off-by: Sughosh Ganu --- Changes since V1: New patch include/alist.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/alist.h b/include/alist.h index bab146c35d

[RFC PATCH v2 07/48] lmb: remove the unused lmb_is_reserved() function

2024-07-04 Thread Sughosh Ganu
The lmb_is_reserved() API is not used. There is another API, lmb_is_reserved_flags() which can be used to check if a particular memory region is reserved. Remove the unused API. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas --- Changes since V1: None include/lmb.h | 11

[RFC PATCH v2 08/48] lmb: staticize __lmb_alloc_base()

2024-07-04 Thread Sughosh Ganu
The __lmb_alloc_base() function is only called from within the lmb module. Moreover, the lmb_alloc() and lmb_alloc_base() API's are good enough for the allocation API calls. Make the __lmb_alloc_base() function static. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas --- Changes

[RFC PATCH v2 09/48] lmb: remove call to lmb_init()

2024-07-04 Thread Sughosh Ganu
The LMB module will be changed to have persistent and global memory maps of available and used memory. With this change, there won't be any need to explicitly initialise the LMB memory maps. Remove the call to the lmb_init() function. Signed-off-by: Sughosh Ganu --- Changes since V1: New

[RFC PATCH v2 10/48] lmb: remove local instances of the lmb structure variable

2024-07-04 Thread Sughosh Ganu
With the move of the LMB structure to a persistent state, there is no need to declare the variable locally, and pass it as part of the LMB API's. Remove all local variable instances and change the API's correspondingly. Signed-off-by: Sughosh Ganu --- Changes since V1: None ar

[RFC PATCH v2 11/48] lmb: pass a flag to image_setup_libfdt() for lmb reservations

2024-07-04 Thread Sughosh Ganu
the region occupied by the FDT blob is to be marked as reserved by the LMB module. Signed-off-by: Sughosh Ganu --- Changes since V1: * Use true/false identifiers for bool instead of 1/0 * Fix the argument passed to the function in arch/mips/lib/bootm.c arch/mips/lib/bootm.c | 2 +- boot

[RFC PATCH v2 12/48] lmb: allow for resizing lmb regions

2024-07-04 Thread Sughosh Ganu
this attribute would indicate that the region cannot be resized. Signed-off-by: Sughosh Ganu --- Changes since V1: * Do the check for the region flags in lmb_resize_regions() and lmb_merge_overlap_regions() to decide on merging the overlapping regions. include/lmb.h | 1 + lib/lmb.c

[RFC PATCH v2 13/48] lmb: make LMB memory map persistent and global

2024-07-04 Thread Sughosh Ganu
e for the available(free) memory, and one for the used memory. Once full, the list can then be extended at runtime. Signed-off-by: Sughosh Ganu --- Changes since V1: * Use alloced list structure for the available and reserved memory lists instead of static arrays. * Corresponding changes in the

[RFC PATCH v2 14/48] lmb: remove config symbols used for lmb region count

2024-07-04 Thread Sughosh Ganu
the earlier implementation of static arrays. Signed-off-by: Sughosh Ganu --- Changes since V1: New patch configs/a3y17lte_defconfig | 1 - configs/a5y17lte_defconfig | 1 - configs/a7y17lte_defconfig | 1 - configs/apple_m1_defconfig | 1 - configs

[RFC PATCH v2 15/48] test: lmb: remove the test for max regions

2024-07-04 Thread Sughosh Ganu
The LMB memory map is now persistent and global, and the CONFIG_LMB_USE_MAX_REGIONS config symbol has now been removed. Remove the corresponding lmb test case. Signed-off-by: Sughosh Ganu --- Changes since V1: New patch test/lib/lmb.c | 67 -- 1

[RFC PATCH v2 16/48] lmb: config: add lmb config symbols for SPL

2024-07-04 Thread Sughosh Ganu
heap in SPL. Signed-off-by: Sughosh Ganu --- Changes since V1: New patch lib/Kconfig | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Kconfig b/lib/Kconfig index 072ed0ecfa..7eea517b3b 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -1103,7 +1103,17 @@ config

[RFC PATCH v2 17/48] lmb: allow lmb module to be used in SPL

2024-07-04 Thread Sughosh Ganu
With the introduction of separate config symbols for the SPL phase of U-Boot, the condition checks need to be tweaked so that platforms that enable the LMB module in SPL are also able to call the LMB API's. Use the appropriate condition checks to achieve this. Signed-off-by: Sughosh

[RFC PATCH v2 18/48] lmb: introduce a function to add memory to the lmb memory map

2024-07-04 Thread Sughosh Ganu
Introduce a function lmb_add_memory() to add available memory to the LMB memory map. Call this function during board init once the LMB data structures have been initialised. Signed-off-by: Sughosh Ganu --- Changes since V1: * Add memory only till ram_top to the LMB memory map, instead of all

[RFC PATCH v2 19/48] lmb: remove the lmb_init_and_reserve() function

2024-07-04 Thread Sughosh Ganu
With the changes to make the LMB reservations persistent, the common memory regions are being added during board init. Remove the now superfluous lmb_init_and_reserve() function. Signed-off-by: Sughosh Ganu --- Changes since V1: * Removed the replacement of lmb_init_and_reserve() with

[RFC PATCH v2 20/48] lmb: reserve common areas during board init

2024-07-04 Thread Sughosh Ganu
n the board's DTB. Mark these regions of memory with the LMB_NOOVERWRITE flag to indicate that these regions cannot be re-requested or overwritten. Signed-off-by: Sughosh Ganu --- Changes since V1: * Mark the reserved regions as LMB_NOOVERWRITE. * Call the lmb_reserve_common() function in U-B

[RFC PATCH v2 21/48] lmb: remove lmb_init_and_reserve_range() function

2024-07-04 Thread Sughosh Ganu
With the move to make the LMB allocations persistent and the common memory regions being reserved during board init, there is no need for an explicit reservation of a memory range. Remove the lmb_init_and_reserve_range() function. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas

[RFC PATCH v2 22/48] lmb: init: initialise the lmb data structures during board init

2024-07-04 Thread Sughosh Ganu
the board init. Signed-off-by: Sughosh Ganu --- Changes since V1: * Initialise the lmb structures as part of board init. * Initialise the lmb structure durint SPL init when enabled. common/board_r.c | 4 common/spl/spl.c | 4 include/lmb.h| 11 +++ lib/lmb.c| 20

[RFC PATCH v2 23/48] lmb: use the BIT macro for lmb flags

2024-07-04 Thread Sughosh Ganu
Use the BIT macro for assigning values to the LMB flags instead of assigning random values to them. Signed-off-by: Sughosh Ganu --- Changes since V1: New patch based on review comment from Heinrich include/lmb.h | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include

<    7   8   9   10   11   12   13   14   15   16   >