From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkxHa-0001jO-Lo for qemu-devel@nongnu.org; Fri, 07 Jun 2013 10:04:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkxHV-0006KE-Ag for qemu-devel@nongnu.org; Fri, 07 Jun 2013 10:04:46 -0400 Received: from mail-ob0-x235.google.com ([2607:f8b0:4003:c01::235]:47322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkxHV-0006K2-5x for qemu-devel@nongnu.org; Fri, 07 Jun 2013 10:04:41 -0400 Received: by mail-ob0-f181.google.com with SMTP id 16so6591781obc.26 for ; Fri, 07 Jun 2013 07:04:40 -0700 (PDT) From: Anthony Liguori In-Reply-To: <51B190E2.7020803@suse.de> References: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> <1370371954-8479-3-git-send-email-pbonzini@redhat.com> <51B190E2.7020803@suse.de> Date: Fri, 07 Jun 2013 09:04:30 -0500 Message-ID: <871u8euidt.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 02/39] dma: keep a device alive while it has SGLists List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?utf-8?Q?F=C3=A4rber?= , Paolo Bonzini Cc: qemu-devel@nongnu.org, mst@redhat.com Andreas F=C3=A4rber writes: > 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. >>=20 >> Signed-off-by: Paolo Bonzini >> --- >> 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, MegasasC= md *cmd, union mfi_sgl *sgl) >> MEGASAS_MAX_SGE); >> return iov_count; >> } >> - qemu_sglist_init(&cmd->qsg, iov_count, pci_get_address_space(&s->de= v)); >> + pci_dma_sglist_init(&cmd->qsg, &s->dev, iov_count); > > PCI_DEVICE(s)? With same caveat at patch 1. Reviewed-by: Anthony Liguori Regards, Anthony Liguori > >> for (i =3D 0; i < iov_count; i++) { >> dma_addr_t iov_pa, iov_size_p; >>=20=20 >> @@ -628,7 +628,7 @@ static int megasas_map_dcmd(MegasasState *s, Megasas= Cmd *cmd) >> } >> iov_pa =3D megasas_sgl_get_addr(cmd, &cmd->frame->dcmd.sgl); >> iov_size =3D 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 =3D iov_size; >> return cmd->iov_size; > [snip] > > Andreas > > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3= =BCrnberg