* [PATCH 2/2] hw/hyperv/vmbus: Make vmstate_vmbus_dev static
2021-06-03 10:41 [PATCH 0/2] Improve vmstate_vmbus_dev handling Thomas Huth
2021-06-03 10:41 ` [PATCH 1/2] hw/hyperv/vmbus: Wire up vmstate_vmbus_dev Thomas Huth
@ 2021-06-03 10:41 ` Thomas Huth
2021-06-05 16:01 ` [PATCH 0/2] Improve vmstate_vmbus_dev handling Maciej S. Szmigiero
2 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2021-06-03 10:41 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Paolo Bonzini, Maciej S . Szmigiero, Jon Doron,
Roman Kagan
vmstate_vmbus_dev is only used in vmbus.c, no need to export this
via the vmbus.h header file.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/hyperv/vmbus.c | 28 ++++++++++++++--------------
include/hw/hyperv/vmbus.h | 3 ---
2 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c
index 2384103cb0..f05e419682 100644
--- a/hw/hyperv/vmbus.c
+++ b/hw/hyperv/vmbus.c
@@ -2438,6 +2438,20 @@ static void vmbus_dev_unrealize(DeviceState *dev)
free_channels(vdev);
}
+static const VMStateDescription vmstate_vmbus_dev = {
+ .name = TYPE_VMBUS_DEVICE,
+ .version_id = 0,
+ .minimum_version_id = 0,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT8_ARRAY(instanceid.data, VMBusDevice, 16),
+ VMSTATE_UINT16(num_channels, VMBusDevice),
+ VMSTATE_STRUCT_VARRAY_POINTER_UINT16(channels, VMBusDevice,
+ num_channels, vmstate_channel,
+ VMBusChannel),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static void vmbus_dev_class_init(ObjectClass *klass, void *data)
{
DeviceClass *kdev = DEVICE_CLASS(klass);
@@ -2464,20 +2478,6 @@ static void vmbus_dev_instance_init(Object *obj)
}
}
-const VMStateDescription vmstate_vmbus_dev = {
- .name = TYPE_VMBUS_DEVICE,
- .version_id = 0,
- .minimum_version_id = 0,
- .fields = (VMStateField[]) {
- VMSTATE_UINT8_ARRAY(instanceid.data, VMBusDevice, 16),
- VMSTATE_UINT16(num_channels, VMBusDevice),
- VMSTATE_STRUCT_VARRAY_POINTER_UINT16(channels, VMBusDevice,
- num_channels, vmstate_channel,
- VMBusChannel),
- VMSTATE_END_OF_LIST()
- }
-};
-
/* vmbus generic device base */
static const TypeInfo vmbus_dev_type_info = {
.name = TYPE_VMBUS_DEVICE,
diff --git a/include/hw/hyperv/vmbus.h b/include/hw/hyperv/vmbus.h
index f98bea3888..7fab984e62 100644
--- a/include/hw/hyperv/vmbus.h
+++ b/include/hw/hyperv/vmbus.h
@@ -13,7 +13,6 @@
#include "sysemu/sysemu.h"
#include "sysemu/dma.h"
#include "hw/qdev-core.h"
-#include "migration/vmstate.h"
#include "hw/hyperv/vmbus-proto.h"
#include "qemu/uuid.h"
#include "qom/object.h"
@@ -85,8 +84,6 @@ struct VMBusDevice {
AddressSpace *dma_as;
};
-extern const VMStateDescription vmstate_vmbus_dev;
-
/*
* A unit of work parsed out of a message in the receive (i.e. guest->host)
* ring buffer of a channel. It's supposed to be subclassed (through
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Improve vmstate_vmbus_dev handling
2021-06-03 10:41 [PATCH 0/2] Improve vmstate_vmbus_dev handling Thomas Huth
2021-06-03 10:41 ` [PATCH 1/2] hw/hyperv/vmbus: Wire up vmstate_vmbus_dev Thomas Huth
2021-06-03 10:41 ` [PATCH 2/2] hw/hyperv/vmbus: Make vmstate_vmbus_dev static Thomas Huth
@ 2021-06-05 16:01 ` Maciej S. Szmigiero
2021-06-07 7:16 ` Thomas Huth
2 siblings, 1 reply; 5+ messages in thread
From: Maciej S. Szmigiero @ 2021-06-05 16:01 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-trivial, Paolo Bonzini, qemu-devel, Jon Doron, Roman Kagan
Hi Thomas,
On 03.06.2021 12:41, Thomas Huth wrote:
> I accidentally came accross vmstate_vmbus_dev and noticed that
> it is currently not used at all ... wire it up and make it
> static, since it is only used in one file.
>
> Thomas Huth (2):
> hw/hyperv/vmbus: Wire up vmstate_vmbus_dev
> hw/hyperv/vmbus: Make vmstate_vmbus_dev static
>
> hw/hyperv/vmbus.c | 29 +++++++++++++++--------------
> include/hw/hyperv/vmbus.h | 3 ---
> 2 files changed, 15 insertions(+), 17 deletions(-)
>
I think the idea is to embed vmstate_vmbus_dev into a child device
VMStateDescription using VMSTATE_STRUCT() - since particular VMBus
devices aren't merged yet there are currently no users of it.
This is similar how USB devices VMState is organized - see
vmstate_usb_device and VMSTATE_USB_DEVICE() macro.
Thanks,
Maciej
^ permalink raw reply [flat|nested] 5+ messages in thread