From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9bc0-0001Gc-CL for qemu-devel@nongnu.org; Mon, 08 Oct 2018 15:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9bbw-00019e-M6 for qemu-devel@nongnu.org; Mon, 08 Oct 2018 15:54:38 -0400 Date: Mon, 8 Oct 2018 21:54:02 +0200 From: "Edgar E. Iglesias" Message-ID: <20181008195402.GA4229@toto> References: <1538579266-8389-1-git-send-email-edgar.iglesias@gmail.com> <1538579266-8389-7-git-send-email-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v1 06/12] net: cadence_gem: Add support for selecting the DMA MemoryRegion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: "Edgar E. Iglesias" , QEMU Developers , qemu-arm , Richard Henderson , KONRAD Frederic , Alistair Francis , Francisco Iglesias , figlesia@xilinx.com, Stefano Stabellini , Sai Pavan Boddu On Mon, Oct 08, 2018 at 01:24:51PM +0100, Peter Maydell wrote: > On 3 October 2018 at 16:07, Edgar E. Iglesias wrote: > > From: "Edgar E. Iglesias" > > > > Add support for selecting the Memory Region that the GEM > > will do DMA to. > > > > Signed-off-by: Edgar E. Iglesias > > --- > > > > @@ -1500,6 +1506,13 @@ static void gem_realize(DeviceState *dev, Error **errp) > > CadenceGEMState *s = CADENCE_GEM(dev); > > int i; > > > > + if (s->dma_mr) { > > + s->dma_as = g_malloc0(sizeof(AddressSpace)); > > + address_space_init(s->dma_as, s->dma_mr, NULL); > > Why not just have the CadenceGEMState embed the AddressSpace > > AddressSpace dma_as; > > rather than doing a separate memory allocation here? No reason not to, I copied this from a pattern in our code and didn't reflect too much about the allocation. I'll change it for next version. Cheers, Edgar > > > + } else { > > + s->dma_as = &address_space_memory; > > + } > > thanks > -- PMM