| Branch: | Revision:

root / dma-helpers.c @ feature-archipelago

History | View | Annotate | Download (7 kB)

# Date Author Comment
6a1751b7 08/22/2013 08:10 pm Alex Bligh

aio / timers: Untangle include files

include/qemu/timer.h has no need to include main-loop.h and
doing so causes an issue for the next patch. Unfortunately
various files assume including timers.h will pull in main-loop.h.
Untangle this mess.

Signed-off-by: Alex Bligh <>...

f487b677 07/04/2013 06:42 pm Paolo Bonzini

dma: keep a device alive while it has SGLists

Reviewed-by: Anthony Liguori <>
Signed-off-by: Paolo Bonzini <>

df32fd1c 06/20/2013 05:39 pm Paolo Bonzini

dma: eliminate DMAContext

The DMAContext is a simple pointer to an AddressSpace that is now always
already available. Make everyone hold the address space directly,
and clean up the DMA API to use the AddressSpace directly.

Reviewed-by: Peter Maydell <>...

24addbc7 06/20/2013 05:32 pm Paolo Bonzini

dma: eliminate old-style IOMMU support

The translate function in the DMAContext is now always NULL.
Remove every reference to it.

Reviewed-by: Peter Maydell <>
Signed-off-by: Paolo Bonzini <>

51644ab7 05/29/2013 05:27 pm Paolo Bonzini

memory: add address_space_access_valid

The old-style IOMMU lets you check whether an access is valid in a
given DMAContext. There is no equivalent for AddressSpace in the
memory API, implement it with a lookup of the dispatch tree.

Reviewed-by: Richard Henderson <>...

9c17d615 12/19/2012 09:32 am Paolo Bonzini

softmmu: move include files to include/sysemu/

Signed-off-by: Paolo Bonzini <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

d7331bed 11/14/2012 07:19 pm Stefan Hajnoczi

aio: rename AIOPool to AIOCBInfo

Now that AIOPool no longer keeps a freelist, it isn't really a "pool"
anymore. Rename it to AIOCBInfo and make it const since it no longer
needs to be modified.

Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

a8170e5e 10/23/2012 04:58 pm Avi Kivity

Rename target_phys_addr_t to hwaddr

target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
reserved) and its purpose doesn't match the name (most target_phys_addr_t
addresses are not target specific). Replace it with a finger-friendly,...

b90600ee 10/22/2012 03:50 pm Avi Kivity

dma: make dma access its own address space

Instead of accessing the cpu address space, use an address space
configured by the caller.

Eventually all dma functionality will be folded into AddressSpace,
but we have to start from something.

Reviewed-by: Anthony Liguori <>...

bc9b78de 08/16/2012 09:41 pm Benjamin Herrenschmidt

dma: Fix stupid typo/thinko

Hi hard a brain fart when coding that function, it will
fail to "set" the memory beyond the first 512 bytes. This
is in turn causing guest crashes in ibmveth (spapr_llan.c
on the qemu side) due to the receive queue not being
properly initialized....

ea8d82a1 08/10/2012 11:25 am Jason Baron

ahci: Fix sglist memleak in ahci_dma_rw_buf()

I noticed that in hw/ide/ahci:ahci_dma_rw_buf() we do not free the sglist. Thus,
I've added a call to qemu_sglist_destroy() to fix this memory leak.

In addition, I've adeed a call in qemu_sglist_destroy() to 0 all of the sglist...

7a0bac4d 06/28/2012 12:33 am Benjamin Herrenschmidt

Add a memory barrier to DMA functions

The emulated devices can run simultaneously with the guest, so
we need to be careful with ordering of load and stores done by
them to the guest system memory, which need to be observed in
the right order by the guest operating system....

d86a77f8 06/28/2012 12:33 am David Gibson

iommu: Add universal DMA helper functions

Not that long ago, every device implementation using DMA directly
accessed guest memory using cpu_physical_memory_*(). This meant that
adding support for a guest visible IOMMU would require changing every
one of these devices to go through IOMMU translation....

c65bcef3 06/28/2012 12:33 am David Gibson

iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers

dma-helpers.c contains a number of helper functions for doing
scatter/gather DMA, and various block device related DMA. Currently,
these directly access guest memory using cpu_physical_memory_*(),...

e5332e63 06/28/2012 12:33 am David Gibson

iommu: Introduce IOMMU emulation infrastructure

This patch adds the basic infrastructure necessary to emulate an IOMMU
visible to the guest. The DMAContext structure is extended with
information and a callback describing the translation, and the various...

43cf8ae6 04/05/2012 03:54 pm David Gibson

Use DMADirection type for dma_bdrv_io

