From patchwork Mon Dec 16 14:09:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13909760 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 C76F7205E26; Mon, 16 Dec 2024 14:10:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734358255; cv=none; b=C7ovtqeNi7LB4U89/N6b3GP8k2vYQct6g4zuM5iR3tQHPPTMStlERj5Ag0FvxJ74uzoZGz4FjWC1EQdZxvG+GC5WUDXJOKGuNWSI6zIJHydo3fBfNQ2qnU3cJcQZpq6XXzikGwKMOTXBfe87oHQZ7By6x9LP5j06tzvCMg5gXS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734358255; c=relaxed/simple; bh=zRm1/jHzhcX2cBU5SFyW7PIL5hMfUBZQzaPVvddjWs0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U66NencYydOtXQbCb5gjCvWrS6Su5yVGO7W0L4vqrXdbIRDmrbgjfOonBoyLljjDQaZqs+eoIeEpr0sHTswAxn1kPQIiPAE97HDRzvs3KMhPTg3Oif9Y7lnCamkNT6cktG3vedPWBj45l5cOAQ2LUs3wGOzKGiMHOPwgyxSCnCI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cmdDBZfV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=heZTOf2A; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cmdDBZfV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="heZTOf2A" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1734358252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gs/m1ne1xnufcZuceBub2RzRtdWIKInpIZ86AtKhTZY=; b=cmdDBZfVWS6iJxS6Qj2w9ZQQ3R6xmZGKYAB0HWFGlKDMd12wPWqlnClWQ3d9T7mCAdp/oE TXGiqyd4mqPSHh1hjNowtj42QYpOidrFxIljJST2kZe4sCYwpRZiQyKF+QJUs1XFCMHY4N 3gjda6bRPz/5UIjh3zOmprTshVCtwZ/XomceXMNMEBF6Vow85ee5QJt7lK++hffeJWVKRW 9UvDDAWxuIfhR4FaJCFRZX5QrK27RFV+m3cKrSBncouypGH2CzVfL3wzZaGMtcZbWBlVgS 30gz/u4EggQbRrH+hJzX2F68RuF16gFJRgNK6BJyRtMzbWJiNZHpyUVvfgl1OQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1734358252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gs/m1ne1xnufcZuceBub2RzRtdWIKInpIZ86AtKhTZY=; b=heZTOf2AXJAP0vRl3L0tLwZ+AYJjnJOJsGZMWC/8FrllI/jr0RX1EvBsRXVwn9qbXBWlqg bQ8V7pa/w94GHaDw== Date: Mon, 16 Dec 2024 15:09:58 +0100 Subject: [PATCH 02/17] vdso: Introduce vdso/align.h Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241216-vdso-store-rng-v1-2-f7aed1bdb3b2@linutronix.de> References: <20241216-vdso-store-rng-v1-0-f7aed1bdb3b2@linutronix.de> In-Reply-To: <20241216-vdso-store-rng-v1-0-f7aed1bdb3b2@linutronix.de> To: "James E.J. Bottomley" , Helge Deller , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Anna-Maria Behnsen , Frederic Weisbecker , Andrew Morton , Catalin Marinas , Will Deacon , Theodore Ts'o , "Jason A. Donenfeld" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Huacai Chen , WANG Xuerui , Russell King , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Bogendoerfer , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Arnd Bergmann Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, loongarch@lists.linux.dev, linux-s390@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, Nam Cao , =?utf-8?q?Thom?= =?utf-8?q?as_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1734358247; l=2181; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=zRm1/jHzhcX2cBU5SFyW7PIL5hMfUBZQzaPVvddjWs0=; b=3vucqSgNyFfcPlZWU+nck873IDs3fyLmnT/Uwqgae45dcegtZe39aM9ZkpPEyADY1fE7HmIZD KjgQ1Whis1RBTmvVwZEHZ6hciMQgEMdV0+RhtXHlxeCdmndFQ1Ipjf9 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The vDSO implementation can only include headers from the vdso/ namespace. To enable the usage of the ALIGN() macro from the vDSO, move linux/align.h to vdso/align.h wholly. As the only dependency linux/const.h is only a wrapper around vdso/const.h anyways adapt that dependency. Also provide a compatibility wrapper linux/align.h. Signed-off-by: Thomas Weißschuh --- include/linux/align.h | 10 +--------- include/vdso/align.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/include/linux/align.h b/include/linux/align.h index 2b4acec7b95a27b6768d48f46519abc584c94d5d..55debf105a5d610c592e5c53a4153018ea1ae2c6 100644 --- a/include/linux/align.h +++ b/include/linux/align.h @@ -2,14 +2,6 @@ #ifndef _LINUX_ALIGN_H #define _LINUX_ALIGN_H -#include - -/* @a is a power of 2 value */ -#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) -#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) -#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) -#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) -#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a))) -#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) +#include #endif /* _LINUX_ALIGN_H */ diff --git a/include/vdso/align.h b/include/vdso/align.h new file mode 100644 index 0000000000000000000000000000000000000000..02dd8626b5c5aa59d2ee0b15799b6e9adb343f65 --- /dev/null +++ b/include/vdso/align.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_ALIGN_H +#define __VDSO_ALIGN_H + +#include + +/* @a is a power of 2 value */ +#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) +#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) +#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) +#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) +#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a))) +#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + +#endif /* __VDSO_ALIGN_H */