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

Re: [Xen-devel] [PATCH 3/6] AMD-PVH: call hvm_emulate_one instead of handle_mmio



>>> On 22.06.15 at 18:37, <elena.ufimtseva@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -2289,6 +2289,23 @@ static struct hvm_function_table __initdata 
> svm_function_table = {
>      .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
>  };
>  
> +static void svm_emulate(struct cpu_user_regs *regs)
> +{
> +    int rc;
> +    struct hvm_emulate_ctxt ctxt;
> +
> +    hvm_emulate_prepare(&ctxt, regs);
> +    rc = hvm_emulate_one(&ctxt);
> +
> +    if ( rc != X86EMUL_OKAY )
> +    {
> +     if ( ctxt.exn_pending )
> +             hvm_inject_trap(&ctxt.trap);
> +     else
> +             hvm_inject_hw_exception(TRAP_gp_fault, 0);

Indentation. Also I think this might better be

    if ( ctxt.exn_pending )
    ...
    else if ( rc != X86EMUL_OKAY )
    ...

> @@ -2555,16 +2572,16 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
>              if ( handle_pio(port, bytes, dir) )
>                  __update_guest_eip(regs, vmcb->exitinfo2 - vmcb->rip);
>          }
> -        else if ( !handle_mmio() )
> -            hvm_inject_hw_exception(TRAP_gp_fault, 0);
> +        else
> +            svm_emulate(regs);

As said in the original thread, this can't be done this way (not the
least because it then also affects HVM, where handle_mmio()
should be used when you can't tell up front that no memory is
being accessed.

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