On Mon, Oct 08, 2018 at 01:30:20PM +0100, Peter Maydell wrote: > On 3 October 2018 at 16:07, Edgar E. Iglesias <edgar.igles...@gmail.com> > wrote: > > From: "Edgar E. Iglesias" <edgar.igles...@xilinx.com> > > > > Add support for selecting the Memory Region that the GEM > > will do DMA to. > > > > Signed-off-by: Edgar E. Iglesias <edgar.igles...@xilinx.com> > > --- > > hw/net/cadence_gem.c | 63 > > ++++++++++++++++++++++++++++---------------- > > include/hw/net/cadence_gem.h | 2 ++ > > 2 files changed, 43 insertions(+), 22 deletions(-) > > > > diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c > > index 759c1d7..ab02515 100644 > > --- a/hw/net/cadence_gem.c > > +++ b/hw/net/cadence_gem.c > > @@ -28,6 +28,7 @@ > > #include "hw/net/cadence_gem.h" > > #include "qapi/error.h" > > #include "qemu/log.h" > > +#include "sysemu/dma.h" > > #include "net/checksum.h" > > > > #ifdef CADENCE_GEM_ERR_DEBUG > > @@ -835,9 +836,9 @@ static void gem_get_rx_desc(CadenceGEMState *s, int q) > > { > > DB_PRINT("read descriptor 0x%x\n", (unsigned)s->rx_desc_addr[q]); > > /* read current descriptor */ > > - cpu_physical_memory_read(s->rx_desc_addr[q], > > - (uint8_t *)s->rx_desc[q], > > - sizeof(uint32_t) * gem_get_desc_len(s, true)); > > + address_space_read(s->dma_as, s->rx_desc_addr[q], > > MEMTXATTRS_UNSPECIFIED, > > + (uint8_t *)s->rx_desc[q], > > + sizeof(uint32_t) * gem_get_desc_len(s, true)); > > At some point you might want to add support for handling "descriptor > read/write failed", incidentally: address_space_read/write return a > MemTxResult which you can check for != MEMTX_OK.
Yes, the GEM can report those errors to SW so that's a nice feature to follow up with. Thanks, Edgar