All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Julien Grall <julien.grall@arm.com>, xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, Keir Fraser <keir@xen.org>,
	andre.przywara@arm.com, Ian Jackson <ian.jackson@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Jan Beulich <jbeulich@suse.com>
Subject: Re: [for-4.7 1/2] xen/bitops: Introduce macros to generate mask
Date: Wed, 13 Apr 2016 19:14:33 +0100	[thread overview]
Message-ID: <570E8C89.5050101@citrix.com> (raw)
In-Reply-To: <1460562931-19858-2-git-send-email-julien.grall@arm.com>

On 13/04/16 16:55, Julien Grall wrote:
> The code has been imported from the header include/linux/bitops.h in
> Linux v4.6-rc3.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Keir Fraser <keir@xen.org>
> Cc: Tim Deegan <tim@xen.org>
> ---
>  xen/include/xen/bitops.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
> index cb56f24..e1a4d93 100644
> --- a/xen/include/xen/bitops.h
> +++ b/xen/include/xen/bitops.h
> @@ -3,6 +3,17 @@
>  #include <asm/types.h>
>  
>  /*
> + * Create a contiguous bitmask starting at bit position @l and ending at
> + * position @h. For example
> + * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
> + */
> +#define GENMASK(h, l) \
> +	(((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
> +
> +#define GENMASK_ULL(h, l) \
> +	(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))

You should have just a single GENMASK() which works in terms of LL.

Masks must be signed to work correctly when implicitly extended.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-04-13 18:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 15:55 [for-4.7 0/2] xen/arm: traps: Correctly interpret the content of the register HPFAR_EL2 Julien Grall
2016-04-13 15:55 ` [for-4.7 1/2] xen/bitops: Introduce macros to generate mask Julien Grall
2016-04-13 18:07   ` Stefano Stabellini
2016-04-13 18:14   ` Andrew Cooper [this message]
2016-04-14  8:47     ` Julien Grall
2016-04-14  4:01   ` Jan Beulich
2016-04-14  8:55     ` Julien Grall
2016-04-14 14:56       ` Jan Beulich
2016-04-14 15:08         ` Julien Grall
2016-04-14 15:23           ` Jan Beulich
2016-04-20 12:35             ` Julien Grall
2016-04-20 16:43               ` Jan Beulich
2016-04-22 11:33                 ` Julien Grall
2016-04-22 11:49                   ` Stefano Stabellini
2016-04-22 15:33                     ` Julien Grall
2016-04-22 15:42                       ` Stefano Stabellini
2016-04-13 15:55 ` [for-4.7 2/2] xen/arm: traps: Correctly interpret the content of the register HPFAR_EL2 Julien Grall
2016-04-13 18:17   ` Stefano Stabellini
2016-04-13 19:11   ` Tamas K Lengyel
2016-04-13 20:33   ` André Przywara
2016-04-14 17:47 ` [for-4.7 0/2] " Wei Liu

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=570E8C89.5050101@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=andre.przywara@arm.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=keir@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.