[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/13] virtio-iommu: Resize memory region according to the max io
From: |
Eric Auger |
Subject: |
[PATCH 12/13] virtio-iommu: Resize memory region according to the max iova info |
Date: |
Mon, 4 Sep 2023 10:03:55 +0200 |
By default the virtio-iommu MR has a 64b span. As we intend to
remove the VFIO assumption of 64b IOVA, let's make sure the MR
is resized according to the actual GAW of the physical IOMMU.
Otherwise we will get a failure on vfio vfio_find_hostwin().
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
hw/virtio/virtio-iommu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index d260235078..d877119df1 100644
--- a/hw/virtio/virtio-iommu.c
+++ b/hw/virtio/virtio-iommu.c
@@ -1180,8 +1180,14 @@ static int
virtio_iommu_set_iova_ranges(IOMMUMemoryRegion *mr,
Error **errp)
{
IOMMUDevice *sdev = container_of(mr, IOMMUDevice, iommu_mr);
+ uint64_t max_iova;
+
assert(nr_ranges);
+ max_iova = range_upb(&iova_ranges[nr_ranges - 1]);
+ if (max_iova < UINT64_MAX) {
+ memory_region_set_size(&mr->parent_obj, max_iova + 1);
+ }
range_inverse_array(nr_ranges, iova_ranges,
&sdev->nr_host_resv_regions, &sdev->host_resv_regions);
--
2.41.0
- [PATCH 05/13] virtio-iommu: Introduce per IOMMUDevice reserved regions, (continued)
- [PATCH 05/13] virtio-iommu: Introduce per IOMMUDevice reserved regions, Eric Auger, 2023/09/04
- [PATCH 06/13] range: Introduce range_inverse_array(), Eric Auger, 2023/09/04
- [PATCH 09/13] util/reserved-region: Add new ReservedRegion helpers, Eric Auger, 2023/09/04
- [PATCH 07/13] virtio-iommu: Implement set_iova_ranges() callback, Eric Auger, 2023/09/04
- [PATCH 11/13] test: Add some tests for range and resv-mem helpers, Eric Auger, 2023/09/04
- [PATCH 13/13] vfio: Remove 64-bit IOVA address space assumption, Eric Auger, 2023/09/04
- [PATCH 08/13] range: Make range_compare() public, Eric Auger, 2023/09/04
- [PATCH 12/13] virtio-iommu: Resize memory region according to the max iova info,
Eric Auger <=
- [PATCH 10/13] virtio-iommu: Consolidate host reserved regions and property set ones, Eric Auger, 2023/09/04
- Re: [PATCH 00/13] VIRTIO-IOMMU/VFIO: Don't assume 64b IOVA space, YangHang Liu, 2023/09/05
- Re: [PATCH 00/13] VIRTIO-IOMMU/VFIO: Don't assume 64b IOVA space, Alex Williamson, 2023/09/05