From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zd5K1-0007BP-9l for qemu-devel@nongnu.org; Fri, 18 Sep 2015 19:44:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zd5Jx-0001NK-92 for qemu-devel@nongnu.org; Fri, 18 Sep 2015 19:44:05 -0400 Received: from mail-qg0-f42.google.com ([209.85.192.42]:35164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zd5Jx-0001NE-5x for qemu-devel@nongnu.org; Fri, 18 Sep 2015 19:44:01 -0400 Received: by qgt47 with SMTP id 47so51385675qgt.2 for ; Fri, 18 Sep 2015 16:44:00 -0700 (PDT) Date: Fri, 18 Sep 2015 19:43:59 -0400 From: Kevin O'Connor Message-ID: <20150918234359.GA30932@morn.lan> References: <1442566703-5091-1-git-send-email-markmb@redhat.com> <1442566729-5133-1-git-send-email-markmb@redhat.com> <20150918182509.GA13450@morn.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v3 0/5] fw_cfg DMA interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Drew , Stefan Hajnoczi , QEMU Developers , Gerd Hoffmann , Marc =?iso-8859-1?Q?Mar=ED?= , Laszlo On Fri, Sep 18, 2015 at 11:47:52PM +0100, Peter Maydell wrote: > On 18 September 2015 at 19:25, Kevin O'Connor wrote: > > +Additionaly, if the DMA interface is available then a read to the DMA > > +Address will return 0x51454d5520434647 ("QEMU CFG" in big-endian > > +format). > > + > > I don't think I understand this. If you know the DMA Address > port or register exists, then you know (by definition) that > the DMA interface is available. If you don't know that the > DMA interface is available then you can't read from the DMA > Address port or register because it might not exist and could > therefore cause you to blow up. > > If you want to be able to tell without doing the "use the > old-style interface to query the version" thing, then you > need to look in the ACPI or device tree tables (and those > tables need to be such that you can tell the difference, > which is the case for at least device tree; haven't checked > ACPI.) Hi Peter, On x86 the firmware can't use acpi (nor device tree) to find fw_cfg because fw_cfg is what is used to transfer acpi to the firmware. So, the firmware just hard codes the address. As a "sanity check", the firmware currently checks for a signature before using fw_cfg to verify everything is working correctly (outw(0x0000, 0x510); inb(0x511) == 'Q'; inb(0x511) == 'E'; ...). A check for the new dma interface involves an additional query (outw(0x0001, 0x510); inb(0x511) == 3; ...). I'm proposing that a future firmware (that didn't need to support old versions of QEMU) could use a simpler sanity check instead (inl(0x514) == "QEMU"; inl(0x518) == " CFG"). Granted, both the old check and the new proposed check would not be needed on platforms that have a device tree transmitted separately from fw_cfg. Though, even on those platforms, there is no harm in defining what happens on a read event. -Kevin