|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 1/4] xen/arm: guest_walk: refuse a block descriptor where the granule has none
Hello Stefano,
Stefano Stabellini <stefano.stabellini@xxxxxxx> writes:
> guest_walk_ld() accepted a block descriptor at any level. No granule has
> level 0 blocks, and the 16KB and 64KB granules have no level 1 blocks
> (ARM DDI 0487 M.d D8.3.1.2): the translation table walk makes such an
> entry a Translation fault (AArch64.BlockDescSupported()). Refuse it.
>
> The check is only valid without 52-bit support (FEAT_LPA, FEAT_LPA2).
> Note in get_ipa_output_size() that 52-bit support requires updating it.
>
> Fixes: 7d623b358a45 ("arm/mem_access: Add long-descriptor based gpt")
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
> ---
> Cc: Julien Grall <julien@xxxxxxx>
> Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>
> Cc: Michal Orzel <michal.orzel@xxxxxxx>
> Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
>
> Changes in v2:
> - Cite ARM DDI 0487 M.d instead of A.k.
> - Say in the commit message and the comment that the check is only
> valid without 52-bit support (FEAT_LPA, FEAT_LPA2), and note in
> get_ipa_output_size() that 52-bit support requires updating it.
> - Move the Cc list after ---.
> ---
> xen/arch/arm/guest_walk.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
> index 09fe486598..151b837541 100644
> --- a/xen/arch/arm/guest_walk.c
> +++ b/xen/arch/arm/guest_walk.c
> @@ -201,7 +201,8 @@ static int get_ipa_output_size(struct domain *d,
> register_t tcr,
> * Return an error on reserved IPA output-sizes and if the IPA
> * output-size is 52bit.
> *
> - * XXX: 52 bit output-size is not supported yet.
> + * XXX: 52 bit output-size is not supported yet. Supporting it also
> + * requires updating the block descriptor check in guest_walk_ld().
> */
> if ( ips > TCR_EL1_IPS_48_BIT )
> return -EFAULT;
> @@ -533,6 +534,17 @@ static bool guest_walk_ld(const struct vcpu *v,
> if ( !lpae_is_valid(pte) || !lpae_is_mapping(pte, level) )
> return false;
>
> + /*
> + * A block descriptor is only supported at level 1 and level 2 with the
> + * 4KB granule, and only at level 2 with the 16KB and 64KB granules (ARM
> + * DDI 0487 M.d D8.3.1.2). The block encoding at any other level
> generates
> + * a Translation fault (AArch64.BlockDescSupported()).
> + *
> + * This is only valid without 52-bit support (FEAT_LPA, FEAT_LPA2).
> + */
> + if ( level == 0 || (level == 1 && gran != GRANULE_SIZE_INDEX_4K) )
> + return false;
> +
> /* Make sure that the lower bits of the PTE's base address are zero. */
> mask = GENMASK_ULL(47, grainsizes[gran]);
> *ipa = (pfn_to_paddr(pte.walk.base) & mask) |
--
WBR, Volodymyr
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |