Andreas Färber <afaer...@suse.de> 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. >> >> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> >> --- >> 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)?
With same caveat at patch 1. Reviewed-by: Anthony Liguori <aligu...@us.ibm.com> Regards, Anthony Liguori > >> 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