On Thu, 30 Jul 2020 at 08:42, Stefano Garzarella <sgarz...@redhat.com> wrote: > I agree that it is better to return the dma_memory_rw() return value, but > at first look, no one seems to check the return value of pci_dma_rw(), > pci_dma_read(), andpci_dma_write(). > > Should we make them void?
In general code (eg device models) that issues memory transactions need to have a mechanism for finding out whether the transaction succeeds. Traditionally QEMU didn't have the concept of a transaction failing, but we have added it, starting with the APIs at the bottom level (the address_space_* ones). We haven't always plumbed the error-handling (or the memory-transaction input, for that matter) through to some of these other APIs. I think for consistency we should do that, and ideally we should make all these APIs look the same as the base-level address_space* ones, which would mean returning a MemTxError rather than a bool. We should also figure out why the dma_* functions exist at all: they include some calls to dma_barrier(), but not all devices do DMA with the dma_* functions, so we have an inconsistency that should be sorted out... thanks -- PMM