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

[Xen-changelog] [xen master] xen/arm: mm: fix nr_second calculation in setup_frametable_mappings



commit 2c86f0e1ac35b4c9e9502d969693f3264d3eda1e
Author:     Peng Fan <van.freenix@xxxxxxxxx>
AuthorDate: Thu May 12 21:03:08 2016 +0800
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Mon May 16 16:27:04 2016 +0100

    xen/arm: mm: fix nr_second calculation in setup_frametable_mappings
    
    On ARM64, "frametable_size >> SECOND_SHIFT" computes the number
    of second level entries, not the number of second level pages.
    
    "ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT" which computes
    the number of the first level entries (the number of second level pages),
    is the correct one that should be used.
    
    Signed-off-by: Peng Fan <van.freenix@xxxxxxxxx>
    Reviewed-by: Julien Grall <julien.grall@xxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/mm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 94ea054..b46e23e 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -770,7 +770,8 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t 
pe)
     base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12));
 
 #ifdef CONFIG_ARM_64
-    nr_second = frametable_size >> SECOND_SHIFT;
+    /* Compute the number of second level pages. */
+    nr_second = ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT;
     second_base = alloc_boot_pages(nr_second, 1);
     second = mfn_to_virt(second_base);
     for ( i = 0; i < nr_second; i++ )
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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