All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/misc/edu: support pci device state migration
@ 2020-07-22  8:13 Zeng Guang
  2020-07-22  8:37 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Zeng Guang @ 2020-07-22  8:13 UTC (permalink / raw)
  To: jslaby, david, quintela, qemu-devel; +Cc: Zeng Guang, wei.w.wang, chao.gao

Currently edu device doesn't support live migration. Part of PCI
configuration information would be lost after migration.

PCI device state in source VM:
     Bus  0, device   3, function 0:
     Class 0255: PCI device 1234:11e8
     PCI subsystem 1af4:1100
     IRQ 11, pin A
     BAR0: 32 bit memory at 0xfea00000 [0xfeafffff].
     id ""

PCI device state in destination VM:
     Bus  0, device   3, function 0:
     Class 0255: PCI device 1234:11e8
     PCI subsystem 1af4:1100
     IRQ 0, pin A
     BAR0: 32 bit memory at 0xffffffffffffffff [0x000ffffe].
     id ""

Add VMState for edu device to support migration.

Signed-off-by: Gao Chao <chao.gao@intel.com>
Signed-off-by: Zeng Guang <guang.zeng@intel.com>
Reviewed-by: Wei Wang <wei.w.wang@intel.com>
---
 hw/misc/edu.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index ec617e63f3..3ff2759ee1 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -27,6 +27,7 @@
 #include "hw/pci/pci.h"
 #include "hw/hw.h"
 #include "hw/pci/msi.h"
+#include "migration/vmstate.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h" /* iothread mutex */
 #include "qemu/module.h"
@@ -405,6 +406,16 @@ static void edu_instance_init(Object *obj)
                                    &edu->dma_mask, OBJ_PROP_FLAG_READWRITE);
 }
 
+static const VMStateDescription vmstate_edu = {
+    .name = "edu",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_PCI_DEVICE(pdev, EduState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static void edu_class_init(ObjectClass *class, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(class);
@@ -415,6 +426,7 @@ static void edu_class_init(ObjectClass *class, void *data)
     k->vendor_id = PCI_VENDOR_ID_QEMU;
     k->device_id = 0x11e8;
     k->revision = 0x10;
+    dc->vmsd = &vmstate_edu;
     k->class_id = PCI_CLASS_OTHERS;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
-- 
2.17.1



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

* Re: [PATCH] hw/misc/edu: support pci device state migration
  2020-07-22  8:13 [PATCH] hw/misc/edu: support pci device state migration Zeng Guang
@ 2020-07-22  8:37 ` Peter Maydell
  2020-07-23  1:01   ` Zeng Guang
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2020-07-22  8:37 UTC (permalink / raw)
  To: Zeng Guang
  Cc: Juan Quintela, David Hildenbrand, QEMU Developers, wei.w.wang,
	Jiri Slaby, chao.gao

On Wed, 22 Jul 2020 at 09:31, Zeng Guang <guang.zeng@intel.com> wrote:
>
> Currently edu device doesn't support live migration. Part of PCI
> configuration information would be lost after migration.
>
> PCI device state in source VM:
>      Bus  0, device   3, function 0:
>      Class 0255: PCI device 1234:11e8
>      PCI subsystem 1af4:1100
>      IRQ 11, pin A
>      BAR0: 32 bit memory at 0xfea00000 [0xfeafffff].
>      id ""
>
> PCI device state in destination VM:
>      Bus  0, device   3, function 0:
>      Class 0255: PCI device 1234:11e8
>      PCI subsystem 1af4:1100
>      IRQ 0, pin A
>      BAR0: 32 bit memory at 0xffffffffffffffff [0x000ffffe].
>      id ""
>
> Add VMState for edu device to support migration.
>
> Signed-off-by: Gao Chao <chao.gao@intel.com>
> Signed-off-by: Zeng Guang <guang.zeng@intel.com>
> Reviewed-by: Wei Wang <wei.w.wang@intel.com>

Hi; thanks for adding migration support for this device.


> +static const VMStateDescription vmstate_edu = {
> +    .name = "edu",
> +    .version_id = 1,
> +    .minimum_version_id = 1,
> +    .fields = (VMStateField[]) {
> +        VMSTATE_PCI_DEVICE(pdev, EduState),

This isn't the only state that the device has. You
also need to migrate:
stopping, addr4, fact, status, irq_status, the struct dma_state members,
the dma_timer, dma_buf and dma_mask.


thanks
-- PMM


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

* Re: [PATCH] hw/misc/edu: support pci device state migration
  2020-07-22  8:37 ` Peter Maydell
@ 2020-07-23  1:01   ` Zeng Guang
  0 siblings, 0 replies; 3+ messages in thread
From: Zeng Guang @ 2020-07-23  1:01 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Juan Quintela, David Hildenbrand, QEMU Developers, wei.w.wang,
	Jiri Slaby, chao.gao

On 7/22/2020 4:37 PM, Peter Maydell wrote:
> On Wed, 22 Jul 2020 at 09:31, Zeng Guang <guang.zeng@intel.com> wrote:
>> Currently edu device doesn't support live migration. Part of PCI
>> configuration information would be lost after migration.
>>
>> PCI device state in source VM:
>>       Bus  0, device   3, function 0:
>>       Class 0255: PCI device 1234:11e8
>>       PCI subsystem 1af4:1100
>>       IRQ 11, pin A
>>       BAR0: 32 bit memory at 0xfea00000 [0xfeafffff].
>>       id ""
>>
>> PCI device state in destination VM:
>>       Bus  0, device   3, function 0:
>>       Class 0255: PCI device 1234:11e8
>>       PCI subsystem 1af4:1100
>>       IRQ 0, pin A
>>       BAR0: 32 bit memory at 0xffffffffffffffff [0x000ffffe].
>>       id ""
>>
>> Add VMState for edu device to support migration.
>>
>> Signed-off-by: Gao Chao <chao.gao@intel.com>
>> Signed-off-by: Zeng Guang <guang.zeng@intel.com>
>> Reviewed-by: Wei Wang <wei.w.wang@intel.com>
> Hi; thanks for adding migration support for this device.
>
>
>> +static const VMStateDescription vmstate_edu = {
>> +    .name = "edu",
>> +    .version_id = 1,
>> +    .minimum_version_id = 1,
>> +    .fields = (VMStateField[]) {
>> +        VMSTATE_PCI_DEVICE(pdev, EduState),
> This isn't the only state that the device has. You
> also need to migrate:
> stopping, addr4, fact, status, irq_status, the struct dma_state members,
> the dma_timer, dma_buf and dma_mask.
Right . I will add those params in VMstate and update patch. Thanks.
>
> thanks
> -- PMM


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

end of thread, other threads:[~2020-07-23  1:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  8:13 [PATCH] hw/misc/edu: support pci device state migration Zeng Guang
2020-07-22  8:37 ` Peter Maydell
2020-07-23  1:01   ` Zeng Guang

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.