Patchwork [1/6] Revert "ide save/restore pio/atapi cmd transfer fields and io buffer"

login
register
mail settings
Submitter Juan Quintela
Date July 26, 2010, 7:38 p.m.
Message ID <a2dc56b3074c43717c17a63e97b5e85be9c23430.1280172745.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/59943/
State New
Headers show

Comments

Juan Quintela - July 26, 2010, 7:38 p.m.
This reverts commit ed487bb1d69040b9dac64a4fc076d8dd82b131d6.

The conflicts are due to commit 4fc8d6711aff7a9c11e402c3d77b481609f9f486
that is a fix to the ide_drive_pre_save() function.  It reverts both
(and both are reinstantiated later in the series)

Conflicts:

	hw/ide/core.c

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/ide/core.c     |   62 +---------------------------------------------------
 hw/ide/internal.h |    5 ----
 2 files changed, 2 insertions(+), 65 deletions(-)
Anthony Liguori - Aug. 19, 2010, 1:41 p.m.
On 07/26/2010 02:38 PM, Juan Quintela wrote:
> This reverts commit ed487bb1d69040b9dac64a4fc076d8dd82b131d6.
>
> The conflicts are due to commit 4fc8d6711aff7a9c11e402c3d77b481609f9f486
> that is a fix to the ide_drive_pre_save() function.  It reverts both
> (and both are reinstantiated later in the series)
>
> Conflicts:
>
> 	hw/ide/core.c
>
> Signed-off-by: Juan Quintela<quintela@redhat.com>
>    

These don't apply cleanly and fail in a non-obvious way.  Can you rebase?

Regards,

Anthony Liguori

