[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 03/10] libx86: Introduce x86_cpu_policies_are_compatible()
On 13.09.2019 21:27, Andrew Cooper wrote: > --- /dev/null > +++ b/xen/lib/x86/policy.c > @@ -0,0 +1,54 @@ > +#include "private.h" > + > +#include <xen/lib/x86/cpu-policy.h> > + > +int x86_cpu_policies_are_compatible(const struct cpu_policy *host, > + const struct cpu_policy *guest, > + struct cpu_policy_errors *err) > +{ > + struct cpu_policy_errors e = INIT_CPU_POLICY_ERRORS; > + int ret = -EINVAL; > + > + if ( err ) > + *err = e; You don't really need this, do you? All paths lead ... > +#define NA XEN_CPUID_NO_SUBLEAF > +#define FAIL_CPUID(l, s) \ > + do { e.leaf = (l); e.subleaf = (s); goto out; } while ( 0 ) > +#define FAIL_MSR(m) \ > + do { e.msr = (m); goto out; } while ( 0 ) > + > + if ( guest->cpuid->basic.max_leaf > host->cpuid->basic.max_leaf ) > + FAIL_CPUID(0, NA); > + > + if ( guest->cpuid->extd.max_leaf > host->cpuid->extd.max_leaf ) > + FAIL_CPUID(0x80000008, NA); > + > + /* TODO: Audit more CPUID data. */ > + > + if ( ~host->msr->platform_info.raw & guest->msr->platform_info.raw ) > + FAIL_MSR(MSR_INTEL_PLATFORM_INFO); > + > +#undef FAIL_MSR > +#undef FAIL_CPUID > +#undef NA > + > + /* Success. */ > + ret = 0; > + > + out: > + if ( ret && err ) > + *err = e; ... here, and hence you could simply drop the "ret &&" part of the condition. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |