Anthony Liguori writes ("Re: [Qemu-devel] Re: [PATCH 1/5] Add target memory mapping
API"):
Ian Jackson wrote:
I think my most recently sketched-out proposal (where the caller
passes a DMA sg list to the mapping request function) doesn't have
these deadlocks ?
But what do you do with a DMA request that cannot possibly be bounced
but that can be split? In other words, a DMA request to 1G of MMIO
memory that is disk access. We can absolutely split that into multiple
requests.
You impose a maximum size for any DMA request; that is, a maximum size
that callers of the DMA API are allowed to request. Any larger
request is a bug. Callers who might want to try to map bigger blocks
need to be able to split.
Alternatively you can have the API return an `amount mapped' on the
callback, but state that this number will always be at least
DMA_MAP_SG_GUARANTEE_MIN if at least that amount was requested.