mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-17 21:26:13 -07: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
|
|
@ -1620,6 +1620,16 @@ vhost_user_crypto_close_session(struct vhost_dev *dev, uint64_t session_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool vhost_user_mem_section_filter(struct vhost_dev *dev,
|
||||
MemoryRegionSection *section)
|
||||
{
|
||||
bool result;
|
||||
|
||||
result = memory_region_get_fd(section->mr) >= 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const VhostOps user_ops = {
|
||||
.backend_type = VHOST_BACKEND_TYPE_USER,
|
||||
.vhost_backend_init = vhost_user_init,
|
||||
|
|
@ -1650,4 +1660,5 @@ const VhostOps user_ops = {
|
|||
.vhost_set_config = vhost_user_set_config,
|
||||
.vhost_crypto_create_session = vhost_user_crypto_create_session,
|
||||
.vhost_crypto_close_session = vhost_user_crypto_close_session,
|
||||
.vhost_backend_mem_section_filter = vhost_user_mem_section_filter,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue