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

Re: [Xen-devel] [PATCH v5 07/15] VMX: add VMFUNC leaf 0 (EPTP switching) to emulator.



>From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
>Sent: Tuesday, July 14, 2015 7:04 AM
>
>>>> On 14.07.15 at 02:14, <edmund.h.white@xxxxxxxxx> wrote:
>> --- a/xen/arch/x86/hvm/emulate.c
>> +++ b/xen/arch/x86/hvm/emulate.c
>> @@ -1436,6 +1436,19 @@ static int hvmemul_invlpg(
>>      return rc;
>>  }
>>
>> +static int hvmemul_vmfunc(
>> +    struct x86_emulate_ctxt *ctxt)
>> +{
>> +    int rc;
>> +
>> +    rc = hvm_funcs.altp2m_vcpu_emulate_vmfunc(ctxt->regs);
>> +    if ( rc != X86EMUL_OKAY )
>> +    {
>> +        hvmemul_inject_hw_exception(TRAP_invalid_op, 0, ctxt);
>> +    }
>> +    return rc;
>
>Pointless braces and missing blank line before final return.

ok

>
>> @@ -1830,6 +1831,19 @@ static void vmx_vcpu_update_vmfunc_ve(struct
>vcpu *v)
>>      vmx_vmcs_exit(v);
>>  }
>>
>> +static int vmx_vcpu_emulate_vmfunc(struct cpu_user_regs *regs) {
>> +    int rc = X86EMUL_EXCEPTION;
>> +    struct vcpu *curr = current;
>> +
>> +    if ( !cpu_has_vmx_vmfunc && altp2m_active(curr->domain) &&
>> +         regs->eax == 0 &&
>> +         p2m_switch_vcpu_altp2m_by_id(curr, (uint16_t)regs->ecx) )
>
>Documentation suggests that the upper 32 bits of RAX are being ignored, and
>that all 32 bits of ECX are being used.
>
>> @@ -3234,6 +3263,15 @@ void vmx_vmexit_handler(struct cpu_user_regs
>*regs)
>>              update_guest_eip();
>>          break;
>>
>> +    case EXIT_REASON_VMFUNC:
>> +        if ( (vmx_vmfunc_intercept(regs) == X86EMUL_EXCEPTION) ||
>> +             (vmx_vmfunc_intercept(regs) == X86EMUL_UNHANDLEABLE) ||
>> +             (vmx_vmfunc_intercept(regs) == X86EMUL_RETRY) )
>
>Why would you want to invoke the function 3 times? How about simply !=
>X86EMUL_OKAY?

My bad - I mean to invoke vmx_vmfunc_intercept() once and just check the error 
conditions listed.
Which change to !=X86EMUL_OKAY

Ravi

>
>Jan


_______________________________________________
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®.