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

[PATCH 4/7] xen/mm: Static memory: Widen domstatic plumbing to unsigned long



As assign_pages() accepts unsigned long nr, we can widen
its domstatic users to pass unsigned long nr_mfns to it:

- acquire_domstatic_pages(), assign_domstatic_pages(): Widen nr_mfns.
- acquire_static_memory_bank() remove check for psize to fit in unsigned int

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@xxxxxxxxxx>
---
 xen/common/device-tree/static-memory.c | 7 -------
 xen/common/page_alloc.c                | 4 ++--
 xen/include/xen/mm.h                   | 2 +-
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/xen/common/device-tree/static-memory.c 
b/xen/common/device-tree/static-memory.c
index ffbc12aa24df..e04d6cc06505 100644
--- a/xen/common/device-tree/static-memory.c
+++ b/xen/common/device-tree/static-memory.c
@@ -46,13 +46,6 @@ static mfn_t __init acquire_static_memory_bank(struct domain 
*d,
 
     device_tree_get_reg(cell, addr_cells, size_cells, pbase, psize);
     ASSERT(IS_ALIGNED(*pbase, PAGE_SIZE) && IS_ALIGNED(*psize, PAGE_SIZE));
-    if ( PFN_DOWN(*psize) > UINT_MAX )
-    {
-        printk(XENLOG_ERR "%pd: static memory size too large: %#"PRIpaddr,
-               d, *psize);
-        return INVALID_MFN;
-    }
-
     smfn = maddr_to_mfn(*pbase);
     res = acquire_domstatic_pages(d, smfn, PFN_DOWN(*psize), 0);
     if ( res )
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 8670233c550d..cb2618f6aee5 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -3368,7 +3368,7 @@ static struct page_info * __init 
acquire_staticmem_pages(mfn_t smfn,
 }
 
 static int assign_domstatic_pages(struct domain *d, struct page_info *pg,
-                                  unsigned int nr_mfns, unsigned int memflags)
+                                  unsigned long nr_mfns, unsigned int memflags)
 {
     if ( !d || (memflags & (MEMF_no_owner | MEMF_no_refcount)) )
     {
@@ -3391,7 +3391,7 @@ static int assign_domstatic_pages(struct domain *d, 
struct page_info *pg,
  * then assign them to one specific domain #d.
  */
 int __init acquire_domstatic_pages(struct domain *d, mfn_t smfn,
-                                   unsigned int nr_mfns, unsigned int memflags)
+                                   unsigned long nr_mfns, unsigned int 
memflags)
 {
     struct page_info *pg;
 
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index b4330269418d..48feb664f057 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -107,7 +107,7 @@ bool scrub_free_pages(void);
 void unprepare_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
                                bool need_scrub);
 void free_domstatic_page(struct page_info *page);
-int acquire_domstatic_pages(struct domain *d, mfn_t smfn, unsigned int nr_mfns,
+int acquire_domstatic_pages(struct domain *d, mfn_t smfn, unsigned long 
nr_mfns,
                             unsigned int memflags);
 
 /* Map machine page range in Xen virtual address space. */
-- 
2.39.5




 


Rackspace

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