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

Re: [PATCH V8] x86/altp2m: Hypercall to set altp2m view visibility



On Mon, Apr 13, 2020 at 09:51:13AM +0300, Alexandru Isaila wrote:
[...]
> ---
>  tools/libxc/include/xenctrl.h   |  7 +++++++
>  tools/libxc/xc_altp2m.c         | 24 +++++++++++++++++++++++

Acked-by: Wei Liu <wl@xxxxxxx>

>  xen/arch/x86/hvm/hvm.c          | 14 ++++++++++++++
>  xen/arch/x86/hvm/vmx/vmx.c      |  2 +-
>  xen/arch/x86/mm/hap/hap.c       | 15 +++++++++++++++
>  xen/arch/x86/mm/p2m-ept.c       |  1 +
>  xen/arch/x86/mm/p2m.c           | 34 +++++++++++++++++++++++++++++++--
>  xen/include/asm-x86/domain.h    |  1 +
>  xen/include/asm-x86/p2m.h       |  4 ++++
>  xen/include/public/hvm/hvm_op.h |  9 +++++++++
>  10 files changed, 108 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
> index 58fa931de1..5f25c5a6d4 100644
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -1943,6 +1943,13 @@ int xc_altp2m_change_gfn(xc_interface *handle, 
> uint32_t domid,
>                           xen_pfn_t new_gfn);
>  int xc_altp2m_get_vcpu_p2m_idx(xc_interface *handle, uint32_t domid,
>                                 uint32_t vcpuid, uint16_t *p2midx);
> +/*
> + * Set view visibility for xc_altp2m_switch_to_view and vmfunc.
> + * Note: If altp2m mode is set to mixed the guest is able to change the view
> + * visibility and then call vmfunc.
> + */
> +int xc_altp2m_set_visibility(xc_interface *handle, uint32_t domid,
> +                             uint16_t view_id, bool visible);
>  
>  /** 
>   * Mem paging operations.
> diff --git a/tools/libxc/xc_altp2m.c b/tools/libxc/xc_altp2m.c
> index 46fb725806..6987c9541f 100644
> --- a/tools/libxc/xc_altp2m.c
> +++ b/tools/libxc/xc_altp2m.c
> @@ -410,3 +410,27 @@ int xc_altp2m_get_vcpu_p2m_idx(xc_interface *handle, 
> uint32_t domid,
>      xc_hypercall_buffer_free(handle, arg);
>      return rc;
>  }
> +
> +int xc_altp2m_set_visibility(xc_interface *handle, uint32_t domid,
> +                             uint16_t view_id, bool visible)
> +{
> +    int rc;
> +
> +    DECLARE_HYPERCALL_BUFFER(xen_hvm_altp2m_op_t, arg);
> +
> +    arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
> +    if ( arg == NULL )
> +        return -1;
> +
> +    arg->version = HVMOP_ALTP2M_INTERFACE_VERSION;
> +    arg->cmd = HVMOP_altp2m_set_visibility;
> +    arg->domain = domid;
> +    arg->u.set_visibility.altp2m_idx = view_id;
> +    arg->u.set_visibility.visible = visible;
> +
> +    rc = xencall2(handle->xcall, __HYPERVISOR_hvm_op, HVMOP_altp2m,
> +                  HYPERCALL_BUFFER_AS_ARG(arg));
> +
> +    xc_hypercall_buffer_free(handle, arg);
> +    return rc;
> +}
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c



 


Rackspace

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