|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 5/7] xen/mm: device-tree: Widen static page counts to unsigned long
As the domstatic memory plumbing supports unsigned long nr_mfns,
update the device tree handlers to no longer truncate to unsigned int:
- xen/common/device-tree/static-memory.c:
- append_static_memory_to_bank() Widen nr_pages to unsigned long
- xen/common/device-tree/static-shmem.c:
- process_shm(): Widen loop variable to unsigned long.
- xen/common/device-tree/dom0less-build.c, static-shmem.c,
- alloc_xenstore_page() and acquire_shared_memory_bank():
Update checks narrowing pages to UINT_MAX to ULONG_MAX.
- xen/arch/arm/include/asm/p2m.h: guest_physmap_add_pages():
Accept and pass-through unsigned long nr_pages(used for static maps)
Already correct:
- struct paging_domain.p2m_total_pages is unsigned long.
- p2m_set_allocation() takes unsigned long pages.
- arch_get_paging_mempool_size() uses (uint64_t)... << PAGE_SHIFT.
- p2m_insert_mapping(), map_regions_p2mt(), unmap_regions_p2mt(),
map_mmio_regions() and unmap_mmio_regions() all already take
unsigned long nr.
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@xxxxxxxxxx>
---
xen/arch/arm/include/asm/p2m.h | 2 +-
xen/common/device-tree/dom0less-build.c | 2 +-
xen/common/device-tree/static-memory.c | 2 +-
xen/common/device-tree/static-shmem.c | 9 ++++-----
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h
index 4a4913716bdd..f719b8f1291f 100644
--- a/xen/arch/arm/include/asm/p2m.h
+++ b/xen/arch/arm/include/asm/p2m.h
@@ -348,7 +348,7 @@ guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t
mfn,
static inline int guest_physmap_add_pages(struct domain *d,
gfn_t gfn,
mfn_t mfn,
- unsigned int nr_pages)
+ unsigned long nr_pages)
{
return p2m_insert_mapping(d, gfn, nr_pages, mfn, p2m_ram_rw);
}
diff --git a/xen/common/device-tree/dom0less-build.c
b/xen/common/device-tree/dom0less-build.c
index eacfd93087ae..16c72682db54 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -592,7 +592,7 @@ static int __init alloc_xenstore_page(struct domain *d)
gfn_t gfn;
int rc;
- if ( (UINT_MAX - d->max_pages) < 1 )
+ if ( (ULONG_MAX - d->max_pages) < 1 )
{
printk(XENLOG_ERR "%pd: Over-allocation for d->max_pages by 1 page.\n",
d);
diff --git a/xen/common/device-tree/static-memory.c
b/xen/common/device-tree/static-memory.c
index e04d6cc06505..3abc62f080e5 100644
--- a/xen/common/device-tree/static-memory.c
+++ b/xen/common/device-tree/static-memory.c
@@ -11,7 +11,7 @@ static bool __init append_static_memory_to_bank(struct domain
*d,
paddr_t size)
{
int res;
- unsigned int nr_pages = PFN_DOWN(size);
+ unsigned long nr_pages = PFN_DOWN(size);
gfn_t sgfn;
/*
diff --git a/xen/common/device-tree/static-shmem.c
b/xen/common/device-tree/static-shmem.c
index 4c4cc1b123ac..64ed04e68487 100644
--- a/xen/common/device-tree/static-shmem.c
+++ b/xen/common/device-tree/static-shmem.c
@@ -96,7 +96,7 @@ static mfn_t __init acquire_shared_memory_bank(struct domain
*d,
* into domain_tot_pages().
*/
nr_pfns = PFN_DOWN(psize);
- if ( (UINT_MAX - d->max_pages) < nr_pfns )
+ if ( (ULONG_MAX - d->max_pages) < nr_pfns )
{
printk(XENLOG_ERR "%pd: Over-allocation for d->max_pages: %lu.\n",
d, nr_pfns);
@@ -313,7 +313,6 @@ int __init process_shm(struct domain *d, struct kernel_info
*kinfo,
uint32_t addr_cells;
paddr_t gbase, pbase, psize;
int ret = 0;
- unsigned int i;
const char *role_str;
const char *shm_id;
@@ -362,11 +361,11 @@ int __init process_shm(struct domain *d, struct
kernel_info *kinfo,
return -EINVAL;
}
- for ( i = 0; i < PFN_DOWN(psize); i++ )
- if ( !mfn_valid(mfn_add(maddr_to_mfn(pbase), i)) )
+ for ( unsigned long page = 0; page < PFN_DOWN(psize); page++ )
+ if ( !mfn_valid(mfn_add(maddr_to_mfn(pbase), page)) )
{
printk("%pd: invalid physical address 0x%"PRI_mfn"\n",
- d, mfn_x(mfn_add(maddr_to_mfn(pbase), i)));
+ d, mfn_x(mfn_add(maddr_to_mfn(pbase), page)));
return -EINVAL;
}
--
2.39.5
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |