xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xen.org
Cc: Julien Grall <julien.grall@linaro.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH v2 1/9] xen/arm: domain_build: Clean-up insert_11_bank
Date: Thu,  5 Oct 2017 18:42:14 +0100	[thread overview]
Message-ID: <20171005174222.29161-2-julien.grall@linaro.org> (raw)
In-Reply-To: <20171005174222.29161-1-julien.grall@linaro.org>

    - Remove spurious ()
    - Add missing spaces
    - Turn 1 << to 1UL <<
    - Rename spfn to smfn and switch to mfn_t

Signed-off-by: Julien Grall <julien.grall@linaro.org>

---

Cc: Stefano Stabellini <sstabellini@kernel.org>

    Changes in v2:
        - Remove double space
        - s/spfn/smfn/ and switch to mfn_t
---
 xen/arch/arm/domain_build.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 3723dc3f78..167711b4fa 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -50,6 +50,8 @@ struct map_range_data
 /* Override macros from asm/page.h to make them work with mfn_t */
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
+#undef page_to_mfn
+#define page_to_mfn(pg) _mfn(__page_to_mfn(pg))
 
 //#define DEBUG_11_ALLOCATION
 #ifdef DEBUG_11_ALLOCATION
@@ -104,16 +106,16 @@ static bool insert_11_bank(struct domain *d,
                            unsigned int order)
 {
     int res, i;
-    paddr_t spfn;
+    mfn_t smfn;
     paddr_t start, size;
 
-    spfn = page_to_mfn(pg);
-    start = pfn_to_paddr(spfn);
-    size = pfn_to_paddr((1 << order));
+    smfn = page_to_mfn(pg);
+    start = mfn_to_maddr(smfn);
+    size = pfn_to_paddr(1UL << order);
 
     D11PRINT("Allocated %#"PRIpaddr"-%#"PRIpaddr" (%ldMB/%ldMB, order %d)\n",
              start, start + size,
-             1UL << (order+PAGE_SHIFT-20),
+             1UL << (order + PAGE_SHIFT - 20),
              /* Don't want format this as PRIpaddr (16 digit hex) */
              (unsigned long)(kinfo->unassigned_mem >> 20),
              order);
@@ -126,7 +128,7 @@ static bool insert_11_bank(struct domain *d,
         goto fail;
     }
 
-    res = guest_physmap_add_page(d, _gfn(spfn), _mfn(spfn), order);
+    res = guest_physmap_add_page(d, _gfn(mfn_x(smfn)), smfn, order);
     if ( res )
         panic("Failed map pages to DOM0: %d", res);
 
@@ -167,7 +169,8 @@ static bool insert_11_bank(struct domain *d,
          */
         if ( start + size < bank->start && kinfo->mem.nr_banks < NR_MEM_BANKS )
         {
-            memmove(bank + 1, bank, sizeof(*bank)*(kinfo->mem.nr_banks - i));
+            memmove(bank + 1, bank,
+                    sizeof(*bank) * (kinfo->mem.nr_banks - i));
             kinfo->mem.nr_banks++;
             bank->start = start;
             bank->size = size;
-- 
2.11.0


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

  reply	other threads:[~2017-10-05 17:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05 17:42 [PATCH v2 0/9] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN Julien Grall
2017-10-05 17:42 ` Julien Grall [this message]
2017-10-05 17:42 ` [PATCH v2 2/9] xen/arm32: mm: Rework is_xen_heap_page to avoid nameclash Julien Grall
2017-10-05 17:42 ` [PATCH v2 3/9] xen/x86: mem_sharing: Use copy_domain_page in __mem_sharing_unshare_page Julien Grall
2017-10-05 17:49   ` Andrew Cooper
2017-10-05 17:52   ` Tamas K Lengyel
2017-10-05 17:42 ` [PATCH v2 4/9] xen/x86: Use maddr_to_page and maddr_to_mfn to avoid open-coded >> PAGE_SHIFT Julien Grall
2017-10-05 17:42 ` [PATCH v2 5/9] xen/kimage: Remove defined but unused variables Julien Grall
2017-10-05 17:42 ` [PATCH v2 6/9] xen/kexec, kimage: Convert kexec and kimage to use typesafe mfn_t Julien Grall
2017-10-05 17:51   ` Andrew Cooper
2017-10-05 17:42 ` [PATCH v2 7/9] xen/xenoprof: Convert the file to use typesafe MFN Julien Grall
2017-10-05 17:42 ` [PATCH v2 8/9] xen/tmem: Convert the file common/tmem_xen.c " Julien Grall
2017-10-05 17:42 ` [PATCH v2 9/9] xen: Convert __page_to_mfn and __mfn_to_page " Julien Grall
2017-10-05 17:59   ` Andrew Cooper
2017-10-05 18:31   ` Razvan Cojocaru
2017-10-06  9:11   ` Paul Durrant
2017-10-06 10:49     ` Julien Grall
2017-10-06 10:55       ` Paul Durrant
2017-10-06 11:00         ` Julien Grall
2017-10-06 11:44           ` Paul Durrant
2017-10-06 13:02   ` Boris Ostrovsky
2017-10-09 11:42   ` Jan Beulich
2017-10-09 12:20     ` Julien Grall
2017-10-09 13:40       ` Jan Beulich
2017-10-09 13:48         ` Julien Grall
2017-10-09 14:07           ` Jan Beulich
2017-10-10  5:18   ` Tian, Kevin

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=20171005174222.29161-2-julien.grall@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=sstabellini@kernel.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 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).