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 A6303408002 for ; Wed, 1 Jul 2026 23:14: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=1782947662; cv=none; b=jDo8s7buSvLu3ckuAGzHKTWKYExbB6bVTDmrYYvmzxlc/49s48v2lkB358iwVcUMEBxDr0XMF8yPlkLSGKCReq3XoSzBtNHobd6JeDseEL02GoHPLq/C1rhFnLlPpNxLfhDkFVOX7SC7wHvRGwk7VFUvgCRfWTlJEhX9X6bxjI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782947662; c=relaxed/simple; bh=4hnlvS3NNnK+moeASRgGY2WW4No6LXQnGv4L8x8yhiA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gfseq4LoubAC5z0oOXZ1OD6sJiCVaFDPymQpXxskE21vP7SiaBfQA8OKMrffFA4UADdwCqDUizjClFLUsXw3zGTEzaSUfOBsXsHmvYUaUe/CyG5xqfb+5sXDomNvJvIqCHV3SkL1WOU3SvPBTiFG62yYCkJ9R4dSfZgwBds8GLc= 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=PFNIyg8z; 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="PFNIyg8z" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=p4ShPqNeNQJKvlIwXNQ/fHjMA+LLf6yrUxJsYTGqlvs=; b=PFNIyg8zGPfpmeT3OlZRDqCu3Y AAwjKZUy2MOLiMdV2AK7morDG9ed4p2FSwTQfDqi5BThXkqoLXG10hAzPoL8yLQwLUt/4432hZzhd Qh+zIsjlOcjK+V+cHNddjntdiKyGGhowJzTp1rOGDKLsg3k9jTzAfrLZ3p5fG8LTEWmX2M100YRcp sISsBgeikL7ZLhNgHi0O1PInn5cja+7QvmkBPAyHuNTU3yw4mhVM9w59vN0eGENOy6reUiQEwIyhi yY/leJ/Zx+5lKKGadKxxFoyMPFlIBzyR0BxCgCqTPOq99TkdY7zjBCpV013tbhvB05dWAmxkFTmCH qxa5wC+Q==; Received: from 186-249-148-121.shared.desktop.com.br ([186.249.148.121] 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 1wf482-007mwb-O5; Thu, 02 Jul 2026 01:14:02 +0200 From: Mauricio Faria de Oliveira Date: Wed, 01 Jul 2026 20:13:51 -0300 Subject: [PATCH v6 2/4] 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: <20260701-pvh-kasan-inline-v6-2-ba99045dfa9f@igalia.com> References: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> In-Reply-To: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Juergen Gross , Alexey Dobriyan , Boris Ostrovsky 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. Signed-off-by: Mauricio Faria de Oliveira --- arch/x86/include/asm/shared/string.h | 26 ++++++++++++++++++++++++++ arch/x86/include/asm/string.h | 21 --------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/arch/x86/include/asm/shared/string.h b/arch/x86/include/asm/shared/string.h index 02b92927553f7b8e1c87e6122bbaa70439e57ea7..b1b9c93f90685c8ec4174ef9e24bc7a0e6ba9b8a 100644 --- a/arch/x86/include/asm/shared/string.h +++ b/arch/x86/include/asm/shared/string.h @@ -2,6 +2,32 @@ #ifndef _ASM_X86_SHARED_STRING_H #define _ASM_X86_SHARED_STRING_H +/* + * The __inline string functions are grouped in this file for consistency and + * for use by arch/x86/boot code due to limitations on including asm/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 8d271a451721d97f78a84009613381414f91f2a6..dbf59f0d4cca71e2ddce0d8764aeec8782236669 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -10,25 +10,4 @@ #include -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; -} - #endif /* _ASM_X86_STRING_H */ -- 2.47.3