From: Jason Wang <jasowang@redhat.com>
To: Cindy Lu <lulu@redhat.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org
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 [thread overview]
Message-ID: <CACGkMEvhg1gpF73XaNTYn_qRa9oOsye7rhkXHMSJ425M=f3cBw@mail.gmail.com> (raw)
In-Reply-To: <20221130053251.2606831-2-lulu@redhat.com>
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
>
next prev parent reply other threads:[~2022-12-08 7:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 5:32 [PATCH v11 0/2] vhost-vdpa: add support for vIOMMU Cindy Lu
2022-11-30 5:32 ` [PATCH v11 1/2] vhost-vdpa: Skip the range check while MR is IOMMU Cindy Lu
2022-12-08 7:42 ` Jason Wang [this message]
2022-12-08 8:15 ` Cindy Lu
2022-11-30 5:32 ` [PATCH v11 2/2] vhost-vdpa: add support for vIOMMU Cindy Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACGkMEvhg1gpF73XaNTYn_qRa9oOsye7rhkXHMSJ425M=f3cBw@mail.gmail.com' \
--to=jasowang@redhat.com \
--cc=lulu@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).