aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/vhost.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2018-03-23 15:39:39 +0000
committerMichael S. Tsirkin <mst@redhat.com>2018-04-09 17:35:46 +0300
commite7b94a84b6cb4a632c558ed24e8d6f4baa3f75eb (patch)
tree2db07a4e59fa1e4ff37788772aeae7a38b2e1608 /hw/virtio/vhost.c
parentea3e6f5a93f77fa068b7858b714057e4bbde67cb (diff)
vhost: Allow adjoining regions
My rework of section adding combines overlapping or adjoining regions, but checks they're actually the same underlying RAM block. Fix the case where two blocks adjoin but don't overlap; that new region should get added (but not combined), but my previous patch was disallowing it. Fixes: c1ece84e7c9 Reported-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Tested-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/vhost.c')
-rw-r--r--hw/virtio/vhost.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index b6c314e350..a21a5a2ca1 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -595,10 +595,15 @@ static void vhost_region_add_section(struct vhost_dev *dev,
prev_sec->offset_within_address_space,
prev_sec->offset_within_region);
} else {
- error_report("%s: Overlapping but not coherent sections "
- "at %"PRIx64,
- __func__, mrs_gpa);
- return;
+ /* adjoining regions are fine, but overlapping ones with
+ * different blocks/offsets shouldn't happen
+ */
+ if (mrs_gpa != prev_gpa_end + 1) {
+ error_report("%s: Overlapping but not coherent sections "
+ "at %"PRIx64,
+ __func__, mrs_gpa);
+ return;
+ }
}
}
}