On Thu, Apr 01, 2021 at 05:26:03PM +0100, Andrew Cooper wrote: > On 23/03/2021 09:58, Roger Pau Monne wrote: > > Introduce a helper to obtain a compatible cpu policy based on two > > input cpu policies. Currently this is done by and'ing all CPUID leaves > > and MSR entries, except for MSR_ARCH_CAPABILITIES which has the RSBA > > bit or'ed. > > > > The _AC macro is pulled from libxl_internal.h into xen-tools/libs.h > > since it's required in order to use the msr-index.h header. > > > > Note there's no need to place this helper in libx86, since the > > calculation of a compatible policy shouldn't be done from the > > hypervisor. > > > > No callers of the interface introduced. > > > > Signed-off-by: Roger Pau Monné <roger....@citrix.com> > > I think this wants to be in libx86, because we'll want it to replace the > opencoded derivation logic in init_cpuid()
I think you mean init_domain_cpuid_policy or recalculate_cpuid_policy? I cannot find any init_cpuid. I'm not convinced we need this in libx86 for the hypervisor, as I don't know exactly how we would use it there. I expect the hypervisor to validate policies provided by the toolstack, but not for it to create such policies unless for very specific domains (ie: dom0 or similar) which shouldn't require any leveling. I'm happy to place it libx86, but I think I need to understand better why it needs to be there. > Also, we absolutely want to unit test it. (I could have sworn I already > started some work there - maybe its hidden in one of my WIP branches). I don't think we have unit tests for the xenguest library? Thanks, Roger.