All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Wolfgang Denk <wd@denx.de>, Stefan Roese <sr@denx.de>
Cc: u-boot@lists.denx.de, sjg@chromium.org, trini@konsulko.com
Subject: Re: [PATCH v1 1/5] lib/string: Add memset_simple()
Date: Fri, 6 Aug 2021 18:13:39 +0200	[thread overview]
Message-ID: <c79ed1e1-3a8b-fc72-8423-a1d8ebd811cd@gmx.de> (raw)
In-Reply-To: <273341.1628264185@gemini.denx.de>



On 8/6/21 5:36 PM, Wolfgang Denk wrote:
> Dear Stefan,
>
> In message <20210806133843.3642916-2-sr@denx.de> you wrote:
>> The optimized memset() ARM64 implementation cannot be used very early
>> on, since caches need to be enabled for this function to work. Otherwise
>> an exception occurs (only printed with very early DEBUG_UART enabled).
>>
>> This patch now implements a very simple memset() version, which will be
>> used in a few selected places in the ARM64 early boot process.
> ...
>
> We have already implementations of memset() elsewhere, for example in
> lib/string.c [hey, that's even the file you are modifying...], then
> again in lib/efi/efi_stub.c and also in
> lib/efi_loader/efi_freestanding.c - so do we really need another
> implementation?
>
> BTW: lib/efi_loader/efi_freestanding.c  looks completely useless to
> me.  Can we dump this? [Adding Heinich to Cc:]

EFI binaries are freestanding. They cannot use any U-Boot library
function except the UEFI API exposed via the system table.

We compile EFI binaries with GCC parameter -ffreestanding. As we do not
include any GCC library it is assumed that functions like memset() are
provided by the compiled source package. This is where
efi_freestanding.c comes in.

Please, have a look at

scripts/Makefile.lib:420:
targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o

where we link the efi_freestanding.o module into every EFI binary.

Best regards

Heinrich

>
>
>> +void *memset_simple(void *s, int c, size_t count)
>> +{
>> +	char *s8 = (char *)s;
>> +
>> +	while (count--)
>> +		*s8++ = c;
>> +
>> +	return s;
>> +}
>
> In which way is this different from memset() as defined in the same
> file (further up) with CONFIG_TINY_MEMSET enabled?  And even without
> this option the memset() implementation here should work.  Or does
> it not?
>
> Best regards,
>
> Wolfgang Denk
>

  reply	other threads:[~2021-08-06 16:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 13:38 [PATCH v1 0/5] arm64: Add optimized memset/memcpy functions Stefan Roese
2021-08-06 13:38 ` [PATCH v1 1/5] lib/string: Add memset_simple() Stefan Roese
2021-08-06 15:36   ` Wolfgang Denk
2021-08-06 16:13     ` Heinrich Schuchardt [this message]
2021-08-07 15:18       ` Wolfgang Denk
2021-08-07 15:34         ` Tom Rini
2021-08-06 13:38 ` [PATCH v1 2/5] board_init: Use memset_simple() in board_init_f_init_reserve() Stefan Roese
2021-08-09  7:52   ` Rasmus Villemoes
2021-08-09 13:17     ` Stefan Roese
2021-08-06 13:38 ` [PATCH v1 3/5] arm64: cache_v8: Use memset_simple() in create_table() Stefan Roese
2021-08-06 13:38 ` [PATCH v1 4/5] arm64: arch/arm/lib: Add optimized memset/memcpy functions Stefan Roese
2021-08-06 14:43   ` Tom Rini
2021-08-06 14:45     ` Stefan Roese
2021-08-06 15:41   ` Wolfgang Denk
2021-08-06 13:38 ` [PATCH v1 5/5] arm64: Kconfig: Enable usage of optimized memset/memcpy Stefan Roese
2021-08-06 14:24 ` [PATCH v1 0/5] arm64: Add optimized memset/memcpy functions Tom Rini
2021-08-06 14:44   ` Stefan Roese

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=c79ed1e1-3a8b-fc72-8423-a1d8ebd811cd@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.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.