On 08/11/17 13:03, Paolo Bonzini wrote: > On 08/11/2017 12:55, Juergen Gross wrote: >> On 08/11/17 12:18, Jan Beulich wrote: >>>>>> On 08.11.17 at 10:07, <jgross@xxxxxxxx> wrote: >>>> In case we are booted via the default boot entry by a generic loader >>>> like grub or OVMF it is necessary to distinguish between a HVM guest >>>> with a device model supporting legacy devices and a PVH guest without >>>> device model. >>>> >>>> PVH guests will always have x86_platform.legacy.no_vga set and >>>> x86_platform.legacy.rtc cleared, while both won't be true for HVM >>>> guests. >>>> >>>> Test for both conditions in the guest_late_init hook and set xen_pvh >>>> to true if they are met. >>> >>> This sounds pretty fragile to me: I can't see a reason why a proper >>> HVM guest couldn't come without VGA and RTC. That's not possible >>> today, agreed, but certainly an option down the road if virtualization >>> follows bare metal's road towards being legacy free. >> >> From guest's perspective: what is the difference between a legacy free >> HVM domain and PVH? In the end the need for differentiating is to avoid >> access to legacy features in PVH as those would require a device model. > > My understanding of Xen is very rusty at this point, but I think a > "completely" legacy-free HVM domain will still have a PCI bus and the > Xen platform device on that bus. > > A PVH domain just knows how to access the Xen PV features. A HVM domain does so, too. Today maybe only partially, but e.g. event channels work in a HVM domain even without the Xen platform device. Grant tables can be made working without the platform device, too, and I'm already preparing a patch to do exactly that. The only need for the platform device will then be to have an interface for unplugging emulated boot devices in favor of the pv devices. And without the platform device we can just skip that step without doing any harm, as this can happen only for PVH where we have no need to do the unplug, or for HVM explicitly configured to work without platform device needing to continue using the emulated devices as it is doing today in this case. Juergen