From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D5250C433F5 for ; Thu, 17 Mar 2022 11:00:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7DC68837EC; Thu, 17 Mar 2022 12:00:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Nnz9K+0P"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 655DB836A8; Thu, 17 Mar 2022 12:00:38 +0100 (CET) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CF60A83CB4 for ; Thu, 17 Mar 2022 12:00:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ptosi@google.com Received: by mail-wm1-x334.google.com with SMTP id q20so2891083wmq.1 for ; Thu, 17 Mar 2022 04:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=iHSnT5jlWHWNPzXshvwE60I+SQOan/zTNs3Y3dqUE+Y=; b=Nnz9K+0Pj1YzQrfRW9W+POPOo/NrxRnaTmxq2Nb+zEL0qCmFb17kAbXcd22AIhKCNI RYV6DnSvcs/w3mnzBdXdpd0W8hj3qTB4VLRoBQprx/QNVmqO8ku7ilmhWlq0Q7j5uqf4 /TYPsWnRc3pmPXB/yzZefXIOB6meUK7ULhoA3mRXFzBHF8dB2/9rC8AIj9fpkxUTw68c HgryYXkMZRbBkcETCzxCf9CWZerHfsu+7LYGKAfEaZo1VM368h8K5IVLFw+5SrUw58+i zX9rfyVxNVWxOpdacHBO7wf5rCf3VwGqUijVSigFk4KyKascbKY1b6mfNILJrEtcd8JE dnDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=iHSnT5jlWHWNPzXshvwE60I+SQOan/zTNs3Y3dqUE+Y=; b=0U+5ryJoqfhJc7UxNoD0yMMHv6qFXv8KUmQNgaW+d0vGgZS4XNtJ9UzYuePiOZL9Ap d1rNdt7FIPQBl20bnm2UCGtkpQDZrtDcKYy+/Q7BCrxhoKV4zSz9qpRl+TCnKGFThY1q KebfnYjevIbKeVlJvjNW8rJS76h9dRwrhgMB6Ukgwu+VWhOo0f9cV9ynaaaSVzZNJYk0 Qm02Wqijhg+6tb5ptRr3iNmuhzxegm/0nhkF48f7Js+4vIPSP2bL5DN1ZATu48NQUGqy HQ0O/S0ot+BXKMaWT6MgvfynwbCEdxrgVsJNp2TFXnVM9UzqUuuIFMD6wakFjFwzb43+ VDPA== X-Gm-Message-State: AOAM532wY8ZSM96ggghhhJNLR40wvdiYyLZyrEYhE1/AkXQ5a0ip2Oaa tL8cMT+iJ4EBPEsvGCgb1LXaeKTDbZAaOg== X-Google-Smtp-Source: ABdhPJxQu/ScPv/s5BllCv5u2wCQvZ1hJiN5PY+l8Lr3MaAQcVqgeC+1lHh4uby8+B55D9tUTFW6Pg== X-Received: by 2002:a05:600c:204e:b0:389:a1cf:e6b9 with SMTP id p14-20020a05600c204e00b00389a1cfe6b9mr3268797wmg.175.1647514833263; Thu, 17 Mar 2022 04:00:33 -0700 (PDT) Received: from google.com (203.75.199.104.bc.googleusercontent.com. [104.199.75.203]) by smtp.gmail.com with ESMTPSA id p2-20020a1c7402000000b0038159076d30sm7051513wmc.22.2022.03.17.04.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 04:00:32 -0700 (PDT) Date: Thu, 17 Mar 2022 11:00:29 +0000 From: =?utf-8?Q?Pierre-Cl=C3=A9ment?= Tosi To: Simon Glass Cc: U-Boot Mailing List , Tom Rini Subject: Re: [PATCH 4/9] linux/const.h: Upgrade & Merge vDSO and uAPI Message-ID: <20220317110029.t52pyk33ubgizswz@google.com> References: <20220316153948.197650-1-ptosi@google.com> <20220316153948.197650-4-ptosi@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean On Wed, Mar 16, 2022 at 01:23:44PM -0600, Simon Glass wrote: > Hi Pierre-Clément, > > On Wed, 16 Mar 2022 at 09:40, Pierre-Clément Tosi wrote: > > > > Import the header from version 5.16 of the kernel: > > > > commit df0cc57e057f18e44dac8e6c18aba47ab53202f9 > > > > Inline and . This is wrapped in > > "#ifndef __UBOOT__/#include/#else/{inline}" to better document the > > origin of the code being added to the U-Boot header (but not present in > > the original header) and make diff tools happier when comparing the file > > with its reference, which should be useful when porting future changes > > from the Linux header and/or if we decide to also import those included > > headers into the U-Boot codebase. > > > > Signed-off-by: Pierre-Clément Tosi > > Cc: Simon Glass > > Cc: Tom Rini > > --- > > include/linux/const.h | 22 +++++++++++++++++++++- > > 1 file changed, 21 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/const.h b/include/linux/const.h > > index 379c889232..3e3803d767 100644 > > --- a/include/linux/const.h > > +++ b/include/linux/const.h > > @@ -2,8 +2,13 @@ > > #ifndef _LINUX_CONST_H > > #define _LINUX_CONST_H > > > > -/* const.h: Macros for dealing with constants. */ > > +#ifndef __UBOOT__ > > +#include > > +#else > > > > +#ifndef __UBOOT__ > > +#include > > +#else > > /* Some constant macros are used in both assembler and > > * C code. Therefore we cannot annotate them always with > > * 'UL' and other type specifiers unilaterally. We > > @@ -28,7 +33,22 @@ > > #define _BITUL(x) (_UL(1) << (x)) > > #define _BITULL(x) (_ULL(1) << (x)) > > > > +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) > > +#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) > > How does this compare to the existing ALIGN()? It looks the same to me. > __ALIGN_KERNEL() is the uAPI counterpart to the ALIGN() kernel macro (or is it the other way around?) so they're intended to be similar in implementation; the key difference being the double-leading-underscore notation, which bears a special meaning as per the C Standard, and allows __ALIGN_KERNEL() to be considerably easier to export. In fact, the kernel currently defines #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) For the reason why this patch introduces it here, I've taken the conservative approach of meticulously copying the original headers over, in their entirety (as far as feasible), in order to make future upgrades as smooth as possible. This patch inlines those vDSO and uAPI headers instead of bringing them as the stand-alone files they are in the kernel as it looks like no other kernel header of that kind has been imported but IMO, it would make more sense to do the later. What do you think? > > + > > +#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) > > +#endif > > + > > #define UL(x) (_UL(x)) > > #define ULL(x) (_ULL(x)) > > +#endif > > + > > +/* > > + * This returns a constant expression while determining if an argument is > > + * a constant expression, most importantly without evaluating the argument. > > + * Glory to Martin Uecker > > + */ > > +#define __is_constexpr(x) \ > > + (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) > > > > #endif /* _LINUX_CONST_H */ > > -- > > 2.35.1.723.g4982287a31-goog > > > > REgards, > Simon -- Pierre