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