[PATCH 1/9] sandbox: efi_loader: Correct use of addresses as pointers

Simon Glass sjg at chromium.org
Tue Nov 5 16:12:57 CET 2024


Hi Heinrich,

On Mon, 4 Nov 2024 at 13:37, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
>
>
> Am 4. November 2024 14:39:45 MEZ schrieb Simon Glass <sjg at chromium.org>:
> >The cache-flush function is incorrect which causes a crash in the
> >remoteproc tests with arm64.
> >
> >Fix both problems by using map_sysmem() to convert an address to a
> >pointer and map_to_sysmem() to convert a pointer to an address.
> >
> >Also update the image-loader's cache-flushing logic.
> >
> >As discussed some time ago, it would be good to update the way
> >EFI_LOADER uses addresses and pointers, particularly around memory
> >allocation. Ideally we would use addresses internally, with pointers
> >only exposed via the external API, even where pointers are in fact
> >u64 values.
>
> No, we should get rid of sandbox virtual addresses where possible, e.g. in LMB.
>
> They are are only relevant for the sandbox's command line interface and device-tree.
>
> This will minimize the number of conversions, which only satisfy the needs of the sandbox and have no relevance on real systems including QEMU.
>
> Do not wag the dog with the tail.

For now I'll just remove that comment from this commit. We use ulong
in U-Boot for addresses. Everything works fine and we only get in
trouble when we use a ulong as a pointer. Let's discuss this in more
detail at some point.

>
> Best regards
>
> Heinrich
>
> >
> >Signed-off-by: Simon Glass <sjg at chromium.org>
> >Fixes: 3286d223fd7 ("sandbox: implement invalidate_icache_all()")
> >---
> >
> > arch/sandbox/cpu/cache.c              |  8 +++++++-
> > drivers/remoteproc/rproc-elf-loader.c | 18 +++++++++++-------
> > lib/efi_loader/efi_image_loader.c     |  3 ++-
> > 3 files changed, 20 insertions(+), 9 deletions(-)
> >

Regards,
Simon


More information about the U-Boot mailing list