xen/arm: guest_walk: Fix get_ipa_output_size
authorJulien Grall <julien.grall@linaro.org>
Wed, 11 Oct 2017 14:29:02 +0000 (15:29 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 11 Oct 2017 18:44:45 +0000 (11:44 -0700)
commite692f0f9a2e5898a3251c956d3c9d18c7260186a
tree374983410e3f07917f6e3ab6a0a7ae127b6f36a2
parent8b3231a83483b6e4a27fd54cfad04ed2c168d4bf
xen/arm: guest_walk: Fix get_ipa_output_size

The function get_ipa_output_size checks whether the input size
configured by the guest is valid and will return it.

The check is done with the IPS already shifted against
TCR_EL1_IPS_48_BIT. However the constant has been defined with the
shift included, as a result the check is always false.

Fix it by doing the check on the non-shifted value.

This was introduced by commit 7d623b358a "arm/mem_access: Add long-descriptor
based gpt" introduced software page-table walk for stage-1.

Note that the IPS code is now surrounded with #ifdef CONFIG_ARM_64
because the Arm32 compiler will complain of shift bigger than the width
of the variable. This is fine as the code is executed for 64-bit domain only.

Coverity-ID: 1457707
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Sergej Proskurin <proskurin@sec.in.tum.de>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/guest_walk.c