Hi Mike,

What's the point of upstreaming firmware for crosvm? Isn't crosvm supposed to be a "thin" hypervisor that runs the kernel directly?

Thanks,
Pedro

On Fri, Jun 17, 2022 at 12:40 AM Mike Gerow via groups.io <gerow=google.com@groups.io> wrote:
Hi Folks,

For the last few months I've been using OVMF with crosvm to give it the ability to boot a UEFI OS image in a UEFI environment, and it's been working fantastically! Eventually I'd like to get secure boot working, but I haven't fully begun exploring that yet. I just wanted to post here to figure out how I might go about making crosvm properly supported within OVMF.

As you might guess, OVMF didn't boot out of the box and I had to do quite a few hacks to get it to work. All the changes are attached as a diff, but I'll list the main points out here:

* Switch TimerLib from the ACPI-based ones like OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf to MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf since crosvm doesn't provide these methods
* Hack out the RTC dependency completely, since for reasons I haven't yet figured out crosvm hangs OVMF tries to access it
* Disable bus enumeration since crosvm doesn't support moving PCI BARs around, which causes it to hang
* Remove VirtioFsDxe dependency as crosvm seems to choke on certain things it's doing too
* Manually searching for ACPI tables instead of using PVH

And one major theme of some of the other changes: removing conditionals that checked if we're cloud-hypervisor and just doing things the cloud-hypervisor way (which happens to work under crosvm, for reasons that are readily apparent given the nature of cloud-hypervisor and crosvm).

Clearly this isn't upstreamable at this point, but I'd like eventually go that direction. I think a lot of these are just bugs in crosvm that'll need to be fixed, but for the cloud-hypervisor conditionals case I'd need to teach OVMF to detect when we're running under crosvm and act appropriately.

In either case, I appreciate your attention and any feedback you might have on what I'm trying to do here.



--
Pedro Falcato