mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
vhost: allow backends to filter memory sections
This patch introduces a vhost op for vhost backends to allow them to filter the memory sections that they can handle. Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
63b88968f1
commit
988a27754b
3 changed files with 22 additions and 2 deletions
|
@ -386,7 +386,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
|
|||
return r;
|
||||
}
|
||||
|
||||
static bool vhost_section(MemoryRegionSection *section)
|
||||
static bool vhost_section(struct vhost_dev *dev, MemoryRegionSection *section)
|
||||
{
|
||||
bool result;
|
||||
bool log_dirty = memory_region_get_dirty_log_mask(section->mr) &
|
||||
|
@ -399,6 +399,11 @@ static bool vhost_section(MemoryRegionSection *section)
|
|||
*/
|
||||
result &= !log_dirty;
|
||||
|
||||
if (result && dev->vhost_ops->vhost_backend_mem_section_filter) {
|
||||
result &=
|
||||
dev->vhost_ops->vhost_backend_mem_section_filter(dev, section);
|
||||
}
|
||||
|
||||
trace_vhost_section(section->mr->name, result);
|
||||
return result;
|
||||
}
|
||||
|
@ -632,7 +637,7 @@ static void vhost_region_addnop(MemoryListener *listener,
|
|||
struct vhost_dev *dev = container_of(listener, struct vhost_dev,
|
||||
memory_listener);
|
||||
|
||||
if (!vhost_section(section)) {
|
||||
if (!vhost_section(dev, section)) {
|
||||
return;
|
||||
}
|
||||
vhost_region_add_section(dev, section);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue