All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: "U-Boot Mailing List" <u-boot@lists.denx.de>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"AKASHI Takahiro" <akashi.tkhro@gmail.com>,
	"Caleb Connolly" <caleb.connolly@linaro.org>,
	"Janne Grunau" <j@jannau.net>,
	"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
	"Mark Kettenis" <kettenis@openbsd.org>,
	"Masahisa Kojima" <kojima.masahisa@socionext.com>,
	"Matthias Brugger" <mbrugger@suse.com>,
	"Moritz Fischer" <moritzf@google.com>,
	"Patrick Wildt" <pwildt@google.com>,
	"Peng Fan" <peng.fan@nxp.com>,
	"Peter Robinson" <pbrobinson@gmail.com>,
	"Rasmus Villemoes" <rasmus.villemoes@prevas.dk>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Sam Edwards" <CFSworks@gmail.com>, "Stefan Roese" <sr@denx.de>,
	"Sughosh Ganu" <sughosh.ganu@linaro.org>,
	"Tom Rini" <trini@konsulko.com>,
	"Vincent Stehlé" <vincent.stehle@arm.com>
Subject: Re: [PATCH v4 00/25] efi: Tidy up confusion between pointers and addresses
Date: Wed, 4 Dec 2024 16:46:37 +0200	[thread overview]
Message-ID: <Z1BrTaDcP0Aqk0Ym@hera> (raw)
In-Reply-To: <20241201152505.1666789-1-sjg@chromium.org>

Hi Simon,

On Sun, Dec 01, 2024 at 08:24:19AM -0700, Simon Glass wrote:
> The EFI-loader implementation converts things back and forth between
> addresses and pointers, with not much consistency in how this is done.
>
> Within most of U-Boot a pointer is a void * and an address is a ulong
>
> This convention is very helpful, since it is obvious in common code as
> to whether you need to call map_sysmem() and friends, or not.
>
> As part of cleaning up the EFI memory-management, I found it almost
> impossible to know in some cases whether something is an address or a
> pointer. I decided to give up on that and come back to it when this is
> resolved.
>
> This series starts applying the normal ulong/void * convention to the
> EFI_loader code, so making things easier to follow. For now, u64 is
> often used instead of ulong, but the effect is the same.
>
> The main changes are:
> - Rather than using the external struct efi_mem_desc data-structure for
>   internal bookkeeping, create a new one, so it can have different
>   semantics
> - Within efi_memory.c addresses are used, rather than addresses
>   masquerading as pointers. The conversions are done in efi_boottime
>
> Link: https://lore.kernel.org/u-boot/20240725135629.3505072-1-sjg@chromium.org/

In v3 I did ask you to run SCT and spent some time on IRC to explain how to
run it.
The existing code passes all tests related to memory allocations.
This patch introduced 99 failures in MemoryAllocationServicesTest.
Apart from all the other feedback, SCT must pass.

Thanks
/Ilias

