qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jordan Justen <jljusten@gmail.com>,
	seabios@seabios.org, qemu-devel@nongnu.org,
	Kevin O'Connor <kevin@koconnor.net>,
	Gerd Hoffmann <kraxel@redhat.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [Qemu-devel] [PATCH] qemu: piix: PCI bridge ACPI hotplug support
Date: Mon, 10 Jun 2013 16:45:53 -0500	[thread overview]
Message-ID: <87mwqxzlke.fsf@codemonkey.ws> (raw)
In-Reply-To: <51B63A74.1030905@redhat.com>

Laszlo Ersek <lersek@redhat.com> writes:

> On 06/10/13 21:57, Anthony Liguori wrote:
>> Laszlo Ersek <lersek@redhat.com> writes:
>
>> 
>> I don't understand this piece.
>> 
>> Other than TianoCore being a weird environment, what made this more
>> difficult than it is to generate the tables in QEMU?
>
> QEMU can pass down two kinds of SMBIOS config items over fw_cfg:
> verbatim tables and individual fields.
>
> The verbatim table kind means "install this table as-is". I'm not sure
> how SeaBIOS solves it, in OVMF you call Smbios->Add().
>
> Regarding the "field kind" config item: for each table type required by
> the SMBIOS spec, if qemu doesn't provide such a table in whole / in
> verbatim, then the firmware must install a default table for that type,
> *and* patch it with any referring field kind config items.
>
> Given the current format of the "field kind" config item, it is
> currently not possible to just iterate over the "field kind" config
> items, and patch whatever field in whatever table they refer to. The
> information contained in the "field kind" config item is insufficient to
> do this.
>
> The "field kind" config item designates a (table, field offset) pair. If
> that offset points at a string-typed SMBIOS field (basically string
> serial number into the unformatted area), one must update the
> unformatted string area after the actual table fields. (In OVMF one does
> this with a different call, Smbios->UpdateStrings(), and at that point
> the table even must have been installed already.)
>
> If the offset points at a non-string-typed (= in-formatted-area) field,
> the field must be overwritten in-place. (In OVMF this must happen
> *before* table installation, ie. before Smbios->Add().)

Okay, I understand the problem here.  Thanks for the explanation.  I had
assumed that the smbios_field structure was the binary representation of
the table.  I didn't realize it was our own format used to pass
information over.

