From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNWbF-0006UA-VI for qemu-devel@nongnu.org; Thu, 06 Aug 2015 21:37:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNWbC-0007G4-Oc for qemu-devel@nongnu.org; Thu, 06 Aug 2015 21:37:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNWbC-0007Fa-JI for qemu-devel@nongnu.org; Thu, 06 Aug 2015 21:37:30 -0400 Date: Thu, 6 Aug 2015 23:11:48 +0200 From: Marc =?UTF-8?B?TWFyw60=?= Message-ID: <20150806231148.5115a10c@markmb_rh> In-Reply-To: <55C3C848.5070208@redhat.com> References: <1438858816-29385-1-git-send-email-markmb@redhat.com> <1438858878-29450-1-git-send-email-markmb@redhat.com> <1438858878-29450-4-git-send-email-markmb@redhat.com> <55C3C848.5070208@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/5] Implement fw_cfg DMA interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: Peter Maydell , Drew Jones , Stefan Hajnoczi , qemu-devel@nongnu.org, Kevin O'Connor , Gerd Hoffmann On Thu, 6 Aug 2015 22:49:12 +0200 Laszlo Ersek wrote: [...] > > +static void fw_cfg_dma_mem_write(void *opaque, hwaddr addr, > > + uint64_t value, unsigned size) > > +{ > > + FWCfgState *s = opaque; > > + > > + s->dma_addr = be64_to_cpu(value); > > + fw_cfg_dma_transfer(s); > > +} > > So, this is similar to the ioport size limitation I described at the > top. Namely, I think that an Aarch32 guest won't be able to transfer > a 64-bit value with a single MMIO access. (I believe double-width > store instructions do exist, but they cannot be virtualized well. > They trap, but the instruction syndrome register won't give enough > info to the hypervisor.) > > Therefore, the address of the dma control structure should be passed > in two 32-bit wide accesses, both for the ioport mapping and the mmio > mapping. This can be done in two ways: > - write the two halves to the same register, and use a latch to > identify each 2nd access > - use different addresses. > > The latch sucks, because the guest has no way to bring the register > to a known good state. Therefore: > > In the ioport mapped case, the port range should go up to 0x519, and > two outl's are going to be necessary in the guest. The documentation > should spell out which outl (@ 0x512 or @ 0x516) will trigger the > actual transfer. > > (I vaguely recall that someone already described this, but I can't > find the message!) Previous answer to this patch, by Kevin O'Connor: "So, I think this code needs to be able to handle a 32bit write to a high bits address and then store those bits until the 32bit write to the low bits address occurs. (I'd also recommend that after every dma transfer the stored high bits are reset to zero so that the common case of a 32bit address can be performed with a single 32bit write to the low bits field.)" It's easier to do it this way. Thanks for you comments Marc