qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v3 7/7] virtio/vhost.c: vhost-p


From: Wei Wang
Subject: Re: [Qemu-devel] [virtio-dev] Re: [PATCH v3 7/7] virtio/vhost.c: vhost-pci needs remote gpa
Date: Wed, 06 Dec 2017 18:46:08 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 12/06/2017 12:05 AM, Stefan Hajnoczi wrote:
On Tue, Dec 05, 2017 at 11:33:16AM +0800, Wei Wang wrote:
The vhost-pci driver uses the remote guest physical address to send/receive
packets from the remote guest, so when sending the ving info to the vhost-pci
device, send the guest physical adress directly.

Signed-off-by: Wei Wang <address@hidden>
---
  hw/virtio/vhost.c | 56 +++++++++++++++++++++++++++++++++++--------------------
  1 file changed, 36 insertions(+), 20 deletions(-)
Can you do it inside vhost_memory_map()/vhost_memory_unmap() instead of
modifying callers?

Looks like vhost_dev_has_iommu() already takes this approach:

   static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr,
                                 hwaddr *plen, int is_write)
   {
       if (!vhost_dev_has_iommu(dev)) {
           return cpu_physical_memory_map(addr, plen, is_write);
       } else {
           return (void *)(uintptr_t)addr;
       }
   }

   static void vhost_memory_unmap(struct vhost_dev *dev, void *buffer,
                                  hwaddr len, int is_write,
                                  hwaddr access_len)
   {
       if (!vhost_dev_has_iommu(dev)) {
           cpu_physical_memory_unmap(buffer, len, is_write, access_len);
       }
   }

Thanks for the reminder. I think this patch may be not needed with adding the F_IOMMU_PLATFORM feature.


Best,
Wei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]