> So, the current fw_cfg representation is insufficient, and the firmware
> must extend (or qemu should have extended) the info contents with this
> distinction between formatted and unformatted. Again this differs from
> field to field and the origin of that classification is the SMBIOS spec.
>
> Until this point in my email there has been no clear indication whether
> qemu or the firmware should do this. *Some* side will have to suffer
> shoveling the field/offset info, and a table template for each type,
> from the SMBIOS spec into code. I described the above solely as
> background, to set the landscape.
>
> (a) The first thing that tips the scale is: of qemu there is one, and of
> firmware, there exist at least two, *wildly different* implementations.
> (Apologies, I forgot about coreboot; not sure if it's affected.) It's
> not a design purity argument, just what's cheaper.

The only reason there are two implementations is a licensing problem
that must be solved anyway.

> (b) The second thing that further unbalances the scale: suppose you
> decide to add further field-kind overrides to qemu. For example,
> currently Type 3 (chassis information, table required by SMBIOS spec)
> cannot be overridden field-wise.

The reason we expose blobs in SMBIOS is that blobs can be vendor
specific and there was a strong desire to allow vendor specific blobs to
be passed through.  There really is no choice but to expose a blob
interface for that.

> If a user is unhappy with her firmware's default Type 3 table, she's
> allowed to hex-edit a Type 3 blob, and pass it with "-smbios
> file=type3.blob" on the qemu command line. If you as developer want to
> provide her with more flexibility, you need to
> (i) patch qemu (of course), to recognize individual fields on the
> command line, and to populate fw_cfg with them,
> (ii) patch *every single firmware* supported by qemu to *look for* those
> (type=3,offset) field-kind config entries, and to effectuate them.
>
> If you pass down only verbatim tables, then (ii) falls away. You don't
> have to update SeaBIOS, nor OVMF.

OVMF is proprietary.  It is not "supported" by QEMU.  Firmware is a
fundamental part of our stack.  I'm not really convinced that
QEMU<->firmware is a GPL boundary because of how tightly the two are
linked.

Moving large chunks of firmware code into QEMU just to avoid solving
licensing issues is a non-starter with me.

> As a bonus, you don't have to care
> about versions: age-old firmware that only knows how to install verbatim
> tables will immediately benefit from qemu's new-fangled Type 3
> flexibility.

This presume that (1) you only care about exposing this information to
x86 guests (2) that the firmware will never have any need to patch these
blobs.

> Case in point: <https://bugzilla.redhat.com/show_bug.cgi?id=788142>.
> (Non-public bug, sorry about that. I think I can disclose that it is
> about supporting the "field kind" config entry for Type 3 tables.)

This information is *exactly* the kind of information that you want to
be exposed across architectures.  It makes lots of sense to model a
device to expose this type of information in a structure way.

This discussion comes down to two things I think: (a) our existing
firmware interface is pretty poor (b) we are duplicating work because of
firmware licensing.

We can fix (a) and there's lots of value in doing that in terms of
improving support for other architectures.  We've discussed (b) in other
threads and I've stated my opinion on the direction we need to take.

Regards,

Anthony Liguori

>
>
> For ACPI tables, especially for tables containing AML, multiply the cost
> of (ii) by twenty. Many more offsets to patch and vastly more
> dependencies via fw_cfg.
>
> Laszlo

  parent reply	other threads:[~2013-06-10 21:45 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 16:41 [Qemu-devel] [PATCH] qemu: piix: PCI bridge ACPI hotplug support Michael S. Tsirkin
2013-06-10 18:58 ` Anthony Liguori
2013-06-10 19:17   ` Peter Maydell
2013-06-10 19:50     ` Anthony Liguori
2013-06-10 19:43   ` Laszlo Ersek
2013-06-10 19:57     ` Anthony Liguori
2013-06-10 20:43       ` Laszlo Ersek
2013-06-10 21:14         ` Laszlo Ersek
2013-06-10 21:45         ` Anthony Liguori [this message]
2013-06-10 23:05           ` Kevin O'Connor
2013-06-10 23:34             ` Anthony Liguori
2013-06-10 23:52               ` David Woodhouse
2013-06-11  0:11                 ` Anthony Liguori
2013-06-11 14:11                   ` David Woodhouse
2013-06-11  0:23               ` Kevin O'Connor
2013-06-11  0:51                 ` Anthony Liguori
2013-06-11  1:19                   ` Kevin O'Connor
2013-06-11  1:25                     ` Anthony Liguori
2013-06-11  1:49                       ` Kevin O'Connor
2013-06-11  6:49                       ` Michael S. Tsirkin
2013-06-11  0:28           ` Jordan Justen
2013-06-11  1:03             ` Anthony Liguori
2013-06-11  1:32               ` Jordan Justen
2013-06-11  7:35               ` Michael S. Tsirkin
2013-06-13 23:05                 ` Paolo Bonzini
2013-06-14  0:59                   ` Anthony Liguori
2013-06-14  1:23                     ` [Qemu-devel] [SeaBIOS] " Peter Stuge
2013-06-11 14:04               ` David Woodhouse
2013-06-13 23:02               ` [Qemu-devel] " Paolo Bonzini
2013-06-14  0:26                 ` Laszlo Ersek
2013-06-16 10:00                   ` Laszlo Ersek
2013-06-11  5:22   ` Michael S. Tsirkin
2013-06-11  5:33 ` Gerd Hoffmann
2013-06-11  6:55   ` Michael S. Tsirkin
2013-06-11  7:42     ` Gerd Hoffmann
2013-06-11  7:53       ` Michael S. Tsirkin
2013-06-11  8:00         ` Gerd Hoffmann
2013-06-11  8:18           ` Michael S. Tsirkin
2013-06-11  8:27             ` Michael S. Tsirkin

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=87mwqxzlke.fsf@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=dwmw2@infradead.org \
    --cc=jljusten@gmail.com \
    --cc=kevin@koconnor.net \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).