From: Tiwei Bie <tiwei.bie@intel.com>
To: Adrian Moreno <amorenoz@redhat.com>
Cc: dev@dpdk.org, zhihong.wang@intel.com,
Maxime Coquelin <maxime.coquelin@redhat.com>,
Pei Zhang <pezhang@redhat.com>
Subject: Re: [dpdk-dev] [PATCH] vhost: translate incoming log address to gpa
Date: Tue, 24 Sep 2019 13:23:17 +0800 [thread overview]
Message-ID: <20190924052317.GA28807@___> (raw)
In-Reply-To: <21f69f49-5921-bf3b-9655-f986d68d7202@redhat.com>
On Mon, Sep 23, 2019 at 12:28:35PM +0200, Adrian Moreno wrote:
> On 9/23/19 9:25 AM, Tiwei Bie wrote:
> > On Tue, Sep 17, 2019 at 04:49:00PM +0200, Adrian Moreno wrote:
> >> When IOMMU is enabled the incoming log address is in IOVA space. In that
> >> case, look in IOTLB table and translate the resulting HVA to GPA.
> >>
> >> If IOMMU is not enabled, the incoming log address is already a GPA so no
> >> transformation is needed.
> >>
> >> This change makes page logging work when IOVA_VA is selected in the guest.
> >
> > Besides the log address of the ring, when IOMMU is enabled,
> > the addresses in descriptors are also IOVAs and should be
> > translated to GPAs before doing the dirty page logging.
> >
> Thanks Tiwei. You're right. In fact, it's not the only place where IOVAs are
> assumed to be GPAs, for example in vhost.h:gpa_to_hpa:
>
> /* Convert guest physical address to host physical address */
> static __rte_always_inline rte_iova_t
> gpa_to_hpa(struct virtio_net *dev, uint64_t gpa, uint64_t size)
> {
> uint32_t i;
> struct guest_page *page;
>
> for (i = 0; i < dev->nr_guest_pages; i++) {
> page = &dev->guest_pages[i];
>
> if (gpa >= page->guest_phys_addr &&
> gpa + size < page->guest_phys_addr + page->size) {
> return gpa - page->guest_phys_addr +
> page->host_phys_addr;
> }
> }
>
> return 0;
> }
>
> used in ZERO-COPY mode to check if the IOVA range is continuous in host physical
> memory and called buffer IOVAs. If I'm not mistaken this should also be
> translated as:
>
> IOVA --> HVA (iotlb lookup)
> HVA --> GPA (mem_region lookup)
> GPA --> HIOVA (guest_page lookup)
>
> Right?
Yeah, these IOVAs also shouldn't be assumed as GPAs.
Thanks,
Tiwei
prev parent reply other threads:[~2019-09-24 5:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 14:49 [dpdk-dev] [PATCH] vhost: translate incoming log address to gpa Adrian Moreno
2019-09-23 7:25 ` Tiwei Bie
2019-09-23 10:28 ` Adrian Moreno
2019-09-24 5:23 ` Tiwei Bie [this message]
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=20190924052317.GA28807@___ \
--to=tiwei.bie@intel.com \
--cc=amorenoz@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=pezhang@redhat.com \
--cc=zhihong.wang@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.