[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] x86: MSR_IA32_BNDCFGS save/restore



Andrew Cooper wrote:
> On 13/12/2013 14:02, Jan Beulich wrote:
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> 
>> --- a/xen/arch/x86/hvm/vmx/vmx.c
>> +++ b/xen/arch/x86/hvm/vmx/vmx.c
>> @@ -580,6 +580,55 @@ static int vmx_load_vmcs_ctxt(struct vcp     
>>  return 0; }
>> 
>> +static unsigned int __init vmx_init_msr(void)
>> +{
>> +    return !!cpu_has_mpx;
>> +}
>> +
>> +static void vmx_save_msr(struct vcpu *v, struct hvm_msr *ctxt) +{
>> +    vmx_vmcs_enter(v);
>> +
>> +    if ( cpu_has_mpx )
>> +    {
>> +        __vmread(GUEST_BNDCFGS, &ctxt->msr[ctxt->count].val);
>> +        if ( ctxt->msr[ctxt->count].val )
>> +            ctxt->msr[ctxt->count++].index = MSR_IA32_BNDCFGS; +   
>> } +
>> +    vmx_vmcs_exit(v);
>> +}
>> +
>> +static int vmx_load_msr(struct vcpu *v, struct hvm_msr *ctxt) +{
>> +    unsigned int i;
>> +    int err = 0;
>> +
>> +    vmx_vmcs_enter(v);
>> +
>> +    for ( i = 0; i < ctxt->count; ++i )
>> +    {
>> +        switch ( ctxt->msr[i].index )
>> +        {
>> +        case MSR_IA32_BNDCFGS:
>> +            if ( cpu_has_mpx )
>> +                __vmwrite(GUEST_BNDCFGS, ctxt->msr[i].val); +      
>> else +                err = -ENXIO;
>> +            break;
>> +        default:
>> +            continue;
> 
> This will skip setting _rsvd for an MSR we don't recognise.  Doesn't
> this interfere with the error checking in the caller?
> 

It's OK. It's is for not-recognised-MSR got checked at the caller.
If a MSR was not recognised by vmx/svm specific handler or generic msr handler, 
return error.

Thanks,
Jinsong


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.