mbox series

[00/16] Make EFI memory allocations synchronous with LMB

Message ID 20240905082811.1585467-1-sughosh.ganu@linaro.org
Headers show
Series Make EFI memory allocations synchronous with LMB | expand

Message

Sughosh Ganu Sept. 5, 2024, 8:27 a.m. UTC
This is part two of the series to have the EFI and LMB modules have a
coherent view of memory. Part one of this goal was to change the LMB
module to have a global and persistent memory map. Those patches have
now been applied to the next branch.

These patches are changing the EFI memory allocation API's such that
they rely on the LMB module to allocate RAM memory. This fixes the
current scenario where the EFI memory module has no visibility of the
allocations/reservations made by the LMB module. One thing to note
here is that this is limited to the RAM memory region, i.e. the
EFI_CONVENTIONAL_MEMORY type. Any other memory type that is to be
added to the EFI memory map, still gets handled by the EFI memory
module.

Note: To be applied on top of the next branch.


Sughosh Ganu (16):
  lmb: add versions of the lmb API with flags
  lmb: add a flag to allow suppressing memory map change notification
  efi: memory: use the lmb API's for allocating and freeing memory
  event: add event to notify lmb memory map changes
  lib: Kconfig: add a config symbol for getting lmb memory map updates
  add a function to check if an address is in RAM memory
  lmb: notify of any changes to the LMB memory map
  efi_memory: add an event handler to update memory map
  ti: k3: remove efi_add_known_memory() function definition
  stm32mp: remove efi_add_known_memory() function definition
  lmb: allow for boards to specify memory map
  layerscape: use the lmb API's to add RAM memory
  x86: e820: use the lmb API for adding RAM memory
  efi_memory: do not add RAM memory to the memory map
  lmb: remove call to efi_lmb_reserve()
  test: event: update the expected event dump output

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c |   8 +-
 arch/arm/mach-k3/common.c               |  11 --
 arch/arm/mach-stm32mp/dram_init.c       |  11 --
 arch/x86/lib/e820.c                     |  47 ++++--
 common/board_r.c                        |   5 +
 common/event.c                          |   2 +
 include/efi_loader.h                    |  12 +-
 include/event.h                         |  14 ++
 include/lmb.h                           |  11 ++
 lib/Kconfig                             |  30 ++++
 lib/efi_loader/Kconfig                  |   3 +
 lib/efi_loader/efi_memory.c             | 184 ++++++++----------------
 lib/lmb.c                               | 146 +++++++++++++------
 test/py/tests/test_event_dump.py        |   1 +
 14 files changed, 276 insertions(+), 209 deletions(-)

Comments

Heinrich Schuchardt Sept. 14, 2024, 3:17 p.m. UTC | #1
On 9/5/24 10:27, Sughosh Ganu wrote:
>
> This is part two of the series to have the EFI and LMB modules have a
> coherent view of memory. Part one of this goal was to change the LMB
> module to have a global and persistent memory map. Those patches have
> now been applied to the next branch.

We should have only one memory map. This will ensure synchronicity.

Implementing the ARM64 requirement that 4 KiB pages with conflicting
memory attributes cannot be located in the same 64 KiB cannot be
reasonably implemented with the concept presented in this patch series.

Events should only be used to signal EFI_EVENT_GROUP_MEMORY_MAP_CHANGE.

Best regards

Heinrich

>
> These patches are changing the EFI memory allocation API's such that
> they rely on the LMB module to allocate RAM memory. This fixes the
> current scenario where the EFI memory module has no visibility of the
> allocations/reservations made by the LMB module. One thing to note
> here is that this is limited to the RAM memory region, i.e. the
> EFI_CONVENTIONAL_MEMORY type. Any other memory type that is to be
> added to the EFI memory map, still gets handled by the EFI memory
> module.
>
> Note: To be applied on top of the next branch.
>
>
> Sughosh Ganu (16):
>    lmb: add versions of the lmb API with flags
>    lmb: add a flag to allow suppressing memory map change notification
>    efi: memory: use the lmb API's for allocating and freeing memory
>    event: add event to notify lmb memory map changes
>    lib: Kconfig: add a config symbol for getting lmb memory map updates
>    add a function to check if an address is in RAM memory
>    lmb: notify of any changes to the LMB memory map
>    efi_memory: add an event handler to update memory map
>    ti: k3: remove efi_add_known_memory() function definition
>    stm32mp: remove efi_add_known_memory() function definition
>    lmb: allow for boards to specify memory map
>    layerscape: use the lmb API's to add RAM memory
>    x86: e820: use the lmb API for adding RAM memory
>    efi_memory: do not add RAM memory to the memory map
>    lmb: remove call to efi_lmb_reserve()
>    test: event: update the expected event dump output
>
>   arch/arm/cpu/armv8/fsl-layerscape/cpu.c |   8 +-
>   arch/arm/mach-k3/common.c               |  11 --
>   arch/arm/mach-stm32mp/dram_init.c       |  11 --
>   arch/x86/lib/e820.c                     |  47 ++++--
>   common/board_r.c                        |   5 +
>   common/event.c                          |   2 +
>   include/efi_loader.h                    |  12 +-
>   include/event.h                         |  14 ++
>   include/lmb.h                           |  11 ++
>   lib/Kconfig                             |  30 ++++
>   lib/efi_loader/Kconfig                  |   3 +
>   lib/efi_loader/efi_memory.c             | 184 ++++++++----------------
>   lib/lmb.c                               | 146 +++++++++++++------
>   test/py/tests/test_event_dump.py        |   1 +
>   14 files changed, 276 insertions(+), 209 deletions(-)
>