> ---
>   hw/ide/core.c     |   62 +---------------------------------------------------
>   hw/ide/internal.h |    5 ----
>   2 files changed, 2 insertions(+), 65 deletions(-)
>
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index e20f2e7..ccb7d32 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -2664,7 +2664,6 @@ static void ide_init1(IDEBus *bus, int unit)
>       s->unit = unit;
>       s->drive_serial = drive_serial++;
>       s->io_buffer = qemu_blockalign(s->bs, IDE_DMA_BUF_SECTORS*512 + 4);
> -    s->io_buffer_total_len = IDE_DMA_BUF_SECTORS*512 + 4;
>       s->smart_selftest_data = qemu_blockalign(s->bs, 512);
>       s->sector_write_timer = qemu_new_timer(vm_clock,
>                                              ide_sector_write_timer_cb, s);
> @@ -2727,25 +2726,6 @@ static bool is_identify_set(void *opaque, int version_id)
>       return s->identify_set != 0;
>   }
>
> -static EndTransferFunc* transfer_end_table[] = {
> -        ide_sector_read,
> -        ide_sector_write,
> -        ide_transfer_stop,
> -        ide_atapi_cmd_reply_end,
> -        ide_atapi_cmd,
> -};
> -
> -static int transfer_end_table_idx(EndTransferFunc *fn)
> -{
> -    int i;
> -
> -    for (i = 0; i<  ARRAY_SIZE(transfer_end_table); i++)
> -        if (transfer_end_table[i] == fn)
> -            return i;
> -
> -    return -1;
> -}
> -
>   static int ide_drive_post_load(void *opaque, int version_id)
>   {
>       IDEState *s = opaque;
> @@ -2756,45 +2736,14 @@ static int ide_drive_post_load(void *opaque, int version_id)
>               s->cdrom_changed = 1;
>           }
>       }
> -
> -    if (s->cur_io_buffer_len) {
> -        s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];
> -        s->data_ptr = s->io_buffer + s->cur_io_buffer_offset;
> -        s->data_end = s->data_ptr + s->cur_io_buffer_len;
> -    }
> -
>       return 0;
>   }
>
> -static void ide_drive_pre_save(void *opaque)
> -{
> -    IDEState *s = opaque;
> -    int idx;
> -
> -    s->cur_io_buffer_len = 0;
> -
> -    if (!(s->status&  DRQ_STAT))
> -        return;
> -
> -    s->cur_io_buffer_offset = s->data_ptr - s->io_buffer;
> -    s->cur_io_buffer_len = s->data_end - s->data_ptr;
> -
> -    idx = transfer_end_table_idx(s->end_transfer_func);
> -    if (idx == -1) {
> -        fprintf(stderr, "%s: invalid end_transfer_func for DRQ_STAT\n",
> -                        __func__);
> -        s->end_transfer_fn_idx = 2;
> -    } else {
> -        s->end_transfer_fn_idx = idx;
> -    }
> -}
> -
>   const VMStateDescription vmstate_ide_drive = {
>       .name = "ide_drive",
> -    .version_id = 4,
> +    .version_id = 3,
>       .minimum_version_id = 0,
>       .minimum_version_id_old = 0,
> -    .pre_save = ide_drive_pre_save,
>       .post_load = ide_drive_post_load,
>       .fields      = (VMStateField []) {
>           VMSTATE_INT32(mult_sectors, IDEState),
> @@ -2817,14 +2766,7 @@ const VMStateDescription vmstate_ide_drive = {
>           VMSTATE_UINT8(sense_key, IDEState),
>           VMSTATE_UINT8(asc, IDEState),
>           VMSTATE_UINT8_V(cdrom_changed, IDEState, 3),
> -        VMSTATE_INT32_V(req_nb_sectors, IDEState, 4),
> -        VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 4,
> -			     vmstate_info_uint8, uint8_t),
> -        VMSTATE_INT32_V(cur_io_buffer_offset, IDEState, 4),
> -        VMSTATE_INT32_V(cur_io_buffer_len, IDEState, 4),
> -        VMSTATE_UINT8_V(end_transfer_fn_idx, IDEState, 4),
> -        VMSTATE_INT32_V(elementary_transfer_size, IDEState, 4),
> -        VMSTATE_INT32_V(packet_transfer_size, IDEState, 4),
> +        /* XXX: if a transfer is pending, we do not save it yet */
>           VMSTATE_END_OF_LIST()
>       }
>   };
> diff --git a/hw/ide/internal.h b/hw/ide/internal.h
> index 4165543..75745ee 100644
> --- a/hw/ide/internal.h
> +++ b/hw/ide/internal.h
> @@ -419,11 +419,6 @@ struct IDEState {
>       uint8_t *data_ptr;
>       uint8_t *data_end;
>       uint8_t *io_buffer;
> -    /* PIO save/restore */
> -    int32_t io_buffer_total_len;
> -    int cur_io_buffer_offset;
> -    int cur_io_buffer_len;
> -    uint8_t end_transfer_fn_idx;
>       QEMUTimer *sector_write_timer; /* only used for win2k install hack */
>       uint32_t irq_count; /* counts IRQs when using win2k install hack */
>       /* CF-ATA extended error */
>
Juan Quintela - Aug. 19, 2010, 11:10 p.m.
Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 07/26/2010 02:38 PM, Juan Quintela wrote:
>> This reverts commit ed487bb1d69040b9dac64a4fc076d8dd82b131d6.
>>
>> The conflicts are due to commit 4fc8d6711aff7a9c11e402c3d77b481609f9f486
>> that is a fix to the ide_drive_pre_save() function.  It reverts both
>> (and both are reinstantiated later in the series)
>>
>> Conflicts:
>>
>> 	hw/ide/core.c
>>
>> Signed-off-by: Juan Quintela<quintela@redhat.com>
>>    
>
> These don't apply cleanly and fail in a non-obvious way.  Can you rebase?
>
> Regards,

I guess you mean against stable here (otherwise, they have already been
integrated).

I am on holidays until Monday,  if it is against stable, I will do it there.

Later, Juan.

Patch

diff --git a/hw/ide/core.c b/hw/ide/core.c
index e20f2e7..ccb7d32 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2664,7 +2664,6 @@  static void ide_init1(IDEBus *bus, int unit)
     s->unit = unit;
     s->drive_serial = drive_serial++;
     s->io_buffer = qemu_blockalign(s->bs, IDE_DMA_BUF_SECTORS*512 + 4);
-    s->io_buffer_total_len = IDE_DMA_BUF_SECTORS*512 + 4;
     s->smart_selftest_data = qemu_blockalign(s->bs, 512);
     s->sector_write_timer = qemu_new_timer(vm_clock,
                                            ide_sector_write_timer_cb, s);
@@ -2727,25 +2726,6 @@  static bool is_identify_set(void *opaque, int version_id)
     return s->identify_set != 0;
 }

