Projects
home:dongzhihai
qemu
_service:tar_scm:vdpa-move-memory-listener-to-t...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:vdpa-move-memory-listener-to-the-realize-stage.patch of Package qemu
From 587f42300488af4478d7aa1b62e2b351155621db Mon Sep 17 00:00:00 2001 From: libai <libai12@huawei.com> Date: Mon, 4 Dec 2023 16:01:16 +0800 Subject: [PATCH] vdpa: move memory listener to the realize stage Move the memory listener registration of vdpa from the start stage to the realize stage. Avoid that in the start phase, the memory listener callback function has not yet been processed. Signed-off-by: libai <libai12@huawei.com> --- hw/virtio/vdpa-dev.c | 4 ++++ hw/virtio/vhost-vdpa.c | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 6af78a4229..877bf7464f 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -30,6 +30,7 @@ #include "sysemu/runstate.h" #include "hw/virtio/vdpa-dev-mig.h" #include "migration/migration.h" +#include "exec/address-spaces.h" static void vhost_vdpa_device_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq) @@ -125,6 +126,7 @@ static void vhost_vdpa_device_realize(DeviceState *dev, Error **errp) goto free_vqs; } + memory_listener_register(&v->vdpa.listener, &address_space_memory); v->config_size = vhost_vdpa_device_get_u32(v->vhostfd, VHOST_VDPA_GET_CONFIG_SIZE, errp); @@ -163,6 +165,7 @@ static void vhost_vdpa_device_realize(DeviceState *dev, Error **errp) free_config: g_free(v->config); vhost_cleanup: + memory_listener_unregister(&v->vdpa.listener); vhost_dev_cleanup(&v->dev); free_vqs: g_free(vqs); @@ -188,6 +191,7 @@ static void vhost_vdpa_device_unrealize(DeviceState *dev) g_free(s->config); g_free(s->dev.vqs); + memory_listener_unregister(&s->vdpa.listener); vhost_dev_cleanup(&s->dev); qemu_close(s->vhostfd); s->vhostfd = -1; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 063e941544..30408f2069 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1320,8 +1320,6 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) "IOMMU and try again"); return -1; } - memory_listener_register(&v->listener, dev->vdev->dma_as); - return vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); } @@ -1515,7 +1513,6 @@ static bool vhost_vdpa_force_iommu(struct vhost_dev *dev) static int vhost_vdpa_suspend_device(struct vhost_dev *dev) { - struct vhost_vdpa *v = dev->opaque; int ret; vhost_vdpa_svqs_stop(dev); @@ -1526,7 +1523,6 @@ static int vhost_vdpa_suspend_device(struct vhost_dev *dev) } ret = vhost_vdpa_call(dev, VHOST_VDPA_SUSPEND, NULL); - memory_listener_unregister(&v->listener); return ret; } @@ -1548,7 +1544,6 @@ static int vhost_vdpa_resume_device(struct vhost_dev *dev) return 0; } - memory_listener_register(&v->listener, &address_space_memory); return vhost_vdpa_call(dev, VHOST_VDPA_RESUME, NULL); } -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2