qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for 2.9] vhost: generalize iommu memory region


From: Maxime Coquelin
Subject: Re: [Qemu-devel] [PATCH for 2.9] vhost: generalize iommu memory region
Date: Wed, 29 Mar 2017 09:07:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0



On 03/29/2017 06:10 AM, Jason Wang wrote:
We assumes the iommu_ops were attached to the root region of address
space. This may not be true for all kinds of IOMMU implementation and
especially after commit 3716d5902d74 ("pci: introduce a bus master
container"). So fix this by not assuming as->root has iommu_ops,
instead depending on the regions reported by memory listener through:

- register a memory listener to dma_as
- during region_add, if it's a region of IOMMU, register a specific
  IOMMU notifier, and store all notifiers in a list.
- during region_del, compare and delete the IOMMU notifier from the list

This is also a must for making vhost device IOTLB works for all types
of IOMMUs. Note, since we register one notifier during each
.region_add, the IOTLB may be flushed more than one times, this is
suboptimal and could be optimized in the future.

Reported-by: Maxime Coquelin <address@hidden>
Fixes: 3716d5902d74 ("pci: introduce a bus master container")
Cc: Peter Xu <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
 hw/virtio/vhost.c         | 84 ++++++++++++++++++++++++++++++++++++-----------
 include/hw/virtio/vhost.h | 11 +++++++
 2 files changed, 75 insertions(+), 20 deletions(-)

Tested-by: Maxime Coquelin <address@hidden>

Thanks!
Maxime



reply via email to

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