-static EndTransferFunc* transfer_end_table[] = {
-        ide_sector_read,
-        ide_sector_write,
-        ide_transfer_stop,
-        ide_atapi_cmd_reply_end,
-        ide_atapi_cmd,
-};
-
-static int transfer_end_table_idx(EndTransferFunc *fn)
-{
-    int i;
-
-    for (i = 0; i < ARRAY_SIZE(transfer_end_table); i++)
-        if (transfer_end_table[i] == fn)
-            return i;
-
-    return -1;
-}
-
 static int ide_drive_post_load(void *opaque, int version_id)
 {
     IDEState *s = opaque;
@@ -2756,45 +2736,14 @@  static int ide_drive_post_load(void *opaque, int version_id)
             s->cdrom_changed = 1;
         }
     }
-
-    if (s->cur_io_buffer_len) {
-        s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];
-        s->data_ptr = s->io_buffer + s->cur_io_buffer_offset;
-        s->data_end = s->data_ptr + s->cur_io_buffer_len;
-    }
-        
     return 0;
 }

-static void ide_drive_pre_save(void *opaque)
-{
-    IDEState *s = opaque;
-    int idx;
-
-    s->cur_io_buffer_len = 0;
-
-    if (!(s->status & DRQ_STAT))
-        return;
-
-    s->cur_io_buffer_offset = s->data_ptr - s->io_buffer;
-    s->cur_io_buffer_len = s->data_end - s->data_ptr;
-
-    idx = transfer_end_table_idx(s->end_transfer_func);
-    if (idx == -1) {
-        fprintf(stderr, "%s: invalid end_transfer_func for DRQ_STAT\n",
-                        __func__);
-        s->end_transfer_fn_idx = 2;
-    } else {
-        s->end_transfer_fn_idx = idx;
-    }
-}
-
 const VMStateDescription vmstate_ide_drive = {
     .name = "ide_drive",
-    .version_id = 4,
+    .version_id = 3,
     .minimum_version_id = 0,
     .minimum_version_id_old = 0,
-    .pre_save = ide_drive_pre_save,
     .post_load = ide_drive_post_load,
     .fields      = (VMStateField []) {
         VMSTATE_INT32(mult_sectors, IDEState),
@@ -2817,14 +2766,7 @@  const VMStateDescription vmstate_ide_drive = {
         VMSTATE_UINT8(sense_key, IDEState),
         VMSTATE_UINT8(asc, IDEState),
         VMSTATE_UINT8_V(cdrom_changed, IDEState, 3),
-        VMSTATE_INT32_V(req_nb_sectors, IDEState, 4),
-        VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 4,
-			     vmstate_info_uint8, uint8_t),
-        VMSTATE_INT32_V(cur_io_buffer_offset, IDEState, 4),
-        VMSTATE_INT32_V(cur_io_buffer_len, IDEState, 4),
-        VMSTATE_UINT8_V(end_transfer_fn_idx, IDEState, 4),
-        VMSTATE_INT32_V(elementary_transfer_size, IDEState, 4),
-        VMSTATE_INT32_V(packet_transfer_size, IDEState, 4),
+        /* XXX: if a transfer is pending, we do not save it yet */
         VMSTATE_END_OF_LIST()
     }
 };
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 4165543..75745ee 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -419,11 +419,6 @@  struct IDEState {
     uint8_t *data_ptr;
     uint8_t *data_end;
     uint8_t *io_buffer;
-    /* PIO save/restore */
-    int32_t io_buffer_total_len;
-    int cur_io_buffer_offset;
-    int cur_io_buffer_len;
-    uint8_t end_transfer_fn_idx;
     QEMUTimer *sector_write_timer; /* only used for win2k install hack */
     uint32_t irq_count; /* counts IRQs when using win2k install hack */
     /* CF-ATA extended error */