All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin O'Connor <kevin@koconnor.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Drew <drjones@redhat.com>, "Stefan Hajnoczi" <stefanha@gmail.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Marc Marí" <markmb@redhat.com>, Laszlo <lersek@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 0/5] fw_cfg DMA interface
Date: Sat, 19 Sep 2015 11:15:20 -0400	[thread overview]
Message-ID: <20150919151520.GA24427@morn.lan> (raw)
In-Reply-To: <CAFEAcA8JFr2Zq2UwtKcVFND2mDyeB-9qBvdkiYth_rvYagUzuw@mail.gmail.com>

On Sat, Sep 19, 2015 at 10:48:37AM +0100, Peter Maydell wrote:
> On 19 September 2015 at 00:43, Kevin O'Connor <kevin@koconnor.net> wrote:
> > 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").
> 
> But what happens if you try this on an old QEMU? Won't it not
> have the newer ports present and so do bad things? At least
> on ARM trying to read from something you don't know for certain
> to exist is a bad idea because you're likely to get a fault.

Not on x86 - it used to be the norm to probe for old ISA devices via
io port reads and writes (eg, serial ports and lpt ports were detected
that way).  Here's what adding this to seabios:

  dprintf(1, "outl: %x %x\n", inl(0x514), inl(0x518));

reports on qemu v2.3 and earlier:

  outl: ffffffff ffffffff

on latest qemu with Marc's patches:

  outl: 0 0

and with my additional patch:

  outl: 554d4551 47464320

It's not a huge deal if you don't want to include the additional
signature.  It's not required as the v1 signature check still works
(see docs/specs/fw_cfg.txt), but the v1 check is a bit ugly and a new
additional simpler signature didn't seem like it would hurt.

-Kevin

  reply	other threads:[~2015-09-19 15:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18  8:58 QEMU fw_cfg DMA interface Marc Marí
2015-09-18  8:58 ` [Qemu-devel] " Marc Marí
2015-09-18  8:58 ` Marc Marí
2015-09-18  8:58 ` [Qemu-devel] [PATCH v3 0/5] " Marc Marí
2015-09-18  8:58   ` [Qemu-devel] [PATCH v3 1/5] fw_cfg: document fw_cfg_modify_iXX() update functions Marc Marí
2015-09-18  8:58   ` [Qemu-devel] [PATCH v3 2/5] fw_cfg DMA interface documentation Marc Marí
2015-09-18 15:15     ` Peter Maydell
2015-09-18  8:58   ` [Qemu-devel] [PATCH v3 3/5] Implement fw_cfg DMA interface Marc Marí
2015-09-18 15:31     ` Peter Maydell
2015-09-18 18:29     ` Kevin O'Connor
2015-09-18  8:58   ` [Qemu-devel] [PATCH v3 4/5] Enable fw_cfg DMA interface for ARM Marc Marí
2015-09-18 15:15     ` Peter Maydell
2015-09-18 19:33     ` Laszlo Ersek
2015-09-18 20:16     ` Laszlo Ersek
2015-09-18 20:24       ` Marc Marí
2015-09-18 23:10         ` Laszlo Ersek
2015-09-19 13:09           ` Marc Marí
2015-10-22 21:22           ` Gabriel L. Somlo
2015-10-26 10:48             ` Stefan Hajnoczi
2015-10-26 12:49               ` Gabriel L. Somlo
2015-10-26 13:38                 ` Laszlo Ersek
2015-10-26 14:21                   ` Gabriel L. Somlo
2015-10-27 11:11                   ` Gerd Hoffmann
2015-10-27 12:43                     ` Laszlo Ersek
2015-10-28  1:12                       ` Gabriel L. Somlo
2015-10-28 10:42                         ` Laszlo Ersek
2015-09-18  8:58   ` [Qemu-devel] [PATCH v3 5/5] Enable fw_cfg DMA interface for x86 Marc Marí
2015-09-18 10:58     ` Gerd Hoffmann
2015-09-18 15:12       ` Peter Maydell
2015-09-18 18:25   ` [Qemu-devel] [PATCH v3 0/5] fw_cfg DMA interface Kevin O'Connor
2015-09-18 19:14     ` Marc Marí
2015-09-18 22:47     ` Peter Maydell
2015-09-18 23:43       ` Kevin O'Connor
2015-09-19  9:48         ` Peter Maydell
2015-09-19 15:15           ` Kevin O'Connor [this message]
2015-09-18  8:59 ` [PATCH v3] QEMU fw_cfg DMA interface documentation Marc Marí

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150919151520.GA24427@morn.lan \
    --to=kevin@koconnor.net \
    --cc=drjones@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=markmb@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.