On Wed, Jul 22, 2015 at 10:31:12AM +0200, Marc Marí wrote: > On Wed, 22 Jul 2015 00:24:34 -0400 > "Kevin O'Connor" <ke...@koconnor.net> wrote: > > On Tue, Jul 21, 2015 at 06:03:41PM +0200, Marc Marí wrote: > > > From: Gerd Hoffmann <kra...@redhat.com> > > > > > > First draft of a fw_cfg dma interface. Designed as add-on to the > > > extisting fw_cfg interface, i.e. there is no select register. There > > > are four 32bit registers: Target address (low and high bits), > > > transfer length, control register. > > > > If I read this interface correctly, a guest will have at least six > > faults to complete a typical fw_cfg dma transfer (select, target low, > > target high, transfer length, control register write, control register > > read). I wonder if using a DMA transfer descriptor might be more > > efficient. [...] > That is probably faster and more flexible. I think it's a good step > forward. But, on the other side, is this a too big break of what is > actually implemented in MMIO? > > At the end we will have MMIO version, with a select and a data > register, and DMA version, with a 64 bit address register. How can we > differentiate between versions? Laszlo talks about the ID, but this is > already in one of the fields (so you need to know the protocol to get > the protocol). How could we do this transition more seamless?
Well, one way would be to place a 64bit MMIO (or IO) register at a magic address. The firmware could then read the magic address and check it against a signature (eg, "QEMU CFG"). If the signature matches then it would know it could use the DMA version of the fw_cfg interface (by issuing writes, instead of reads, to the magic address). The firmware would then not have to use the older select/data fw_cfg interface at all. Another possibility would be to place the new fw_cfg dma register address into a named fw_cfg "file" (eg, "fw_cfg_dma"). The firmware could then use the existing select/data fw_cfg interface to check if the new dma interface is available by scanning for that "fw_cfg_dma" file. This has the advantage of not requiring a new "magic address", but has the disadvantage of a more complex probe. Just a thought, -Kevin