>
> Changes in v4:
> - Add new patch to show the address for pool allocations
> - Combine the various pointer-to-address patches into one
>
> Changes in v3:
> - Adjust comments
> - Show the returned address rather than the pointer
> - Put the header-file in its own section
> - Add comment to struct efi_device_path_memory
> - Use a pointer for the values in struct efi_device_path_memory
>
> Changes in v2:
> - Fix missing @
> - Note that this holds pointers, not addresses
> - Add a new patch with comments where incorrect addresses are used
> - Use EFI_PRINT() instead of log_debug()
> - Rebase on early patch
> - Add new patch to add the EFI-loader API documentation
> - Drop the changes to the boottime API
> - Add new patch to use a separate stuct for memory nodes
> - Drop patch 'Convert efi_get_memory_map() to return pointers'
> - Drop patch 'efi_loader: Make more use of ulong'
> - Significantly expand and redirect the series
>
> Simon Glass (25):
>   efi: Define fields in struct efi_mem_desc
>   efi_loader: Fix typos in enum efi_allocate_type
>   efi_loader: Drop extra brackets in efi_mem_carve_out()
>   efi_loader: Add comments where incorrect addresses are used
>   efi_loader: Show the resulting memory address from an alloc
>   efi_loader: Update startimage_exit self-test to check error
>   efi_loader: Move some memory-function comments to header
>   doc: efi: Add the EFI-loader API documentation
>   efi_loader: Use the enum for memory type
>   efi_loader: Use a separate struct for memory nodes
>   efi_loader: Drop virtual_start from priv_mem_desc
>   efi_loader: Drop reserved from priv_mem_desc
>   efi_loader: Use the enum for the memory type in priv_mem_desc
>   efi_loader: Avoid assigning desc in efi_mem_carve_out()
>   efi_loader: Move struct efi_mem_list fields together
>   efi_loader: Rename struct efi_mem_list to mem_node
>   efi_loader: Rename physical_start to base
>   efi_loader: Use correct type in efi_add_runtime_mmio()
>   efi_loader: Show the address for pool allocations
>   efi_loader: Don't try to add sandbox runtime code
>   efi_loader: Update to use addresses internally
>   efi_loader: Correct address-usage in copy_fdt()
>   efi_loader: Drop comments about incorrect addresses
>   efi_bootmgr: Avoid casts in try_load_from_uri_path()
>   efi_loader: Simplify efi_dp_from_mem()
>
>  arch/arm/cpu/armv8/fsl-layerscape/cpu.c       |   2 +-
>  arch/arm/mach-bcm283x/reset.c                 |   2 +-
>  doc/api/efi.rst                               |   6 +
>  include/efi.h                                 |  23 +-
>  include/efi_api.h                             |  10 +
>  include/efi_loader.h                          | 102 ++++--
>  lib/efi_loader/efi_bootbin.c                  |   3 +-
>  lib/efi_loader/efi_bootmgr.c                  |  10 +-
>  lib/efi_loader/efi_boottime.c                 |  53 ++-
>  lib/efi_loader/efi_device_path.c              |  18 +-
>  lib/efi_loader/efi_dt_fixup.c                 |   4 -
>  lib/efi_loader/efi_helper.c                   |   4 +-
>  lib/efi_loader/efi_image_loader.c             |   3 +-
>  lib/efi_loader/efi_memory.c                   | 301 +++++++-----------
>  lib/efi_loader/efi_runtime.c                  |   7 +-
>  lib/efi_loader/efi_var_mem.c                  |   6 +-
>  .../efi_selftest_startimage_exit.c            |   6 +-
>  lib/lmb.c                                     |  10 +-
>  18 files changed, 313 insertions(+), 257 deletions(-)
>
> --
> 2.43.0
>

  parent reply	other threads:[~2024-12-04 14:46 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-01 15:24 [PATCH v4 00/25] efi: Tidy up confusion between pointers and addresses Simon Glass
2024-12-01 15:24 ` [PATCH v4 01/25] efi: Define fields in struct efi_mem_desc Simon Glass
2024-12-01 15:24 ` [PATCH v4 02/25] efi_loader: Fix typos in enum efi_allocate_type Simon Glass
2024-12-02 20:17   ` Tom Rini
2024-12-01 15:24 ` [PATCH v4 03/25] efi_loader: Drop extra brackets in efi_mem_carve_out() Simon Glass
2024-12-02 20:16   ` Tom Rini
2024-12-03  0:24     ` Simon Glass
2024-12-03  0:37       ` Tom Rini
2024-12-03 13:46         ` Simon Glass
2024-12-03 14:04           ` Tom Rini
2024-12-03 15:53             ` Simon Glass
2024-12-03 16:02               ` Tom Rini
2024-12-03 19:45                 ` Simon Glass
2024-12-01 15:24 ` [PATCH v4 04/25] efi_loader: Add comments where incorrect addresses are used Simon Glass
2024-12-02 20:18   ` Tom Rini
2024-12-03  0:22     ` Simon Glass
2024-12-03  0:38       ` Tom Rini
2024-12-03  8:48       ` Ilias Apalodimas
2024-12-03 13:45         ` Simon Glass
2024-12-03 14:09           ` Tom Rini
2024-12-03 15:55             ` Simon Glass
2024-12-01 15:24 ` [PATCH v4 05/25] efi_loader: Show the resulting memory address from an alloc Simon Glass
2024-12-01 15:24 ` [PATCH v4 06/25] efi_loader: Update startimage_exit self-test to check error Simon Glass
2024-12-01 15:24 ` [PATCH v4 07/25] efi_loader: Move some memory-function comments to header Simon Glass
2024-12-01 15:24 ` [PATCH v4 08/25] doc: efi: Add the EFI-loader API documentation Simon Glass
2024-12-01 15:24 ` [PATCH v4 09/25] efi_loader: Use the enum for memory type Simon Glass
2024-12-03 14:32   ` Heinrich Schuchardt
2024-12-03 15:53     ` Simon Glass
2024-12-10 16:17       ` Simon Glass
2024-12-10 17:13         ` Tom Rini
2024-12-01 15:24 ` [PATCH v4 10/25] efi_loader: Use a separate struct for memory nodes Simon Glass
2024-12-01 15:24 ` [PATCH v4 11/25] efi_loader: Drop virtual_start from priv_mem_desc Simon Glass
2024-12-01 15:24 ` [PATCH v4 12/25] efi_loader: Drop reserved " Simon Glass
2024-12-01 15:24 ` [PATCH v4 13/25] efi_loader: Use the enum for the memory type in priv_mem_desc Simon Glass
2024-12-01 15:24 ` [PATCH v4 14/25] efi_loader: Avoid assigning desc in efi_mem_carve_out() Simon Glass
2024-12-01 15:24 ` [PATCH v4 15/25] efi_loader: Move struct efi_mem_list fields together Simon Glass
2024-12-01 15:24 ` [PATCH v4 16/25] efi_loader: Rename struct efi_mem_list to mem_node Simon Glass
2024-12-01 15:24 ` [PATCH v4 17/25] efi_loader: Rename physical_start to base Simon Glass
2024-12-01 15:24 ` [PATCH v4 18/25] efi_loader: Use correct type in efi_add_runtime_mmio() Simon Glass
2024-12-01 15:24 ` [PATCH v4 19/25] efi_loader: Show the address for pool allocations Simon Glass
2024-12-01 15:24 ` [PATCH v4 20/25] efi_loader: Don't try to add sandbox runtime code Simon Glass
2024-12-01 15:24 ` [PATCH v4 21/25] efi_loader: Update to use addresses internally Simon Glass
2024-12-01 15:24 ` [PATCH v4 22/25] efi_loader: Correct address-usage in copy_fdt() Simon Glass
2024-12-01 15:24 ` [PATCH v4 23/25] efi_loader: Drop comments about incorrect addresses Simon Glass
2024-12-01 15:24 ` [PATCH v4 24/25] efi_bootmgr: Avoid casts in try_load_from_uri_path() Simon Glass
2024-12-01 15:24 ` [PATCH v4 25/25] efi_loader: Simplify efi_dp_from_mem() Simon Glass
2024-12-04 14:46 ` Ilias Apalodimas [this message]
2024-12-04 15:13   ` [PATCH v4 00/25] efi: Tidy up confusion between pointers and addresses Simon Glass

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=Z1BrTaDcP0Aqk0Ym@hera \
    --to=ilias.apalodimas@linaro.org \
    --cc=CFSworks@gmail.com \
    --cc=akashi.tkhro@gmail.com \
    --cc=caleb.connolly@linaro.org \
    --cc=j@jannau.net \
    --cc=kettenis@openbsd.org \
    --cc=kojima.masahisa@socionext.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=mbrugger@suse.com \
    --cc=moritzf@google.com \
    --cc=pbrobinson@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=pwildt@google.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=richard.henderson@linaro.org \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=sughosh.ganu@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vincent.stehle@arm.com \
    --cc=xypron.glpk@gmx.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.