From: Will Deacon <will.deacon@arm.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [PATCH 1/2] linux/bits.h: make BIT(), GENMASK(), and friends available in assembly
Date: Tue, 11 Jun 2019 16:47:46 +0100 [thread overview]
Message-ID: <20190611154746.GF4324@fuggles.cambridge.arm.com> (raw)
In-Reply-To: <20190527083412.26651-2-yamada.masahiro@socionext.com>
On Mon, May 27, 2019 at 05:34:11PM +0900, Masahiro Yamada wrote:
> BIT(), GENMASK(), etc. are useful to define register bits of hardware.
> However, low-level code is often written in assembly, where they are
> not available due to the hard-coded 1UL, 0UL.
>
> In fact, in-kernel headers such as arch/arm64/include/asm/sysreg.h
> use _BITUL() instead of BIT() so that the register bit macros are
> available in assembly.
>
> Using macros in include/uapi/linux/const.h have two reasons:
>
> [1] For use in uapi headers
> We should use underscore-prefixed variants for user-space.
>
> [2] For use in assembly code
> Since _BITUL() does not use hard-coded 1UL, it can be used as an
> alternative of BIT().
>
> For [2], it is pretty easy to change BIT() etc. for use in assembly.
>
> This allows to replace _BUTUL() in kernel headers with BIT().
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> include/linux/bits.h | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
Acked-by: Will Deacon <will.deacon@arm.com>
Will
next prev parent reply other threads:[~2019-06-11 15:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 8:34 [PATCH 0/2] Allow assembly code to use BIT(), GENMASK(), etc. and clean-up arm64 header Masahiro Yamada
2019-05-27 8:34 ` [PATCH 1/2] linux/bits.h: make BIT(), GENMASK(), and friends available in assembly Masahiro Yamada
2019-06-11 15:47 ` Will Deacon [this message]
2019-05-27 8:34 ` [PATCH 2/2] arm64: replace _BITUL() with BIT() Masahiro Yamada
2019-06-11 15:48 ` Will Deacon
2019-06-05 6:19 ` [PATCH 0/2] Allow assembly code to use BIT(), GENMASK(), etc. and clean-up arm64 header Masahiro Yamada
2019-06-05 7:34 ` Catalin Marinas
2019-06-05 9:01 ` Masahiro Yamada
2019-06-11 15:49 ` Will Deacon
2019-06-09 15:39 [PATCH 1/2] linux/bits.h: make BIT(), GENMASK(), and friends available in assembly Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190611154746.GF4324@fuggles.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).