Improved multi-platform support
Quoted 7 lines · David Woodhouse
Quoted 5 lines · David Woodhouse
I'll probably have a look at OVMF under Xen now, and making sure that my CSM code works there. Then you shouldn't need to offer people the choice between OVMF and SeaBIOS because you'll have one image that handles everything (which is what people get on real hardware, and expect).
Quoted 5 lines
That part, at least, was surprisingly easy. The same OVMF images (with SeaBIOS-as-CSM) that I've been testing under Qemu work fine under Xen too. The OVMF build system is hosed for GCC 4.7 and your own
Makefilealso has 'GCC44' in the path when copying out the build result. when it could have been 'GCC4?' and at least been a little more robust.
The chap who did our OVMF stuff has moved on to pastures new but ISTR him saying something about a build bug with GCC!=44, which had been fixed in upstream OVMF but not yet sync'd into the Xen tree.
Quoted 1 line
But that's just fluff. Basically, it works.
Awesome! (I've CCd xen-devel just for their info, it's moderated for non-subscribers but valid posters get whitelisted)
Quoted 2 lines
I did need to fix the VGA ROM you're shipping for Cirrus, which has the PCIR structure unaligned. That was it.
I would have put a substantial sum of money on the VGA ROM we ship not being used in the SeaBIOS configuration, since SB pulls the ROM from the emulated cards ROM BAR. The Cirrus ROM we ship should be used with ROMBIOS only. I wonder what's going on there (another one for my list)
Or did you mean the VGA ROM we ship in the qemu-xen branch that we include? (rather than tools/firmware/vgabios/)
Quoted 1 line
Again, this is without actually trying to boot any OS :)
Lets not get carried away :-P
Ian.
Signature · 5 lines
Ian Campbell Current Noise: Pink Floyd - Time * weasel wonders how stupid one has to be to spam alt.anonymous.messages weasel: about half as stupid as one has to be to harvest it.
Quoted 3 lines · Ian Campbell
The chap who did our OVMF stuff has moved on to pastures new but ISTR him saying something about a build bug with GCC!=44, which had been fixed in upstream OVMF but not yet sync'd into the Xen tree.
Yes, OVMF's toolchain handling is somewhat broken. I *do* have it building with GCC 4.6 and 4.7. There's a patch in my tree at git:// and
http://git.infradead.org/users/dwmw2/edk2.git which fixes that... although I suspect it might be incomplete and I'm about to blow away my local build tree and configure from scratch to retest.
But your tools/ovmf-makefile could also do with s/GCC44/GCC4?/ in the line which does
cp Build/OvmfX64/DEBUG_GCC44/FV/OVMF.fd ovmf.bin
Quoted 2 lines
Awesome! (I've CCd xen-devel just for their info, it's moderated for non-subscribers but valid posters get whitelisted)
In that case I think the only context I need to add, for those who want to play along at home, is the location of my trees for OVMF and SeaBIOS. The OVMF one is above, and the SeaBIOS one is next to it:git:// or http://git.infradead.org/users/dwmw2/seabios.git
There's a README.CSM file in the SeaBIOS tree which describes how to build OVMF with CSM support. The main reason I'm pointing you at my trees rather than upstream is the patch within each one that adds the UmbStart,UmbEnd fields for negotiating between UEFI and SeaBIOS which parts of the UMB memory region should be made read-only. For Qemu with KVM that's a moot point because it doesn't get made read-only anyway, so you could just use upstream now. If you don't implement the PAM protection of those regions, I suspect the same might be true for you. Suck it and see, perhaps.
Quoted 5 lines
Quoted 2 lines
I did need to fix the VGA ROM you're shipping for Cirrus, which has the PCIR structure unaligned. That was it.
... did you mean the VGA ROM we ship in the qemu-xen branch that we include? (rather than
tools/firmware/vgabios/)
Yes, the one in /usr/share/qemu-xen. You want the patch from
http://lists.gnu.org/archive/html/qemu-devel/2013-01/msg03650.html
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 11 lines · David Woodhouse
Quoted 3 lines · Ian Campbell
The chap who did our OVMF stuff has moved on to pastures new but ISTR him saying something about a build bug with GCC!=44, which had been fixed in upstream OVMF but not yet sync'd into the Xen tree.
Yes, OVMF's toolchain handling is somewhat broken. I *do* have it building with GCC 4.6 and 4.7. There's a patch in my tree at
git://and
http://git.infradead.org/users/dwmw2/edk2.git which fixes that... although I suspect it might be incomplete and I'm about to blow away my local build tree and configure from scratch to retest.
Quoted 3 lines
But your
tools/ovmf-makefilecould also do with s/GCC44/GCC4?/ in the line which does
cp Build/OvmfX64/DEBUG_GCC44/FV/OVMF.fd ovmf.bin
Ack, thanks.
We try and support a reasonably wide range of hosts, usually we use Debian Stable as our baseline (which is currently 4.4).
Quoted 11 lines
Quoted 3 lines
Awesome! (I've CCd xen-devel just for their info, it's moderated for non-subscribers but valid posters get whitelisted)
In that case I think the only context I need to add, for those who want to play along at home, is the location of my trees for OVMF and SeaBIOS. The OVMF one is above, and the SeaBIOS one is next to it:
git://or http://git.infradead.org/users/dwmw2/seabios.gitThere's a README.CSM file in the SeaBIOS tree which describes how to build OVMF with CSM support.
Do I understand correctly from the README that once CSM support is enabled at build time you can choose to use it dynamically at boot time? If so, Neat!
I suppose this selection is persistent for a given VM, but where is it saved?
Quoted 8 lines
The main reason I'm pointing you at my
trees rather than upstream is the patch within each one that adds the UmbStart,UmbEnd fields for negotiating between UEFI and SeaBIOS which parts of the UMB memory region should be made read-only. For Qemu with KVM that's a moot point because it doesn't get made read-only anyway, so you could just use upstream now. If you don't implement the PAM protection of those regions, I suspect the same might be true for you. Suck it and see, perhaps.
Right, we really need to find someone with hours to finish properly integrating OVMF.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
I did need to fix the VGA ROM you're shipping for Cirrus, which has the PCIR structure unaligned. That was it.
... did you mean the VGA ROM we ship in the qemu-xen branch that we include? (rather than
tools/firmware/vgabios/)Yes, the one in
/usr/share/qemu-xen. You want the patch from
http://lists.gnu.org/archive/html/qemu-devel/2013-01/msg03650.html
Thanks.
Signature · 5 lines
Ian Campbell Current Noise: W.A.S.P. - Harder, Faster We don't need no education, we don't need no thought control. -- Pink Floyd
Quoted 9 lines · Ian Campbell
Quoted 4 lines · David Woodhouse
git.infradead.org/users/dwmw2/seabios.git
There's a README.CSM file in the SeaBIOS tree which describes how to build OVMF with CSM support.
Do I understand correctly from the README that once CSM support is enabled at build time you can choose to use it dynamically at boot time? If so, Neat!
Right. It's just another boot target. The UEFI device path for each of the bot targets, and the bootorder variable which sets their relative priorities, are stored in persistent nvram storage...
Quoted 2 lines
I suppose this selection is persistent for a given VM, but where is it saved?
That's another item on my TODO list. On real hardware it's actually stored in flash. On OVMF we don't have an answer. There's a dirty hack which stores them in a *file* on the EFI system partition, but that really isn't very helpful it stops working when the OS calls ExitBootServices — because you can't be touching the file system at the same time the OS might be. So when an OS installer does its install and then sets the NV variables to boot into the newly-installed OS... it can't work.
There was some initial work on supporting -pflash for qemu on i386 and working exactly like real hardware does — which meant firmware upgrades had to be done the same way since the firmware and the variables were all in the same image. And it didn't work with KVM.
I'm looking at fixing this to use a flash device *other* than the one that the firmware runs from, adjacent to it at the top of memory. Or something like that. But it's not quite solved yet. It'll *need* to be, for OVMF to be usable in the general case. And then it's solved automatically for CSM too.
Signature · 1 line
dwmw2
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 2 lines · Ian Campbell
Right, we really need to find someone with hours to finish properly integrating OVMF.
Hm, that 'someone' may end up being me¹.
So... from the Xen point of view, what needs doing? There are some things on my TODO list which apply to Qemu/KVM too — most importantly, fixing bootorder handling, which basically involves fixing the general case of NV variable storage for UEFI as discussed. But is there anything Xen-specific that I'm likely to miss?
And on the subject of the NV storage... does -pflash work on qemu-xen, as long as we're not actually running *code* from the device and we're only using it for data storage? Are you content with my stated plan to provide a "disk" image for that, which is something like a 256KiB file on the host side, exposed as a flash device to the guest?
Signature · 12 lines
dwmw2 ¹ Statements that refer to plans and expectations for the year and the future are forward-looking statements that involve a number of risks and uncertainties. Words such as “anticipates,” “expects,” “intends,” “plans,” “believes,” “seeks,” “estimates,” “may,” “will,” “should” and their variations identify forward-looking statements. Statements that refer to or are based on projections, uncertain events or assumptions also identify forward-looking statements. Many factors could affect actual results, and variances from current expectations regarding such factors could cause actual results to differ materially from those expressed in these forward-looking statements.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · David Woodhouse
Quoted 2 lines · Ian Campbell
Right, we really need to find someone with hours to finish properly integrating OVMF.
Hm, that 'someone' may end up being me¹.
That would be awesome!
I was actually wondering if this might make a good GSoC project, there has been someone (the same guy IIRC) doing Tianocore on Xen stuff in the last two years, under the Tianocore umbrella although with a Xen.org co-mentor.
Quoted 1 line
So... from the Xen point of view, what needs doing?
I haven't looked at or run OVMF stuff myself on Xen or otherwise, so take this with a pinch of salt...
I expect there will be some rough edges like the NV variable thing -- I have a feeling these will have a lot in common with qemu/KVM, since they would tend to interact with the "platform" (provided by qemu-dm under Xen) rather than processor or memory virt etc.
For the most part the I reckon the Xen specific things will be resync with a recent upstream and fixup the Xen build system integration, stuff like that.
We'd like to see PV I/O drivers at some point but that's a separate project in its own right I think.
Quoted 5 lines
There are some
things on my TODO list which apply to Qemu/KVM too — most importantly, fixing bootorder handling, which basically involves fixing the general case of NV variable storage for UEFI as discussed. But is there anything Xen-specific that I'm likely to miss?
The main difference between Xen and Qemu/KVM in this context is that Xen supplied it's own SMBIOS & ACPI tables etc. There's a likelyhood of Xen and OVMF exposing each others bugs in that area I suspect.
Quoted 3 lines
And on the subject of the NV storage... does -pflash work on qemu-xen, as long as we're not actually running *code* from the device and we're only using it for data storage?
I'm not sure, I've CC'd Anthony & Stefano. Assuming the Xen machine type in Qemu wires it up then I don't know why it shouldn't work and if we don't wire it up I don't see why we couldn't.
Hvmloader might need to be tweaked to setup the e820 correctly and perhaps the some table or other would need to refer to it also?
If the ARM world continues moving towards UEFI then eventually we will likely want to enable this there too, but lets sort out x86 first.
Quoted 3 lines
Are you content with my stated plan to
provide a "disk" image for that, which is something like a 256KiB file on the host side, exposed as a flash device to the guest?
It sounds OK to me. The other option would be to stash it in xenstore, but that doesn't sound like the right option to me.
Ian.
Signature · 10 lines
Ian Campbell Fascinating is a word I use for the unexpected. -- Spock, "The Squire of Gothos", stardate 2124.5 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 4 lines · Ian Campbell
I expect there will be some rough edges like the NV variable thing -- I have a feeling these will have a lot in common with qemu/KVM, since they would tend to interact with the "platform" (provided by qemu-dm under Xen) rather than processor or memory virt etc.
Well, it's mostly just storing text strings describing which device/path to boot from. So hopefully if the flash storage itself is OK for Xen, the rest should just work.
Quoted 3 lines
For the most part the I reckon the Xen specific things will be resync with a recent upstream and fixup the Xen build system integration, stuff like that.
Current upstream OVMF works, AFAICT. Although as I said, I haven't even tried booting an OS.
One thing I obviously *also* haven't tested, therefore, is *rebooting*., We've discovered a KVM bug on older CPUs without 'unrestricted guest' mode, where after a reset it actually runs code from 0xffff0 and not 0xfffffff0. With the former being SeaBIOS-CSM, and the latter being the OVMF startup code that we *should* be running, that's kind of a problem.
If you have a similar bug, please go and fix it so I never have to know :)
Quoted 2 lines
We'd like to see PV I/O drivers at some point but that's a separate project in its own right I think.
If you have an option ROM for them, that might not be a high priority. I think OVMF can thunk into INT 13h for disk access.
Quoted 7 lines
Quoted 3 lines
And on the subject of the NV storage... does -pflash work on qemu-xen, as long as we're not actually running *code* from the device and we're only using it for data storage?
I'm not sure, I've CC'd Anthony & Stefano. Assuming the Xen machine type in Qemu wires it up then I don't know why it shouldn't work and if we don't wire it up I don't see why we couldn't.
Qemu does but not in KVM mode, because it can't *execute* from a region and also catch writes to properly emulate flash. But for a flash device that we *don't* execute from, because it's only used for NV storage and not the firmware itself, that restriction isn't important. So I'll need to fix that.
Quoted 2 lines
Hvmloader might need to be tweaked to setup the e820 correctly and perhaps the some table or other would need to refer to it also?
Right. Haven't quite worked out how it would be 'found' by the firmware yet. I was going to suggest making the address available via fw_cfg... but you don't implement that.
Signature · 1 line
dwmw2
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · David Woodhouse
Quoted 4 lines · Ian Campbell
I expect there will be some rough edges like the NV variable thing -- I have a feeling these will have a lot in common with qemu/KVM, since they would tend to interact with the "platform" (provided by qemu-dm under Xen) rather than processor or memory virt etc.
Well, it's mostly just storing text strings describing which device/path to boot from. So hopefully if the flash storage itself is OK for Xen, the rest should just work.
Ack.
Quoted 7 lines
Quoted 3 lines
For the most part the I reckon the Xen specific things will be resync with a recent upstream and fixup the Xen build system integration, stuff like that.
Current upstream OVMF works, AFAICT. Although as I said, I haven't even tried booting an OS.
Quoted 8 lines
One thing I obviously *also* haven't tested, therefore, is *rebooting*., We've discovered a KVM bug on older CPUs without 'unrestricted guest' mode, where after a reset it actually runs code from
0xffff0and not0xfffffff0. With the former being SeaBIOS-CSM, and the latter being the OVMF startup code that we *should* be running, that's kind of a problem.If you have a similar bug, please go and fix it so I never have to know :)
I've not heard of such a thing, but I've been half following the thread and it sounds a bit, shall we say, subtle ;-)
Under Xen when qemu gets a reset event (via I/O writes or whatever) it ends up with the toolstack actually destroying and recreating the domain, so I think the issue you are thinking of doesn't come up.
Quoted 5 lines
Quoted 2 lines
We'd like to see PV I/O drivers at some point but that's a separate project in its own right I think.
If you have an option ROM for them, that might not be a high priority. I think OVMF can thunk into INT 13h for disk access.
We don't have an option ROM, but that might be an interesting way to approach things, although there are issues with teardown before the OS comes along which endbootservices solves nicely for us.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
And on the subject of the NV storage... does -pflash work on qemu-xen, as long as we're not actually running *code* from the device and we're only using it for data storage?
I'm not sure, I've CC'd Anthony & Stefano. Assuming the Xen machine type in Qemu wires it up then I don't know why it shouldn't work and if we don't wire it up I don't see why we couldn't.
Quoted 5 lines
Qemu does but not in KVM mode, because it can't *execute* from a region and also catch writes to properly emulate flash. But for a flash device that we *don't* execute from, because it's only used for NV storage and not the firmware itself, that restriction isn't important. So I'll need to fix that.
Maybe it would be useful to emulate a dumb NV RAM region, as opposed to a full flash emulation?
Quoted 6 lines
Quoted 2 lines
Hvmloader might need to be tweaked to setup the e820 correctly and perhaps the some table or other would need to refer to it also?
Right. Haven't quite worked out how it would be 'found' by the firmware yet. I was going to suggest making the address available via
fw_cfg... but you don't implement that.
There's a little protocol between HVMloader and SeaBIOS which passes the tables across, see src/xen.c struct xen_seabios_info. Perhaps HVMloader+OVMF should be (or is?) using the same (or similar). Either way it should be extensible to cover this new info. The other option is an HVM_PARAM, which is Xen specific, but pretty simple.
Ian.
Signature · 4 lines
Ian Campbell Current Noise: Old Man's Child - The Flames Of Deceit Did I SELL OUT yet??
placement of emulated flash [was: seabios Improved multi-platform support]
In reply to a message not in the archiveRegarding the ACPI tables, OVMF takes them from Xen. It scans 0x000EA020 to 0x000FFFFF for the RSDP and goes from there. See OvmfPkg/AcpiPlatformDxe/Xen.c.
I'm not sure about the e820 table. In hvmloader's build_e820_table() [tools/firmware/hvmloader/e820.c], a range starting at RESERVED_MEMBASE is added to the table:
/*
* Explicitly reserve space for special pages.
* This space starts at RESERVED_MEMBASE an extends to cover various
* fixed hardware mappings (e.g., LAPIC, IOAPIC, default SVGA framebuffer). *
* If igd_opregion_pgbase we need to split the RESERVED region in two. */
I gather this range is found non-specially by SeaBIOS [src/xen.c] in xen_ramsize_preinit(), following the xen_seabios_info struct you mentioned, placed at 0x00001000.
However in OVMF the RESERVED_MEMBASE range is not parsed from this Xen-exported table, it is added manually in InitializeXen() [OvmfPkg/PlatformPei/Xen.c]:
//
// Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000). // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE. //
AddReservedMemoryBaseSizeHob (0xFC000000, 0x1000000);
"MemDetect.c" in the same directory might be relevant as well (GetSystemMemorySizeBelow4gb(), GetSystemMemorySizeAbove4gb(); they work from the CMOS).
... I gather this is about the placement of the flash memory, yes? If a static address could work for the flash, I think in OVMF we should update
- MemMapInitialization() [OvmfPkg/PlatformPei/Platform.c]
- OvmfPkg/AcpiTables/Dsdt.asl
But I could be completely missing the topic here...
Thanks,
Laszlo
Re: placement of emulated flash [was: seabios Improved multi-platform support]
In reply to a message not in the archiveQuoted 9 lines · Laszlo Ersek
However in OVMF the
RESERVED_MEMBASErange is not parsed from this Xen-exported table, it is added manually inInitializeXen()[OvmfPkg/PlatformPei/Xen.c]://
// Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000). // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE. //
AddReservedMemoryBaseSizeHob (0xFC000000,0x1000000);
ICK, it would be far preferable for OVMF to do what SeaBIOS does and actually "communicate" with hvmloader IMHO.
Ian.
Signature · 6 lines
Ian Campbell Current Noise: Machine Head - Blistering Whatever doesn't succeed in two months and a half in California will never succeed. -- Rev. Henry Durant, founder of the University of California
Re: placement of emulated flash [was: seabios Improved multi-platform support]
In reply to a message not in the archiveQuoted 5 lines · Ian Campbell
Quoted 4 lines · Laszlo Ersek
However in OVMF the
RESERVED_MEMBASErange is not parsed from this Xen-exported table, it is added manually inInitializeXen()[OvmfPkg/PlatformPei/Xen.c]:
Quoted 8 lines
Quoted 5 lines
//
// Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000). // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE. //
AddReservedMemoryBaseSizeHob (0xFC000000,0x1000000);ICK, it would be far preferable for OVMF to do what SeaBIOS does and actually "communicate" with hvmloader IMHO.
The table with "XenHVMSeaBIOS" signature is not created for OVMF I think; comparing the "bios_config" structure of function pointers between "seabios.c" and "ovmf.c" in tools/firmware/hvmloader/, the ovmf_config.bios_info_setup field is NULL.
However there seem to be at least two "info" tables. Referring back, "seabios_info" at BIOS_INFO_PHYSICAL_ADDRESS (0x1000) is for SeaBIOS only, but "hvm_info" just below the end of conventional memory (at HVM_INFO_PADDR, 0x9F800) looks guest firmware independent.
I guess the quoted range would be available from "hvm_info.reserved_mem_pgstart"? OvmfPkg/PlatformPei/Xen.c has a comment in XenConnect() saying
/* TBD: Locate hvm_info and reserve it away. */
mXenInfo.HvmInfo = NULL;
Is the generic approach "see if you can find all what you need in hvm_info, ask for the rest in a dedicated table"? (Out of pure curiosity.)
Thanks
Laszlo
Re: placement of emulated flash [was: seabios Improved multi-platform support]
In reply to a message not in the archive(dropping Attilio he has left Citrix).
Quoted 12 lines · Laszlo Ersek
Quoted 11 lines · Ian Campbell
Quoted 9 lines · Laszlo Ersek
However in OVMF the
RESERVED_MEMBASErange is not parsed from this Xen-exported table, it is added manually inInitializeXen()[OvmfPkg/PlatformPei/Xen.c]://
// Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000). // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE. //
AddReservedMemoryBaseSizeHob (0xFC000000,0x1000000);
Quoted 7 lines
Quoted 2 lines
ICK, it would be far preferable for OVMF to do what SeaBIOS does and actually "communicate" with hvmloader IMHO.
The table with "XenHVMSeaBIOS" signature is not created for OVMF I think; comparing the "
bios_config" structure of function pointers between "seabios.c" and "ovmf.c" intools/firmware/hvmloader/, the ovmf_config.bios_info_setup field is NULL.
Yes. I think this should be changed then to provide a proper way for hvmloader to communicate to OVMF. It would seem sensible to follow a similar mechanism to SeaBIOS, or if possible just reuse the exact same thing (perhaps with a different signature).
Quoted 4 lines
However there seem to be at least two "info" tables. Referring back, "
seabios_info" atBIOS_INFO_PHYSICAL_ADDRESS(0x1000) is for SeaBIOS only, but "hvm_info" just below the end of conventional memory (atHVM_INFO_PADDR,0x9F800) looks guest firmware independent.
hvm_info is used by the toolstack to pass parameters to hvmloader itself when it starts, it is not intended to pass options from hvmloader to the bios. It is not a stable ABI struct (since hvmloader and the toolstack are a matched pair it doesn't have to be) and we hope to eventually get rid of it. Possibly hvmloader should scrub it before calling the BIOS to discourage its use.
Quoted 7 lines
I guess the quoted range would be available from "hvm_info.reserved_mem_pgstart"?
OvmfPkg/PlatformPei/Xen.chas a comment inXenConnect()saying/* TBD: Locate
hvm_infoand reserve it away. */
mXenInfo.HvmInfo = NULL;
Oh dear.
Quoted 2 lines
Is the generic approach "see if you can find all what you need in
hvm_info, ask for the rest in a dedicated table"? (Out of pure curiosity.)
As I hope is clear from the above, Nope ;-)
Ian.
Signature · 4 lines
Ian Campbell "Everyone is entitled to an *informed* opinion." -- Harlan Ellison