Currently dma_bdrv_io() takes a 'to_dev' boolean parameter to
determine the direction of DMA it is emulating. We already have a
DMADirection enum designed specifically to encode DMA directions.
This patch uses it for dma_bdrv_io() as well. This involves removing...

85e8dab1 04/05/2012 03:54 pm Paolo Bonzini

aio: move BlockDriverAIOCB to qemu-aio.h

And remove several block_int.h inclusions that should not be there.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

8171ee35 02/22/2012 02:29 pm Paolo Bonzini

dma-helpers: add dma_buf_read and dma_buf_write

These helpers do a full transfer from an in-memory buffer to target
memory, with support for scatter/gather lists. It will be used to
store the reply of an emulated command into a QEMUSGList provided by
the adapter....

84a69356 02/22/2012 02:29 pm Paolo Bonzini

dma-helpers: add accounting wrappers

The length of the transfer is already in the sglist, the wrapper simply
fetches it.

Signed-off-by: Paolo Bonzini <>

6bee44ea 12/15/2011 01:40 pm Paolo Bonzini

dma: the passed io_func does not return NULL

Initially found with the following semantic patch:

BlockDriverAIOCB *x;
expression E;
x = E;
- if (x == NULL) { ... }

expression E, E1;
E1->acb = E;
- if (E1->acb == NULL) { ... }...

c57c4658 12/05/2011 03:51 pm Kevin Wolf

dma-helpers: Add trace events

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

d3231181 11/01/2011 11:52 pm David Gibson

Use dma_addr_t type for scatter/gather code

This patch uses the newly created dma_addr_t type throughout the
scatter/gather handling code in dma-helpers.c whenever we need to
represent a dma bus address. This makes a better distinction as to
what is a bus address and what is a cpu physical address. Since we...

c3adb5b9 09/20/2011 01:27 pm Paolo Bonzini

dma-helpers: rewrite completion/cancellation

This fixes various problems with completion/cancellation:

  • if the io_func fails to get an AIOCB, the callback wasn't called
  • If DMA encounters a bounce buffer conflict, and the DMA operation is
    canceled before the bottom half fires, bad things happen....
bbca72c6 09/19/2011 12:35 pm Paolo Bonzini

dma-helpers: rename is_write to to_dev

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

cb144ccb 06/15/2011 03:36 pm Christoph Hellwig

make dma_bdrv_io available to drivers

Make dma_bdrv_io available for drivers, and pass an explicit I/O function
instead of hardcoding bdrv_aio_readv/bdrv_aio_writev. This is required
to implement non-READ/WRITE dma commands in the ide driver, e.g. the
upcoming TRIM support....

c227f099 10/02/2009 12:12 am Anthony Liguori

Revert "Get rid of _t suffix"

In the very least, a change like this requires discussion on the list.

The naming convention is goofy and it causes a massive merge problem. Something
like this must be presented on the list first so people can provide input...

99a0949b 10/01/2009 09:45 pm malc

Get rid of _t suffix

Some not so obvious bits, slirp and Xen were left alone for the time

Signed-off-by: malc <>

c16b5a2c 05/27/2009 05:46 pm Christoph Hellwig

fully split aio_pool from BlockDriver

Now that we have a separate aio pool structure we can remove those
aio pool details from BlockDriver.

Every driver supporting AIO now needs to declare a static AIOPool
with the aiocb size and the cancellation method. This cleans up the...

856ae5c3 04/07/2009 08:57 pm blueswir1

Fix a few Sparse warnings

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

7403b14e 03/28/2009 06:11 pm aliguori

Fix DMA API when handling an immediate error from block layer (Avi Kivity)

The block layer may signal an immediate error on an asynchronous request
by returning NULL. The DMA API did not handle this correctly, returning
an AIO request which would never complete (and which would crash if...

37b7842c 03/20/2009 08:26 pm aliguori

Move block dma helpers aiocb to store dma state (Avi Kivity)

Use the dedicated dma aiocb to store intermediate state for dma block

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

6512a2a7 03/20/2009 08:26 pm aliguori

Implement cancellation method for dma async I/O (Avi Kivity)

Move the dma helpers to a private aio pool, and implement a cancellation
method for them. Should prevent issues when cancelling I/O while dma is
in progress.

Signed-off-by: Avi Kivity <>...

59a703eb 02/05/2009 11:23 pm aliguori

Introduce block dma helpers (Avi Kivity)

These helpers perform read/write requests on entire scatter/gather lists,
relieving the device emulation code from mapping and unmapping physical
memory, and from looping when map resources are exhausted.

Signed-off-by: Avi Kivity <>...

244ab90e 02/05/2009 11:23 pm aliguori

Add a scatter-gather list type and accessors (Avi Kivity)

Scatter-gather lists are used extensively in dma-capable devices; a
single data structure allows more code reuse later on.

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>...