From patchwork Thu Aug 22 07:13:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3140DC3DA4A for ; Thu, 22 Aug 2024 07:13:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B65106B01B1; Thu, 22 Aug 2024 03:13:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B14DA80009; Thu, 22 Aug 2024 03:13:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B5AC6B01F3; Thu, 22 Aug 2024 03:13:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 812776B01B1 for ; Thu, 22 Aug 2024 03:13:32 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3D06D16138D for ; Thu, 22 Aug 2024 07:13:32 +0000 (UTC) X-FDA: 82479015864.01.3BE50F9 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf01.hostedemail.com (Postfix) with ESMTP id 11AC440010 for ; Thu, 22 Aug 2024 07:13:29 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310769; a=rsa-sha256; cv=none; b=FKg9nNQ3tGf5zkAw5RlIWw4cL8+C1rP6hRsEDE25JSA0VLshboppNG6Tani08rSlXu71ZL lPJ2CZjzl3bShEXSpvbGxfValwycs9oFsb+ZlelVGKAlZd6WaJTAiiZ4FefcgncI0MBDyF NvssKNF0O5hYZO22SjzfQctddKpX7hM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310769; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sif7IgiJ5FNM15Q3ELj8Pi8FnPDRW+/Wer7b5sNOKo0=; b=moa/lT9zDxor6bNvO34Cv4Yv6njHgg9/Q9pXLgjIyR9zQ35zyztHHM7JWrkqDK+lFjL/uC HELQj1k6T41nCrjmGG+lHp81UTmh4N+b7rlCjCC63c6QCTZ7R0eqBBNv8U4wmZzEW4NZpe vq6Ih1HMNmW669By2Kx16wu5Nw+Sbjo= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDv764knz9sSL; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id teSSTAQ_JMUd; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDv751hwz9sSH; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 981318B77E; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id deVhGSnWC0EM; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7D1878B77D; Thu, 22 Aug 2024 09:13:22 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 01/17] asm-generic/unaligned.h: Extract common header for vDSO Date: Thu, 22 Aug 2024 09:13:09 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310793; l=2154; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=PMuEkb4wUUODc8BHWuAMDd3O1VO5F7l6ew490+ETezs=; b=SCbozmVIQ2N0YmD5LdvWZtFwtXyTP5t5NaLd+wgmzFt0RkjCtkLWbQu2r6nA/RS5ZBAbgtMi5 NOvPh+CSjVFDGZxHHEvNd8+6dh4WhQuiz0RR1GxQc29ssqo1F2FgOFN X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Stat-Signature: 7iot4mek3od18j7oy9i8wbn8cnex1mnb X-Rspamd-Queue-Id: 11AC440010 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724310809-240663 X-HE-Meta: U2FsdGVkX19NSHu9ghOkPlWPY6k6QfDE3KHrS1reLefRLt9MTcSf/Zdk8/tstIsD0E/GcbZJHN/TQk5zAuTY//PI3mRYRoMYT6QrNZgxSdr1OdiIJJodieu/lcAQhvSOYEb6xEsX3EnS75eoOBuaV92cfGfigtzlrPf/5BVPXGRx9lGrAlH5LRSV+wGZunbFpVJJcMsbspbHJ8qK5QsLzVYXyK7SeCpPpEzD2oTARcqF/flqwpIr9bsJS4hN0jYGmphR7wlhQeDR6h1S96iitK15zxyOD7y1FMnnAYGYwkyOJgI6yEYN51Ip4d5COKsvBjVmjLqr7onYgVtQL9XoSiDjBA0AkPa2Gbw+H7W4JpAu7NoDNeH2sTLxfVgFGcCqgATK+voFdCPeV/QB1bKGv5SX0GBigPlDUD8ZTuVZFNLPStg8kkLSfwrECuIY3TTzqP3CD5YcPAzEbSxXYHlI0rJ9TkeUsdyY1K1v9HZ+ZySApIr04C0fSUDvWAg1IAHVAqrARJrXJTGzEGDDcKfZyL0v+0YKWdGHO2QJBk9IuGqU2y/r5xC5WsvZh2I/WIPd+7xodY+8ZUVcMIW3/1xZR6N3ND84dN3HPAaenqft+6JxkIJycbyXQ+Q2gATc6Pu/ZeU19jXsPjmLp3JAcvxTNX7KeY913r0nbXAK94Azbgz/VQaPNnEwytsQiKgxu9KE2PKnChyrUQAlZMwNmX7PzDYFyV6t5/exkqiwrspf1CndPsjwppArJcNTMQX1k9ETY9fN/ZLD/bEOachjREFyTgG7OzySOOwAARc+zFKkhkHUvezyykA6/wOJudABHfN3o5YjoXck8paQ4G/SggK7rC3zCVb7a/kvVIMV4Dyex8Xs7l/2IEO2ySvEgi3q9ECOg2Mf8SzC0MJALbzwjO/3hiDAH89T6DwALsK30mC9RYRLCLfsFPR9AUbpIVGYXTQLIM+VGaSbDuGpJEOnRwY UKAgwlyv V174wEOfRdSPoxPLIv/IyUsx6FKURfdpd/emB7Y0K3Yfu4+6RbTJuarDgIeOzTW5wS4BpPQMI9sPTH3SK74P+GMH5HBTtI2lcNvzgKac+287bUAyB7gFABjdIbZbp75MjzZAn X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: getrandom vDSO implementation requires __put_unaligned_t() and __put_unaligned_t() but including asm-generic/unaligned.h pulls too many other headers. Follow the same approach as for most things in include/vdso/, see for instance commit 8165b57bca21 ("linux/const.h: Extract common header for vDSO"): Move __get_unaligned_t and __put_unaligned_t into a new unaligned.h living in the vdso/ include directory. Signed-off-by: Christophe Leroy --- include/asm-generic/unaligned.h | 11 +---------- include/vdso/unaligned.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 include/vdso/unaligned.h diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h index a84c64e5f11e..95acdd70b3b2 100644 --- a/include/asm-generic/unaligned.h +++ b/include/asm-generic/unaligned.h @@ -8,16 +8,7 @@ */ #include #include - -#define __get_unaligned_t(type, ptr) ({ \ - const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ - __pptr->x; \ -}) - -#define __put_unaligned_t(type, val, ptr) do { \ - struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ - __pptr->x = (val); \ -} while (0) +#include #define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr)) #define put_unaligned(val, ptr) __put_unaligned_t(typeof(*(ptr)), (val), (ptr)) diff --git a/include/vdso/unaligned.h b/include/vdso/unaligned.h new file mode 100644 index 000000000000..eee3d2a4dbe4 --- /dev/null +++ b/include/vdso/unaligned.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_UNALIGNED_H +#define __VDSO_UNALIGNED_H + +#define __get_unaligned_t(type, ptr) ({ \ + const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ + __pptr->x; \ +}) + +#define __put_unaligned_t(type, val, ptr) do { \ + struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ + __pptr->x = (val); \ +} while (0) + +#endif /* __VDSO_UNALIGNED_H */