[SeaBIOS] [PATCH 1/3] Add generic qemu detection
gleb at redhat.com
Mon Sep 16 18:58:42 CEST 2013
On Mon, Sep 16, 2013 at 03:14:45PM +0200, Gerd Hoffmann wrote:
> On Mo, 2013-09-16 at 15:34 +0300, Gleb Natapov wrote:
> > On Mon, Sep 16, 2013 at 02:27:37PM +0200, Gerd Hoffmann wrote:
> > > On Mo, 2013-09-16 at 14:10 +0300, Gleb Natapov wrote:
> > > > On Mon, Sep 16, 2013 at 12:36:28PM +0200, Gerd Hoffmann wrote:
> > > > > This patch adds support for detecting whenever SeaBIOS runs on qemu
> > > > > or not. This is done by looking at the northbridge (pci device 00:00.0)
> > > > > and check the subsystem id. Most pci devices emulated by qemu -- the
> > > > > two northbridges i440fx and q35 included -- have a subsystem id of
> > > > > "1af4:1100".
> > > > >
> > > > > In case the subsystem ID matches set PF_QEMU, log a message (including
> > > > > the northbridge found while being at it) and also check for kvm.
> > > > >
> > > > What if other userspace will want to write enough support to run Seabios
> > > > as a guest? Why kvm detection depends on QEMU?
> > >
> > > What other userspace? There is none today. And if that changes some
> > > day we'll just call kvm_detect() in the init code for $otheruserspace.
> > >
> > Why seabios code has to be changed at all to support other device model
> > emulator (assuming it will emulate same chipset)?
> That is a purely theoretical thing. In practice seabios mist likely has
> to be changed for one or another reason.
It's not have to be this way if Seabios would check for specific HW features
instead of checking for QEMU. For instance if discovery of fw_cfg will
not depend on QEMU detection other userspace can emulate and it will be
detected without changing Seabios.
> kvm detection for CONFIG_QEMU builds only.
Indeed the current logic is the same.
> Also note that in theory seabios should not need to care at all whenever
> it runs on kvm or tcg. In practice qemu has slightly different behavior
> with kvm enabled and seabios needs adapt to that. That alone is reason
> enougth that supporting other kvm userspace very likely needs adaptions
> in seabios, unless your theoretical other userspace is bug compatible
> with qemu here.
I see only one thing that is done based on KVM detection and the logic
would be correct for other userspaces that do not provide e820 map.
>  Or do you know something you don't wanna tell me?
No, all I know is that kvmtool wanted to add seabios support, but I
guess nobody works on that these days.
More information about the SeaBIOS