On 14/11/16 11:38, Jan Beulich wrote: >>>> On 14.11.16 at 12:01, <andrew.coop...@citrix.com> wrote: >> Luckily, hvm_hypervisor_cpuid_leaf() and vmx_hypervisor_cpuid_leaf() are safe >> to execute in the context of a PV guest, but HVM-specific feature flags >> shouldn't be visible to PV guests. >> >> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> > Reviewed-by: Jan Beulich <jbeul...@suse.com> > albeit ... > >> --- a/xen/arch/x86/traps.c >> +++ b/xen/arch/x86/traps.c >> @@ -928,6 +928,11 @@ int cpuid_hypervisor_leaves( uint32_t idx, uint32_t >> sub_idx, >> break; >> >> case 4: >> + if ( !has_hvm_container_domain(currd) ) >> + { >> + *eax = *ebx = *ecx = *edx = 0; >> + break; >> + } >> hvm_hypervisor_cpuid_leaf(sub_idx, eax, ebx, ecx, edx); >> break; > ... this being the last leaf, wouldn't we better limit the number of > leaves (reported in leaf 0) to 3 for PV?
I considered this, but decided not to. The current max leaf handling is fragile, owing to some dubious control from the toolstack, and the existence of XEN_CPUID_MAX_NUM_LEAVES in the public API is absolutely broken. I am going to need to rework this all anyway, and its not clear whether we can/should report less than 4 leaves to PV guests. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel