[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 16/24] xen/arm: mm: Use typesafe mfn for xenheap_mfn_*



Hi Stefano,

On 06/16/2017 12:12 AM, Stefano Stabellini wrote:
On Tue, 13 Jun 2017, Julien Grall wrote:
       * Need enough mapped pages for copying the DTB.
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index a42da20f0a..3dab6dc9a1 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -115,7 +115,7 @@ struct page_info
  #define PGC_count_width   PG_shift(9)
  #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
-extern unsigned long xenheap_mfn_start, xenheap_mfn_end;
+extern mfn_t xenheap_mfn_start, xenheap_mfn_end;
  extern vaddr_t xenheap_virt_end;
  #ifdef CONFIG_ARM_64
  extern vaddr_t xenheap_virt_start;
@@ -125,7 +125,8 @@ extern vaddr_t xenheap_virt_start;
  #define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
  #define is_xen_heap_mfn(mfn) ({                                 \
      unsigned long _mfn = (mfn);                                 \
-    (_mfn >= xenheap_mfn_start && _mfn < xenheap_mfn_end);      \
+    (_mfn >= mfn_x(xenheap_mfn_start) &&                        \
+     _mfn < mfn_x(xenheap_mfn_end));                            \

Do you think that mfn_less_than() and mfn_greater_than() would be helpful?

I forgot to answer this one. I have looked at the place comparing (other than = and !=) typesafe MFN and I haven't found many. So I didn't see the need to introduce helpers for that.

If notice an increase of them, we can decide to introduce one. It will be easy to find as they would have explicit mfn_x in the code.

Cheers,

--
Julien Grall

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.