qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 10/10] usb-storage: migration support
Date: Fri, 25 May 2012 12:11:10 +0200	[thread overview]
Message-ID: <4FBF5ABE.5050107@redhat.com> (raw)
In-Reply-To: <1337939061-13629-11-git-send-email-kraxel@redhat.com>

Il 25/05/2012 11:44, Gerd Hoffmann ha scritto:
> With all scsi migration support bits in place the
> final step is pretty simple ;)
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/usb/dev-storage.c |   23 +++++++++++++++++++++--
>  1 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
> index 1975d26..7646a77 100644
> --- a/hw/usb/dev-storage.c
> +++ b/hw/usb/dev-storage.c
> @@ -506,6 +506,17 @@ static void usb_msd_password_cb(void *opaque, int err)
>          qdev_unplug(&s->dev.qdev, NULL);
>  }
>  
> +static void *usb_msd_load_request(QEMUFile *f, SCSIRequest *req)
> +{
> +    MSDState *s = DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent);
> +
> +    /* nothing to load, just store req in our state struct */
> +    assert(s->req == NULL);
> +    scsi_req_ref(req);
> +    s->req = req;
> +    return NULL;
> +}
> +
>  static const struct SCSIBusInfo usb_msd_scsi_info = {
>      .tcq = false,
>      .max_target = 0,
> @@ -513,7 +524,8 @@ static const struct SCSIBusInfo usb_msd_scsi_info = {
>  
>      .transfer_data = usb_msd_transfer_data,
>      .complete = usb_msd_command_complete,
> -    .cancel = usb_msd_request_cancelled
> +    .cancel = usb_msd_request_cancelled,
> +    .load_request = usb_msd_load_request,
>  };
>  
>  static int usb_msd_initfn(USBDevice *dev)
> @@ -633,11 +645,18 @@ static USBDevice *usb_msd_init(USBBus *bus, const char *filename)
>  
>  static const VMStateDescription vmstate_usb_msd = {
>      .name = "usb-storage",
> -    .unmigratable = 1, /* FIXME: handle transactions which are in flight */
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .fields = (VMStateField []) {
>          VMSTATE_USB_DEVICE(dev, MSDState),
> +        VMSTATE_UINT32(mode, MSDState),
> +        VMSTATE_UINT32(scsi_len, MSDState),
> +        VMSTATE_UINT32(scsi_off, MSDState),
> +        VMSTATE_UINT32(data_len, MSDState),
> +        VMSTATE_UINT32(csw.sig, MSDState),
> +        VMSTATE_UINT32(csw.tag, MSDState),
> +        VMSTATE_UINT32(csw.residue, MSDState),
> +        VMSTATE_UINT8(csw.status, MSDState),
>          VMSTATE_END_OF_LIST()
>      }
>  };

Can usb-storage have multiple requests in flight (in principle, i.e.
according to the USB protocol)?  If so, it may be better if you save
scsi_len/scsi_off in save_request/load_request.  The migration format
will be forward-compatible.

Otherwise looks good!

Paolo

  reply	other threads:[~2012-05-25 10:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25  9:44 [Qemu-devel] [PATCH 00/10] usb: uhci & usb-storage updates Gerd Hoffmann
2012-05-25  9:44 ` [Qemu-devel] [PATCH 01/10] uhci: fix bandwidth management Gerd Hoffmann
2012-05-25  9:44 ` [Qemu-devel] [PATCH 02/10] uhci: use bottom half Gerd Hoffmann
2012-05-25  9:44 ` [Qemu-devel] [PATCH 03/10] uhci: make bandwidth tunable Gerd Hoffmann
2012-05-25  9:44 ` [Qemu-devel] [PATCH 04/10] uhci: fix trace format strings Gerd Hoffmann
2012-05-25  9:44 ` [Qemu-devel] [PATCH 05/10] uhci: zap uhci_pre_save Gerd Hoffmann
2012-05-25  9:44 ` [Qemu-devel] [PATCH 06/10] scsi: prepare migration code for usb-storage support Gerd Hoffmann
2012-05-25  9:51   ` Paolo Bonzini
2012-05-25  9:44 ` [Qemu-devel] [PATCH 07/10] usb-storage: remove MSDState->residue Gerd Hoffmann
2012-05-25  9:44 ` [Qemu-devel] [PATCH 08/10] usb-storage: add usb_msd_packet_complete() Gerd Hoffmann
2012-05-25  9:44 ` [Qemu-devel] [PATCH 09/10] usb-storage: add scsi_off, remove scsi_buf Gerd Hoffmann
2012-05-25 10:09   ` Paolo Bonzini
2012-05-25  9:44 ` [Qemu-devel] [PATCH 10/10] usb-storage: migration support Gerd Hoffmann
2012-05-25 10:11   ` Paolo Bonzini [this message]
2012-05-25 10:33     ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FBF5ABE.5050107@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).