qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] megasas: Add 'hba_serial' property
Date: Fri, 24 Aug 2012 13:38:10 +0200	[thread overview]
Message-ID: <503767A2.90402@redhat.com> (raw)
In-Reply-To: <1345804601-7948-1-git-send-email-hare@suse.de>

Il 24/08/2012 12:36, Hannes Reinecke ha scritto:
> Add a 'hba_serial' property to the megasas driver. Originally
> it would be using a pointer value which would break migration.
> 
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/megasas.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/megasas.c b/hw/megasas.c
> index c35a15d..c728aea 100644
> --- a/hw/megasas.c
> +++ b/hw/megasas.c
> @@ -38,6 +38,7 @@
>  #define MEGASAS_MAX_SECTORS 0xFFFF      /* No real limit */
>  #define MEGASAS_MAX_ARRAYS 128
>  
> +#define MEGASAS_HBA_SERIAL "QEMU123456"
>  #define NAA_LOCALLY_ASSIGNED_ID 0x3ULL
>  #define IEEE_COMPANY_LOCALLY_ASSIGNED 0x525400
>  
> @@ -93,6 +94,7 @@ typedef struct MegasasState {
>      int boot_event;
>  
>      uint64_t sas_addr;
> +    char *hba_serial;
>  
>      uint64_t reply_queue_pa;
>      void *reply_queue;
> @@ -698,8 +700,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd)
>      }
>  
>      memcpy(info.product_name, "MegaRAID SAS 8708EM2", 20);
> -    snprintf(info.serial_number, 32, "QEMU%08lx",
> -             (unsigned long)s & 0xFFFFFFFF);
> +    snprintf(info.serial_number, 32, "%s", s->hba_serial);
>      snprintf(info.package_version, 0x60, "%s-QEMU", QEMU_VERSION);
>      memcpy(info.image_component[0].name, "APP", 3);
>      memcpy(info.image_component[0].version, MEGASAS_VERSION "-QEMU", 9);
> @@ -2132,6 +2133,9 @@ static int megasas_scsi_init(PCIDevice *dev)
>          s->sas_addr |= (PCI_SLOT(dev->devfn) << 8);
>          s->sas_addr |= PCI_FUNC(dev->devfn);
>      }
> +    if (!s->hba_serial) {
> +	s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL);
> +    }
>      if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
>          s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;
>      } else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {
> @@ -2166,6 +2170,7 @@ static Property megasas_properties[] = {
>                         MEGASAS_DEFAULT_SGE),
>      DEFINE_PROP_UINT32("max_cmds", MegasasState, fw_cmds,
>                         MEGASAS_DEFAULT_FRAMES),
> +    DEFINE_PROP_STRING("hba_serial", MegasasState, hba_serial),
>      DEFINE_PROP_HEX64("sas_address", MegasasState, sas_addr, 0),
>  #ifdef USE_MSIX
>      DEFINE_PROP_BIT("use_msix", MegasasState, flags,
> 

Applied to scsi-next branch.

Paolo

      reply	other threads:[~2012-08-24 11:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24 10:36 [Qemu-devel] [PATCH] megasas: Add 'hba_serial' property Hannes Reinecke
2012-08-24 11:38 ` Paolo Bonzini [this message]

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=503767A2.90402@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=hare@suse.de \
    --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).