aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/vhost.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-04-21 10:23:56 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-04-21 10:23:56 +0100
commit7cd37925a17768c0ddef62ffadcb93e9e590d406 (patch)
tree041b7bb581e1bed3f1665f92f0d40d0bc1b96e19 /hw/virtio/vhost.c
parentfa54abb8c298f892639ffc4bc2f61448ac3be4a1 (diff)
parentbe9721f400f7e5395bb2a257c291557df8f3f833 (diff)
downloadqemu-7cd37925a17768c0ddef62ffadcb93e9e590d406.zip
qemu-7cd37925a17768c0ddef62ffadcb93e9e590d406.tar.gz
qemu-7cd37925a17768c0ddef62ffadcb93e9e590d406.tar.bz2
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-pull-request' into staging
Machine queue for 2.10 # gpg: Signature made Thu 20 Apr 2017 19:44:27 BST # gpg: using RSA key 0x2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-pull-request: qdev: Constify local variable returned by blk_bs qdev: Constify value passed to qdev_prop_set_macaddr hostmem: use host_memory_backend_mr_inited() where proper hostmem: introduce host_memory_backend_mr_inited() hw/core/null-machine: Print error message when using the -kernel parameter qdev: Make "hotplugged" property read-only intel_iommu: enable remote IOTLB intel_iommu: allow dynamic switch of IOMMU region intel_iommu: provide its own replay() callback intel_iommu: use the correct memory region for device IOTLB notification memory: add MemoryRegionIOMMUOps.replay() callback memory: introduce memory_region_notify_one() memory: provide iommu_replay_all() memory: provide IOMMU_NOTIFIER_FOREACH macro memory: add section range info for IOMMU notifier Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio/vhost.c')
-rw-r--r--hw/virtio/vhost.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 613494d..0001e60 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -736,14 +736,20 @@ static void vhost_iommu_region_add(MemoryListener *listener,
struct vhost_dev *dev = container_of(listener, struct vhost_dev,
iommu_listener);
struct vhost_iommu *iommu;
+ Int128 end;
if (!memory_region_is_iommu(section->mr)) {
return;
}
iommu = g_malloc0(sizeof(*iommu));
- iommu->n.notify = vhost_iommu_unmap_notify;
- iommu->n.notifier_flags = IOMMU_NOTIFIER_UNMAP;
+ end = int128_add(int128_make64(section->offset_within_region),
+ section->size);
+ end = int128_sub(end, int128_one());
+ iommu_notifier_init(&iommu->n, vhost_iommu_unmap_notify,
+ IOMMU_NOTIFIER_UNMAP,
+ section->offset_within_region,
+ int128_get64(end));
iommu->mr = section->mr;
iommu->iommu_offset = section->offset_within_address_space -
section->offset_within_region;
@@ -765,7 +771,8 @@ static void vhost_iommu_region_del(MemoryListener *listener,
}
QLIST_FOREACH(iommu, &dev->iommu_list, iommu_next) {
- if (iommu->mr == section->mr) {
+ if (iommu->mr == section->mr &&
+ iommu->n.start == section->offset_within_region) {
memory_region_unregister_iommu_notifier(iommu->mr,
&iommu->n);
QLIST_REMOVE(iommu, iommu_next);