From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHsEG-0001J7-3P for qemu-devel@nongnu.org; Wed, 22 Jul 2015 07:30:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHsE9-00088Y-QA for qemu-devel@nongnu.org; Wed, 22 Jul 2015 07:30:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHsE9-00087t-Ky for qemu-devel@nongnu.org; Wed, 22 Jul 2015 07:30:21 -0400 Date: Wed, 22 Jul 2015 13:30:15 +0200 From: Andrew Jones Message-ID: <20150722113015.GA13441@hawk.localdomain> References: <1437494626-3773-1-git-send-email-markmb@redhat.com> <1437494626-3773-3-git-send-email-markmb@redhat.com> <55AEA131.3010104@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <55AEA131.3010104@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC 2/7] fw_cfg dma interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: Peter Maydell , Stefan Hajnoczi , qemu-devel@nongnu.org, 'Kevin O'Connor' , Gerd Hoffmann , Paolo Bonzini , Marc =?iso-8859-1?Q?Mar=ED?= On Tue, Jul 21, 2015 at 09:44:49PM +0200, Laszlo Ersek wrote: > On 07/21/15 18:03, Marc Mar=ED wrote: > > +static void fw_cfg_dma_transfer(FWCfgState *s) > > +{ > > + dma_addr_t len; > > + uint8_t *ptr; > > + uint32_t i; > > + > > + if (s->dma_ctl & FW_CFG_DMA_CTL_ERROR) { > > + return; > > + } > > + if (!(s->dma_ctl & FW_CFG_DMA_CTL_READ)) { > > + return; > > + } > > + > > + while (s->dma_len > 0) { > > + len =3D s->dma_len; > > + ptr =3D dma_memory_map(s->dma_as, s->dma_addr, &len, > > + DMA_DIRECTION_FROM_DEVICE); > > + if (!ptr || !len) { > > + s->dma_ctl |=3D FW_CFG_DMA_CTL_ERROR; > > + return; > > + } > > + > > + for (i =3D 0; i < len; i++) { > > + ptr[i] =3D fw_cfg_read(s); > > + } > > + > > + s->dma_addr +=3D i; > > + s->dma_len -=3D i; > > + dma_memory_unmap(s->dma_as, ptr, len, > > + DMA_DIRECTION_FROM_DEVICE, i); > > + } > > + s->dma_ctl =3D 0; > > +} >=20 > On Aarch64 KVM, is this going to show the same cache coherence problems > as VGA memory access? > Does the guest (AAVMF) need to map all regions it DMAs to/from as noncacheable? If so, then yes. If not, then I don't think it should map fw-cfg DMA regions that way. fw-cfg is a paravirt device, so I don't think we should have to treat it like a real one. drew=20