[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v11 1/2] vhost-vdpa: Skip the range check while MR is IOMMU
From: |
Jason Wang |
Subject: |
Re: [PATCH v11 1/2] vhost-vdpa: Skip the range check while MR is IOMMU |
Date: |
Thu, 8 Dec 2022 15:42:26 +0800 |
On Wed, Nov 30, 2022 at 1:33 PM Cindy Lu <lulu@redhat.com> wrote:
>
> Skip the check in vhost_vdpa_listener_skipped_section() while
> MR is IOMMU, Move this check to vhost_vdpa_iommu_map_notify()
>
> Signed-off-by: Cindy Lu <lulu@redhat.com>
> ---
> hw/virtio/vhost-vdpa.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 3ff9ce3501..f0e9963d19 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -60,15 +60,22 @@ static bool
> vhost_vdpa_listener_skipped_section(MemoryRegionSection *section,
> iova_min, section->offset_within_address_space);
> return true;
> }
> + /*
> + * While using vIOMMU, Sometimes the section will be larger than iova_max
> + * but the memory that actually mapping is smaller, So skip the check
> + * here. Will add the check in vhost_vdpa_iommu_map_notify,
> + *There is the real size that maps to the kernel
> + */
>
I suggest squashing this into the next patch since we haven't
implemented vhost_vdpa_iommu_map_notify() yet.
Thanks
> - llend = vhost_vdpa_section_end(section);
> - if (int128_gt(llend, int128_make64(iova_max))) {
> - error_report("RAM section out of device range (max=0x%" PRIx64
> - ", end addr=0x%" PRIx64 ")",
> - iova_max, int128_get64(llend));
> - return true;
> + if (!memory_region_is_iommu(section->mr)) {
> + llend = vhost_vdpa_section_end(section);
> + if (int128_gt(llend, int128_make64(iova_max))) {
> + error_report("RAM section out of device range (max=0x%" PRIx64
> + ", end addr=0x%" PRIx64 ")",
> + iova_max, int128_get64(llend));
> + return true;
> + }
> }
> -
> return false;
> }
>
> --
> 2.34.3
>
- Re: [PATCH v11 1/2] vhost-vdpa: Skip the range check while MR is IOMMU,
Jason Wang <=