From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FA453612DB for ; Sat, 22 Aug 2026 18:33:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787423600; cv=none; b=SjemkfCFmRjMYYE4BxgzrGkhPH+dGs0fqwXPK3IuAKQCztyVJkTrw2KnN0pdQhA0VSqjhmCaY9h1/bZz4kLSVgBdcRQxHaGI/UlwGBfpWfU9MeVQQqeOs9XStGEZYVNYWtiSmdz7I6lGo56EurvEEip+BYA2UPnyh+A5Gm5b6hM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787423600; c=relaxed/simple; bh=oJ6jcQ1fpWcFC2BOdFmbpkR80LJHebD7WY+b6uxsbUM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZBcZ6Nx6pePZ/bSMD2vGXeOP+pT7Kg8vK1yf/+6aygM/eah3EBUQYq7QDYxlymlaKFpOf+N7qBynJMsJmCv9Ph8lTE4EBIDKfMoq36tUk4TWJy9bWguShWmi+e54AjVKnodki4OQHGYAqLQ6aJxjJxQUi4Wp/JEDm9foxHM85h0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=eWq9lcDU; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="eWq9lcDU" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:Message-Id:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:From:Reply-To; bh=KORz1Q6LN2S1qss23Rp2FxzHVmjdGy5eAsOyJ8LP8DE=; b=eWq9lcDUFjq4cazwokKPFifDbT 10Qazbh7iMb0SIeZZDywA9Z1h60qVk/3mVGCzACps0digm7EUwGtjA0aHvzQiPXETbzZCCmtr0xYL r1MAPHj4L+UIQ7YEBxTQjww8uFjqaLZoqRi/vYBTHnRqM8oyCHsBHCWOwAUzN3EX/NyQzjAmvHfBL kmS8lgeXag4ewv8uLXYmd7f3QB6k484nBy9bGeXRZg6Efy8PRY8i8KdeSIvf51Pqyh21DvzHm+QUb xEqNRsvJdmM5BL+xvw8bHVhDN2VpedmJ25G1C2ejk94gFIW1iJpacz1YLYRXUtt9i+3A099GIk+eC a0Dhcd3A==; Received: from 186-249-148-4.shared.desktop.com.br ([186.249.148.4] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wxqWg-007bWT-2k; Sat, 22 Aug 2026 20:33:06 +0200 From: Mauricio Faria de Oliveira Date: Sat, 22 Aug 2026 15:33:19 -0300 Subject: [PATCH v9 3/5] x86/asm: group inline string functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260822-pvh-kasan-inline-v9-3-e70ef3b75b6a@igalia.com> References: <20260822-pvh-kasan-inline-v9-0-e70ef3b75b6a@igalia.com> In-Reply-To: <20260822-pvh-kasan-inline-v9-0-e70ef3b75b6a@igalia.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Juergen Gross , Alexey Dobriyan , Boris Ostrovsky , Jan Beulich , Brian Gerst Cc: kernel-dev@igalia.com, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 Group the __inline string functions in the same header. Use since __inline_memcmp() must remain there for use by arch/x86/boot/string.c. No functional changes. Signed-off-by: Mauricio Faria de Oliveira --- arch/x86/include/asm/shared/string.h | 21 +++++++++++++++++++++ arch/x86/include/asm/string.h | 21 +-------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/arch/x86/include/asm/shared/string.h b/arch/x86/include/asm/shared/string.h index 06c1d5e5013e4d59cfb49866d10e164362d2c4cc..ab033d27c581e44ba3f5a494ca29e31776be51f2 100644 --- a/arch/x86/include/asm/shared/string.h +++ b/arch/x86/include/asm/shared/string.h @@ -2,6 +2,27 @@ #ifndef _ASM_X86_SHARED_STRING_H #define _ASM_X86_SHARED_STRING_H +static __always_inline void *__inline_memcpy(void *to, const void *from, size_t len) +{ + void *ret = to; + + asm volatile("rep movsb" + : "+D" (to), "+S" (from), "+c" (len) + : : "memory"); + return ret; +} + +static __always_inline void *__inline_memset(void *s, int v, size_t n) +{ + void *ret = s; + + asm volatile("rep stosb" + : "+D" (s), "+c" (n) + : "a" ((uint8_t)v) + : "memory"); + return ret; +} + /* * This inline memcmp() returns 0 (equal) or 1 (not equal). * The regular memcmp() returns <0 (less than), 0 (equal), or >0 (greater than) diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index 9cb5aae7fba9ffcf0f5af8f939d30467750ccaa9..dbf59f0d4cca71e2ddce0d8764aeec8782236669 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -8,25 +8,6 @@ # include #endif -static __always_inline void *__inline_memcpy(void *to, const void *from, size_t len) -{ - void *ret = to; - - asm volatile("rep movsb" - : "+D" (to), "+S" (from), "+c" (len) - : : "memory"); - return ret; -} - -static __always_inline void *__inline_memset(void *s, int v, size_t n) -{ - void *ret = s; - - asm volatile("rep stosb" - : "+D" (s), "+c" (n) - : "a" ((uint8_t)v) - : "memory"); - return ret; -} +#include #endif /* _ASM_X86_STRING_H */ -- 2.47.3