OSDN Git Service

virtio-mem: Allow notifiers for size changes
authorDavid Hildenbrand <david@redhat.com>
Fri, 26 Jun 2020 07:22:43 +0000 (09:22 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 3 Jul 2020 11:57:04 +0000 (07:57 -0400)
commitc95b4437da6832f3bef9129de897cc7a8334ea8e
tree4d011667fd79a3cb844a0559f7fbd8ef9fa0147f
parent0ed48fd32eb8dbe0113d82b6316c0ee4741cc0b0
virtio-mem: Allow notifiers for size changes

We want to send qapi events in case the size of a virtio-mem device
changes. This allows upper layers to always know how much memory is
actually currently consumed via a virtio-mem device.

Unfortuantely, we have to report the id of our proxy device. Let's provide
an easy way for our proxy device to register, so it can send the qapi
events. Piggy-backing on the notifier infrastructure (although we'll
only ever have one notifier registered) seems to be an easy way.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200626072248.78761-17-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio-mem.c
include/hw/virtio/virtio-mem.h