On Thu, 23 Apr 2020 at 19:55, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote: > > On Thu, 23 Apr 2020 at 19:39, Andre Przywara <andre.przywara@xxxxxxx> wrote: > > > > Hi, > > > > an update for the CFI flash emulation, addressing Alex' comments and > > adding direct mapping support. > > The actual code changes to the flash emulation are minimal, mostly this > > is about renaming and cleanups. > > This versions now adds some patches. 1/5 is a required fix, the last > > three patches add mapping support as an extension. See below. > > > > In addition to a branch with this series[1], I also put a git branch with > > all the changes compared to v3[2] as separate patches on the server, please > > have a look if you want to verify against a previous review. > > > > =============== > > The EDK II UEFI firmware implementation requires some storage for the EFI > > variables, which is typically some flash storage. > > Since this is already supported on the EDK II side, and looks like a > > generic standard, this series adds a CFI flash emulation to kvmtool. > > > > Patch 2/5 is the actual emulation code, patch 1/5 is a bug-fix for > > registering MMIO devices, which is needed for this device. > > Patches 3-5 add support for mapping the flash memory into guest, should > > it be in read-array mode. For this to work, patch 3/5 is cherry-picked > > from Alex' PCIe reassignable BAR series, to support removing a memslot > > mapping. Patch 4/5 adds support for read-only mappings, while patch 5/5 > > adds or removes the mapping based on the current state. > > I am happy to squash 5/5 into 2/5, if we agree that patch 3/5 should be > > merged either separately or the PCIe series is actually merged before > > this one. > > > > This is one missing piece towards a working UEFI boot with kvmtool on > > ARM guests, the other is to provide writable PCI BARs, which is WIP. > > This series alone already enables UEFI boot, but only with virtio-mmio. > > > > Excellent! Thanks for taking the time to implement the r/o memslot for > the flash, it really makes the UEFI firmware much more usable. > > I will test this as soon as I get a chance, probably tomorrow. > I tested this on a SynQuacer box as a host, using EFI firmware [0] built from patches provided by Sami. I booted the Debian buster installer, completed the installation, and could boot into the system. The only glitch was the fact that the reboot didn't work, but I suppose we are not preserving the memory the contains the firmware image, so there is nothing to reboot into. But just restarting kvmtool with the flash image containing the EFI variables got me straight into GRUB and the installed OS. Tested-by: Ard Biesheuvel <ardb@xxxxxxxxxx> Thanks again for getting this sorted. [0] https://people.linaro.org/~ard.biesheuvel/KVMTOOL_EFI.fd