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

Re: [Xen-devel] [PATCH 11/11] nVMX: Expose VPID capability to nested VMM.



At 01:57 +0800 on 11 Dec (1355191043), xiantao.zhang@xxxxxxxxx wrote:
> From: Zhang Xiantao <xiantao.zhang@xxxxxxxxx>
> 
> Virtualize VPID for the nested vmm, use host's VPID
> to emualte guest's VPID. For each virtual vmentry, if
> guest'v vpid is changed, allocate a new host VPID for
> L2 guest.

Looks fine to me, but there's some whitespace mangling: 

> @@ -2747,8 +2750,11 @@ void vmx_vmenter_helper(void)
>  
>      if ( !cpu_has_vmx_vpid )
>          goto out;
> +    if ( nestedhvm_vcpu_in_guestmode(curr) )
> +        p_asid =  &vcpu_nestedhvm(curr).nv_n2asid;

here (after '='),

> @@ -897,6 +908,18 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
>      if ( nestedhvm_paging_mode_hap(v) )
>          __vmwrite(EPT_POINTER, get_shadow_eptp(v));
>  
> +    /* nested VPID support! */
> +    if ( cpu_has_vmx_vpid && nvmx_vpid_enabled(nvcpu) )
> +    {
> +        struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
> +        uint32_t new_vpid =  __get_vvmcs(vvmcs, VIRTUAL_PROCESSOR_ID);

here (after '='),

> @@ -1363,6 +1386,9 @@ int nvmx_handle_invept(struct cpu_user_regs *regs)
>      unsigned long eptp;
>      u64 inv_type;
>  
> +    if(!cpu_has_vmx_ept)

here,

> @@ -1401,6 +1427,37 @@ int nvmx_handle_invept(struct cpu_user_regs *regs)
>      (((__emul_value(enable1, default1) & host_value) & (~0ul << 32)) | \
>      ((uint32_t)(__emul_value(enable1, default1) | host_value)))
>  
> +int nvmx_handle_invvpid(struct cpu_user_regs *regs)
> +{
> +    struct vmx_inst_decoded decode;
> +    unsigned long vpid;
> +    u64 inv_type;
> +
> +    if(!cpu_has_vmx_vpid)

here,

> +        return X86EMUL_EXCEPTION;
> +
> +    if ( decode_vmx_inst(regs, &decode, &vpid, 0)
> +             != X86EMUL_OKAY )
> +        return X86EMUL_EXCEPTION;
> +
> +    inv_type = reg_read(regs, decode.reg2);
> +    gdprintk(XENLOG_DEBUG,"inv_type:%ld, vpid:%lx\n", inv_type, vpid);
> +
> +    switch ( inv_type ){
> +        /* Just invalidate all tlb entries for all types! */
> +        case INVVPID_INDIVIDUAL_ADDR:
> +         case INVVPID_SINGLE_CONTEXT:
> +         case INVVPID_ALL_CONTEXT:
> +            hvm_asid_flush_vcpu_asid(&vcpu_nestedhvm(current).nv_n2asid);
> +            break;
> +         default:
> +                 return X86EMUL_EXCEPTION;
> +     }

here (lots of tabs),

> @@ -126,8 +126,9 @@ static bool_t nept_present_check(uint64_t entry)
>  
>  uint64_t nept_get_ept_vpid_cap(void)
>  {
> -    /*TODO: exposed ept and vpid features*/
> -    return NEPT_VPID_CAP_BITS;
> +    if (cpu_has_vmx_ept && cpu_has_vmx_vpid)

and here.

With those fixed, 

Acked-by: Tim Deegan <tim@xxxxxxx>

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