xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 2/3] x86/mm: Use IS_ALIGNED() rather than open coding it
Date: Fri, 14 Oct 2016 17:02:29 +0100	[thread overview]
Message-ID: <1476460950-10331-2-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1476460950-10331-1-git-send-email-andrew.cooper3@citrix.com>

Drop repeated identical BUILD_BUG_ON()'s

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>
---
 xen/arch/x86/x86_64/mm.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index b8b6b70..0083beb 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -540,7 +540,7 @@ void __init paging_init(void)
                  sizeof(*machine_to_phys_mapping));
     for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
     {
-        BUILD_BUG_ON(RO_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
+        BUILD_BUG_ON(!IS_ALIGNED(RO_MPT_VIRT_START, L3_PAGETABLE_SHIFT));
         va = RO_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT);
         memflags = MEMF_node(phys_to_nid(i <<
             (L2_PAGETABLE_SHIFT - 3 + PAGE_SHIFT)));
@@ -776,8 +776,8 @@ static int setup_frametable_chunk(void *start, void *end,
     unsigned long mfn;
     int err;
 
-    ASSERT(!(s & ((1 << L2_PAGETABLE_SHIFT) - 1)));
-    ASSERT(!(e & ((1 << L2_PAGETABLE_SHIFT) - 1)));
+    ASSERT(IS_ALIGNED(s, L2_PAGETABLE_SHIFT));
+    ASSERT(IS_ALIGNED(e, L2_PAGETABLE_SHIFT));
 
     for ( ; s < e; s += (1UL << L2_PAGETABLE_SHIFT))
     {
@@ -838,8 +838,8 @@ void __init subarch_init_memory(void)
     l3_pgentry_t l3e;
     l2_pgentry_t l2e;
 
-    BUILD_BUG_ON(RDWR_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
-    BUILD_BUG_ON(RDWR_MPT_VIRT_END   & ((1UL << L3_PAGETABLE_SHIFT) - 1));
+    BUILD_BUG_ON(!IS_ALIGNED(RDWR_MPT_VIRT_START, L3_PAGETABLE_SHIFT));
+    BUILD_BUG_ON(!IS_ALIGNED(RDWR_MPT_VIRT_END,   L3_PAGETABLE_SHIFT));
     /* M2P table is mappable read-only by privileged domains. */
     for ( v  = RDWR_MPT_VIRT_START;
           v != RDWR_MPT_VIRT_END;
@@ -934,8 +934,6 @@ long subarch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( copy_from_guest(&xmml, arg, 1) )
             return -EFAULT;
 
-        BUILD_BUG_ON(RDWR_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
-        BUILD_BUG_ON(RDWR_MPT_VIRT_END   & ((1UL << L3_PAGETABLE_SHIFT) - 1));
         for ( i = 0, v = RDWR_MPT_VIRT_START, last_mfn = 0;
               (i != xmml.max_extents) &&
               (v < (unsigned long)(machine_to_phys_mapping + max_page));
-- 
2.1.4


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

  reply	other threads:[~2016-10-14 16:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 16:02 [PATCH 1/3] xen/x86: Fixup misc stale issues Andrew Cooper
2016-10-14 16:02 ` Andrew Cooper [this message]
2016-10-20 16:37   ` [PATCH 2/3] x86/mm: Use IS_ALIGNED() rather than open coding it George Dunlap
2016-10-20 16:48     ` Andrew Cooper
2016-10-14 16:02 ` [PATCH 3/3] x86/svm: Drop adjustment of X86_FEATURE_APIC Andrew Cooper
2016-10-14 16:34   ` Boris Ostrovsky
2016-10-24  9:26 ` [PATCH 1/3] xen/x86: Fixup misc stale issues Jan Beulich
2016-10-24 10:15   ` 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=1476460950-10331-2-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --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 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).