[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 23/27] x86/cpuid: Move all leaf 7 handling into guest_cpuid()
>>> On 04.01.17 at 13:39, <andrew.cooper3@xxxxxxxxxx> wrote: > @@ -380,14 +385,42 @@ void guest_cpuid(const struct vcpu *v, unsigned int > leaf, > case 0x80000000 ... 0x80000000 + CPUID_GUEST_NR_EXTD - 1: > if ( leaf > p->extd.max_leaf ) > return; > - break; > + goto legacy; > > default: > return; > } > > + /* Skip dynamic adjustments if we are in the wrong context. */ > + if ( v != curr ) > + return; > + > + /* > + * Second pass: > + * - Dynamic adjustments > + */ > + switch ( leaf ) > + { > + case 0x7: > + switch ( subleaf ) > + { > + case 0: > + /* OSPKE clear in policy. Fast-forward CR4 back in. */ > + if ( (is_pv_vcpu(v) > + ? v->arch.pv_vcpu.ctrlreg[4] > + : v->arch.hvm_vcpu.guest_cr[4]) & X86_CR4_PKE ) > + res->c |= cpufeat_mask(X86_FEATURE_OSPKE); What's wrong with doing this adjustment when v != curr? By the time the caller looks at the result, the state of guest software controlled bits can't be relied upon anyway. Which then raises the question whether a second switch() statement for the a second pass is all that useful in the first place (I realize this may depend on future plans of yours). Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |