qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/2] hw/mips/jazz: create ESP device directly vi


From: Mark Cave-Ayland
Subject: Re: [Qemu-devel] [PATCH 1/2] hw/mips/jazz: create ESP device directly via qdev
Date: Wed, 13 Jun 2018 14:06:44 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 13/06/18 12:19, Paolo Bonzini wrote:

On 13/06/2018 12:36, Mark Cave-Ayland wrote:
Check out hw/dma/sparc32_dma.c for some ugly examples:
espdma_memory_read()/espdma_memory_write() update the DMA address
pointer register after each read/write, and
ledma_memory_read()/ledma_memory_write() need to determine if the pcnet
card has byte-swapping enabled: if so, then don't perform the required
lance 16-bit swap and if not, do perform the 16-bit swap.

Heh, those are disgusting indeed. :)  So I guess it would have to stay,
only MIPS can use the pure MemoryRegion-based approach.

The only option I can think of is inserting an AddressSpace between the esp/ledma device and the IOMMU AddressSpace which intercepts the DMA request (addr, len, direction).

I can then grab a reference to the device from the MemoryRegion opaque, perform the magic, and then manually invoke address_space_rw() on iommu_as.

Is there a hook somewhere in the memory API that could allow me to do this?

Regarding pcnet, is CSR_BSWP really a no-op on PCI cards?  If not, an
option could be to move that handling to pcnet.c - making the ledma swap
unconditional and removing the do_bswap argument.  The disadvantage is
that SPARC would swap twice, and you'd have to keep the callback because
of s->dmaregs[3], but maybe it's still worthwhile.

Hmmm good question. If we can intercept the request above, that would be my preferred option as something tells it me it might be useful for other similar situations.


ATB,

Mark.



reply via email to

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