]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
xen/arm: Replace DIV_ROUND_UP(..., PAGE_SIZE) by PFN_UP(...)
authorJulien Grall <julien.grall@arm.com>
Tue, 13 Jun 2017 16:13:11 +0000 (17:13 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 15 Jun 2017 23:54:29 +0000 (16:54 -0700)
DIV_ROUND_UP(..., PAGE_SIZE) and PFN_UP(...) are equivalent.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/domain_build.c
xen/arch/arm/gic-v2.c
xen/arch/arm/gic-v3.c
xen/arch/arm/kernel.c

index a04c8862dba10f4fca08baf850783a1ae46abd28..a3243bdb5dfb8764294621203ce6754763934f18 100644 (file)
@@ -1008,7 +1008,7 @@ static int map_range_to_domain(const struct dt_device_node *dev,
     {
         res = map_regions_p2mt(d,
                                _gfn(paddr_to_pfn(addr)),
-                               DIV_ROUND_UP(len, PAGE_SIZE),
+                               PFN_UP(len),
                                _mfn(paddr_to_pfn(addr)),
                                mr_data->p2mt);
 
@@ -1545,7 +1545,7 @@ static void acpi_map_other_tables(struct domain *d)
         size = acpi_gbl_root_table_list.tables[i].length;
         res = map_regions_p2mt(d,
                                _gfn(paddr_to_pfn(addr)),
-                               DIV_ROUND_UP(size, PAGE_SIZE),
+                               PFN_UP(size),
                                _mfn(paddr_to_pfn(addr)),
                                p2m_mmio_direct_c);
         if ( res )
index b1ad69551ea82070678b6043da05d5e96fbad55a..26392267717e5e786fd5070c3f06a89c4b2f38e9 100644 (file)
@@ -598,7 +598,7 @@ static int gicv2_map_hwdown_extra_mappings(struct domain *d)
                v2m_data->spi_start, v2m_data->nr_spis);
 
         ret = map_mmio_regions(d, _gfn(paddr_to_pfn(v2m_data->addr)),
-                               DIV_ROUND_UP(v2m_data->size, PAGE_SIZE),
+                               PFN_UP(v2m_data->size),
                                _mfn(paddr_to_pfn(v2m_data->addr)));
         if ( ret )
         {
index c927306eae4c508d2b9047388a6c13fcfed1e955..f990eae832f894c2894110a7b7528f4bcfa9240a 100644 (file)
@@ -1303,7 +1303,7 @@ static int gicv3_iomem_deny_access(const struct domain *d)
     unsigned long mfn, nr;
 
     mfn = dbase >> PAGE_SHIFT;
-    nr = DIV_ROUND_UP(SZ_64K, PAGE_SIZE);
+    nr = PFN_UP(SZ_64K);
     rc = iomem_deny_access(d, mfn, mfn + nr);
     if ( rc )
         return rc;
@@ -1311,7 +1311,7 @@ static int gicv3_iomem_deny_access(const struct domain *d)
     for ( i = 0; i < gicv3.rdist_count; i++ )
     {
         mfn = gicv3.rdist_regions[i].base >> PAGE_SHIFT;
-        nr = DIV_ROUND_UP(gicv3.rdist_regions[i].size, PAGE_SIZE);
+        nr = PFN_UP(gicv3.rdist_regions[i].size);
         rc = iomem_deny_access(d, mfn, mfn + nr);
         if ( rc )
             return rc;
@@ -1320,7 +1320,7 @@ static int gicv3_iomem_deny_access(const struct domain *d)
     if ( cbase != INVALID_PADDR )
     {
         mfn = cbase >> PAGE_SHIFT;
-        nr = DIV_ROUND_UP(csize, PAGE_SIZE);
+        nr = PFN_UP(csize);
         rc = iomem_deny_access(d, mfn, mfn + nr);
         if ( rc )
             return rc;
@@ -1329,7 +1329,7 @@ static int gicv3_iomem_deny_access(const struct domain *d)
     if ( vbase != INVALID_PADDR )
     {
         mfn = vbase >> PAGE_SHIFT;
-        nr = DIV_ROUND_UP(csize, PAGE_SIZE);
+        nr = PFN_UP(csize);
         return iomem_deny_access(d, mfn, mfn + nr);
     }
 
index e2512c461234ed2c8733fe98f4212c0fdf1582f6..0ed8b6005c0230e3e6ba1bcbd8350c9881c9ff47 100644 (file)
@@ -312,7 +312,7 @@ static __init int kernel_decompress(struct bootmodule *mod)
      * Need to free pages after output_size here because they won't be
      * freed by discard_initial_modules
      */
-    i = DIV_ROUND_UP(output_size, PAGE_SIZE);
+    i = PFN_UP(output_size);
     for ( ; i < (1 << kernel_order_out); i++ )
         free_domheap_page(pages + i);