[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v3 2/5] vhost-iova-tree: Remove range check for IOVA allocator
From: |
Eugenio Perez Martin |
Subject: |
Re: [RFC v3 2/5] vhost-iova-tree: Remove range check for IOVA allocator |
Date: |
Thu, 16 Jan 2025 18:02:21 +0100 |
On Fri, Jan 10, 2025 at 6:09 PM Jonah Palmer <jonah.palmer@oracle.com> wrote:
>
> Removes the range check portion in vhost_iova_tree_map_alloc.
>
> The previous patch decoupled the IOVA allocator from adding mappings to
> the IOVA->HVA tree (now a partial SVQ IOVA->HVA tree) and instead adds
> the allocated IOVA range to an IOVA-only tree. No value exists under
> translated_addr for the IOVA-only mappings, so this check is no longer
> needed.
>
> This check was moved to vhost_iova_tree_insert in the previous patch
> since that function handles adding IOVA->HVA mappings to the SVQ
> IOVA->HVA tree.
>
> Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
> ---
> hw/virtio/vhost-iova-tree.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/virtio/vhost-iova-tree.c b/hw/virtio/vhost-iova-tree.c
> index b1cfd17843..f6a5694857 100644
> --- a/hw/virtio/vhost-iova-tree.c
> +++ b/hw/virtio/vhost-iova-tree.c
> @@ -93,8 +93,7 @@ int vhost_iova_tree_map_alloc(VhostIOVATree *tree, DMAMap
> *map)
> /* Some vhost devices do not like addr 0. Skip first page */
> hwaddr iova_first = tree->iova_first ?: qemu_real_host_page_size();
>
This is not a static function, so I guess it is better to duplicate
the check if needed? Otherwise a buggy caller can create invalid
entries.
> - if (map->translated_addr + map->size < map->translated_addr ||
> - map->perm == IOMMU_NONE) {
> + if (map->perm == IOMMU_NONE) {
> return IOVA_ERR_INVALID;
> }
>
> --
> 2.43.5
>
- [RFC v3 0/5] Handling aliased guest memory maps in vhost-vDPA SVQs, Jonah Palmer, 2025/01/10
- [RFC v3 2/5] vhost-iova-tree: Remove range check for IOVA allocator, Jonah Palmer, 2025/01/10
- Re: [RFC v3 2/5] vhost-iova-tree: Remove range check for IOVA allocator,
Eugenio Perez Martin <=
- [RFC v3 3/5] vhost-vdpa: Implement the GPA->IOVA tree, Jonah Palmer, 2025/01/10
- [RFC v3 4/5] virtio: add in_xlat_addr & out_xlat_addr VirtQueueElement members, Jonah Palmer, 2025/01/10
- [RFC v3 5/5] svq: Support translations via GPAs in vhost_svq_translate_addr, Jonah Palmer, 2025/01/10
- [RFC v3 1/5] vhost-vdpa: Decouple the IOVA allocator, Jonah Palmer, 2025/01/10