Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CBD8C4338F for ; Fri, 6 Aug 2021 13:38:55 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 257C761104 for ; Fri, 6 Aug 2021 13:38:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 257C761104 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 804C382F3F; Fri, 6 Aug 2021 15:38:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1628257131; bh=OvdtiDXcJwVZfQZShq3zdth26QqewPBxQ0iV5T825mY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WsnY/7lgGpZ9YNTl8hFTcrYSXxoBdJbpQsPC+sNr1SekdYa/JniKTBbpTKoYadt8C XDoPbrNTpAEeCVDwOnAqMAwxbhhZbHpU6D9T3ygROK7Nk4a34Qkr4UK7iQBBV1JZeD 3Ckx+99rX+nwMF9Y0wl52kRqXZuUp0BKyfNzKwKSodiSXQJNJKFm/S3v4VayQHtXP/ pe8pnkVZv1XZwNoy8mTGZP9gqPicJAUfjltf/ubbN39qTHPe9NvI4VeD/RbgH++jCk xQ9dNGBqRKTnjPGrrpQHMDDpqdapdF1vjru61v8HWjerA92TfRsMCiLM7XKPZMUSWh LC4Ksf775iL9w== Received: by phobos.denx.de (Postfix, from userid 109) id 437A082F3F; Fri, 6 Aug 2021 15:38:50 +0200 (CEST) Received: from mout-u-205.mailbox.org (mout-u-205.mailbox.org [91.198.250.254]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8F61E82C89 for ; Fri, 6 Aug 2021 15:38:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-205.mailbox.org (Postfix) with ESMTPS id 4Gh65339ZyzQkH2; Fri, 6 Aug 2021 15:38:47 +0200 (CEST) Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter05.heinlein-hosting.de (spamfilter05.heinlein-hosting.de [80.241.56.123]) (amavisd-new, port 10030) with ESMTP id PKxmd60ujijp; Fri, 6 Aug 2021 15:38:44 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: sjg@chromium.org, trini@konsulko.com Subject: [PATCH v1 1/5] lib/string: Add memset_simple() Date: Fri, 6 Aug 2021 15:38:39 +0200 Message-Id: <20210806133843.3642916-2-sr@denx.de> In-Reply-To: <20210806133843.3642916-1-sr@denx.de> References: <20210806133843.3642916-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8EEA0184A X-Rspamd-UID: 628064 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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. Signed-off-by: Stefan Roese --- include/linux/string.h | 2 ++ lib/string.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/string.h b/include/linux/string.h index dd255f21633a..0ab1c557da3d 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -129,6 +129,8 @@ extern void * memchr(const void *,int,__kernel_size_t); void *memchr_inv(const void *, int, size_t); #endif +void *memset_simple(void *s, int c, size_t count); + unsigned long ustrtoul(const char *cp, char **endp, unsigned int base); unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base); diff --git a/lib/string.c b/lib/string.c index ba176fb08f73..7092181f831f 100644 --- a/lib/string.c +++ b/lib/string.c @@ -543,6 +543,16 @@ __used void * memset(void * s,int c,size_t count) } #endif +void *memset_simple(void *s, int c, size_t count) +{ + char *s8 = (char *)s; + + while (count--) + *s8++ = c; + + return s; +} + #ifndef __HAVE_ARCH_MEMCPY /** * memcpy - Copy one area of memory to another -- 2.32.0