From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1CF1A0613 for ; Tue, 24 Sep 2019 07:26:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE3A02BF2; Tue, 24 Sep 2019 07:26:08 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3219F2956 for ; Tue, 24 Sep 2019 07:26:06 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 22:26:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,542,1559545200"; d="scan'208";a="189259534" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.73]) by fmsmga007.fm.intel.com with ESMTP; 23 Sep 2019 22:26:04 -0700 Date: Tue, 24 Sep 2019 13:23:17 +0800 From: Tiwei Bie To: Adrian Moreno Cc: dev@dpdk.org, zhihong.wang@intel.com, Maxime Coquelin , Pei Zhang Message-ID: <20190924052317.GA28807@___> References: <20190917144900.14407-1-amorenoz@redhat.com> <20190923072515.GA20810@___> <21f69f49-5921-bf3b-9655-f986d68d7202@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <21f69f49-5921-bf3b-9655-f986d68d7202@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] vhost: translate incoming log address to gpa X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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