On Fri, Sep 18, 2015 at 11:47:52PM +0100, Peter Maydell wrote: > On 18 September 2015 at 19:25, Kevin O'Connor <ke...@koconnor.net> 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