[SeaBIOS] [PATCH 1/2] Add QEMU fw_cfg DMA interface
Kevin O'Connor
kevin at koconnor.net
Thu Aug 6 15:24:09 CET 2015
On Thu, Aug 06, 2015 at 01:35:27PM +0100, Stefan Hajnoczi wrote:
> On Thu, Aug 6, 2015 at 12:02 PM, Marc Marí <markmb at redhat.com> wrote:
> > + if (qemu_cfg_dma_enabled()) {
> > + QemuCfgDmaAccess access;
> > +
> > + access.address = (u64)(u32)buf;
> > + access.length = len;
> > + access.control = QEMU_CFG_DMA_CTL_READ;
> > +
> > + /*
> > + * The out is done before the write of the variables on memory. This
> > + * causes misread on the QEMU side.
> > + */
> > + barrier();
> > +
> > + outl((u32)&access, PORT_QEMU_CFG_DMA_ADDR);
>
> I thought PORT_QEMU_CFG_DMA_ADDR is a 64-bit register according to the
> spec you posted?
>
> > + while(access.length != 0 && !(access.control & QEMU_CFG_DMA_CTL_ERROR));
>
> Either the field accesses need to be marked volatile, or a barrier is
> needed to force the compiler to reload these register from memory each
> iteration of the loop.
In seabios, one would use the yield() call. For example:
while (access.control & QEMU_CFG_DMA_CTL_READ)
yield();
-Kevin
More information about the SeaBIOS
mailing list