qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 02/39] dma: keep a device alive while it has SGL


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 02/39] dma: keep a device alive while it has SGLists
Date: Fri, 07 Jun 2013 09:50:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

Am 04.06.2013 20:51, schrieb Paolo Bonzini:
> A QEMUSGList has a reference to a device's address space.  Keep
> the device alive while the QEMUSGList exists.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  dma-helpers.c         |  6 +++++-
>  hw/ide/ahci.c         |  3 ++-
>  hw/ide/macio.c        |  4 ++--
>  hw/scsi/megasas.c     |  4 ++--
>  hw/scsi/virtio-scsi.c | 10 ++++++----
>  hw/usb/hcd-ehci.c     |  4 ++--
>  include/hw/pci/pci.h  |  2 +-
>  include/sysemu/dma.h  |  4 +++-
>  8 files changed, 23 insertions(+), 14 deletions(-)
[...]
> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
> index 7ee7d97..65ccb09 100644
> --- a/hw/scsi/megasas.c
> +++ b/hw/scsi/megasas.c
> @@ -232,7 +232,7 @@ static int megasas_map_sgl(MegasasState *s, MegasasCmd 
> *cmd, union mfi_sgl *sgl)
>                                           MEGASAS_MAX_SGE);
>          return iov_count;
>      }
> -    qemu_sglist_init(&cmd->qsg, iov_count, pci_get_address_space(&s->dev));
> +    pci_dma_sglist_init(&cmd->qsg, &s->dev, iov_count);

PCI_DEVICE(s)?

>      for (i = 0; i < iov_count; i++) {
>          dma_addr_t iov_pa, iov_size_p;
>  
> @@ -628,7 +628,7 @@ static int megasas_map_dcmd(MegasasState *s, MegasasCmd 
> *cmd)
>      }
>      iov_pa = megasas_sgl_get_addr(cmd, &cmd->frame->dcmd.sgl);
>      iov_size = megasas_sgl_get_len(cmd, &cmd->frame->dcmd.sgl);
> -    qemu_sglist_init(&cmd->qsg, 1, pci_get_address_space(&s->dev));
> +    pci_dma_sglist_init(&cmd->qsg, &s->dev, 1);

Ditto?

>      qemu_sglist_add(&cmd->qsg, iov_pa, iov_size);
>      cmd->iov_size = iov_size;
>      return cmd->iov_size;
[snip]

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]