]> xenbits.xensource.com Git - people/dwmw2/xen.git/commit
xen/arm: fix mask calculation in pdx_init_mask
authorStefano Stabellini <sstabellini@kernel.org>
Fri, 21 Jun 2019 20:20:25 +0000 (13:20 -0700)
committerStefano Stabellini <sstabellini@kernel.org>
Fri, 21 Jun 2019 21:07:47 +0000 (14:07 -0700)
commit11911563610786615c2b3a01cdcaaf09a6f9e38d
tree6316af1832abc74a5c5913f73d9a7488437b1019
parenteb63e1225aba04c959eeb68eda99e422939c37de
xen/arm: fix mask calculation in pdx_init_mask

The mask calculation in pdx_init_mask is wrong when the first bank
starts at address 0x0. The reason is that pdx_init_mask will do '0 - 1'
causing an underflow. As a result, the mask becomes 0xffffffffffffffff
which is the biggest possible mask and ends up causing a significant
memory waste in the frametable size computation.

For instance, on platforms that have a low memory bank starting at 0x0
and a high memory bank, the frametable will end up covering all the
holes in between.

The purpose of the mask is to be passed as a parameter to
pfn_pdx_hole_setup, which based on the mask parameter calculates
pfn_pdx_hole_shift, pfn_pdx_bottom_mask, etc. which are actually the
important masks for frametable initialization later on.

pfn_pdx_hole_setup never compresses addresses below MAX_ORDER bits (1GB
on ARM). Thus, it is safe to initialize mask passing 1ULL << (MAX_ORDER
+ PAGE_SHIFT) as start address to pdx_init_mask.

Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/arm/setup.c
xen/common/pdx.c