All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Improve vmstate_vmbus_dev handling
@ 2021-06-03 10:41 Thomas Huth
  2021-06-03 10:41 ` [PATCH 1/2] hw/hyperv/vmbus: Wire up vmstate_vmbus_dev Thomas Huth
                   ` (2 more replies)
  0 siblings, 3 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

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(-)

-- 
2.27.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] hw/hyperv/vmbus: Wire up vmstate_vmbus_dev
  2021-06-03 10:41 [PATCH 0/2] Improve vmstate_vmbus_dev handling Thomas Huth
@ 2021-06-03 10:41 ` 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 ` [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

The vmstate_vmbus_dev structure is currently completely unused.
Looks like this has been forgotten to get wired up  in the
vmbus_dev_class_init() function.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/hyperv/vmbus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c
index 984caf898d..2384103cb0 100644
--- a/hw/hyperv/vmbus.c
+++ b/hw/hyperv/vmbus.c
@@ -2445,6 +2445,7 @@ static void vmbus_dev_class_init(ObjectClass *klass, void *data)
     kdev->realize = vmbus_dev_realize;
     kdev->unrealize = vmbus_dev_unrealize;
     kdev->reset = vmbus_dev_reset;
+    kdev->vmsd = &vmstate_vmbus_dev;
 }
 
 static Property vmbus_dev_instanceid =
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [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

* Re: [PATCH 0/2] Improve vmstate_vmbus_dev handling
  2021-06-05 16:01 ` [PATCH 0/2] Improve vmstate_vmbus_dev handling Maciej S. Szmigiero
@ 2021-06-07  7:16   ` Thomas Huth
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2021-06-07  7:16 UTC (permalink / raw)
  To: Maciej S. Szmigiero
  Cc: qemu-trivial, Paolo Bonzini, qemu-devel, Jon Doron, Roman Kagan

On 05/06/2021 18.01, Maciej S. Szmigiero wrote:
> 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.

Ok, then never mind. But some comments in the source code would be really 
helpful - in the current shape, it simply looks like an oversight...

  Thomas



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-07  7:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 0/2] Improve vmstate_vmbus_dev handling Maciej S. Szmigiero
2021-06-07  7:16   ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.