ide save/restore current transfer fields

Submitted by Marcelo Tosatti on Jan. 20, 2010, 4:22 p.m.

Details

Message ID 20100120162228.GB14374@amt.cnet
State New
Headers show

Commit Message

Marcelo Tosatti Jan. 20, 2010, 4:22 p.m.
If migration takes place between write of the bmdma address register and
write of the command register (to initiate DMA), the destination will
not properly start the DMA op, hanging the guest:

ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.00: cmd c8/00:16:41:00:00/00:00:00:00:00/e0 tag 0 dma 11264 in
         res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }

Fix by sending current transfer information in the migration data.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Comments

Juan Quintela Jan. 20, 2010, 5 p.m.
Marcelo Tosatti <mtosatti@redhat.com> wrote:
> If migration takes place between write of the bmdma address register and
> write of the command register (to initiate DMA), the destination will
> not properly start the DMA op, hanging the guest:
>
> ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> ata1.00: cmd c8/00:16:41:00:00/00:00:00:00:00/e0 tag 0 dma 11264 in
>          res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
> ata1.00: status: { DRDY }
>
> Fix by sending current transfer information in the migration data.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> diff --git a/hw/ide/pci.c b/hw/ide/pci.c
> index 780fc5f..9f245ed 100644
> --- a/hw/ide/pci.c
> +++ b/hw/ide/pci.c
> @@ -133,6 +135,10 @@ static const VMStateDescription vmstate_bmdma = {
>          VMSTATE_INT64(sector_num, BMDMAState),
>          VMSTATE_UINT32(nsector, BMDMAState),
>          VMSTATE_UINT8(unit, BMDMAState),
> +        VMSTATE_UINT32(cur_addr, BMDMAState),
> +        VMSTATE_UINT32(cur_prd_last, BMDMAState),
> +        VMSTATE_UINT32(cur_prd_addr, BMDMAState),
> +        VMSTATE_UINT32(cur_prd_len, BMDMAState),
>          VMSTATE_END_OF_LIST()
>      }
>  };

This breaks migration.  Sending a patch with this and version changes
as top level posting.

Thanks Marcelo, Juan.

Patch hide | download patch | download mbox

diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 780fc5f..9f245ed 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -133,6 +135,10 @@  static const VMStateDescription vmstate_bmdma = {
         VMSTATE_INT64(sector_num, BMDMAState),
         VMSTATE_UINT32(nsector, BMDMAState),
         VMSTATE_UINT8(unit, BMDMAState),
+        VMSTATE_UINT32(cur_addr, BMDMAState),
+        VMSTATE_UINT32(cur_prd_last, BMDMAState),
+        VMSTATE_UINT32(cur_prd_addr, BMDMAState),
+        VMSTATE_UINT32(cur_prd_len, BMDMAState),
         VMSTATE_END_OF_LIST()
     }
 };