All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Tamas K Lengyel <tlengyel@novetta.com>, xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, jbeulich@suse.com, keir@xen.org
Subject: Re: [PATCH] x86/monitor: add get_capabilities to monitor_op domctl
Date: Tue, 7 Jul 2015 09:03:00 +0300	[thread overview]
Message-ID: <559B6B94.7070003@bitdefender.com> (raw)
In-Reply-To: <1436229832-5371-1-git-send-email-tlengyel@novetta.com>

On 07/07/2015 03:43 AM, Tamas K Lengyel wrote:
> Add option to monitor_op domctl to determine the monitor capabilities of the
> system.
> 
> Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
> ---
>  tools/libxc/include/xenctrl.h |  6 ++++++
>  tools/libxc/xc_monitor.c      | 21 +++++++++++++++++++++
>  xen/arch/x86/hvm/hvm.c        |  5 +++++
>  xen/arch/x86/monitor.c        | 25 +++++++++++++++++++++++++
>  xen/common/domctl.c           |  1 +
>  xen/include/asm-x86/hvm/hvm.h |  2 ++
>  xen/include/public/domctl.h   | 18 +++++++++++++++---
>  7 files changed, 75 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
> index d1d2ab3..d930f02 100644
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -2376,6 +2376,12 @@ int xc_mem_access_disable_emulate(xc_interface *xch, domid_t domain_id);
>  void *xc_monitor_enable(xc_interface *xch, domid_t domain_id, uint32_t *port);
>  int xc_monitor_disable(xc_interface *xch, domid_t domain_id);
>  int xc_monitor_resume(xc_interface *xch, domid_t domain_id);
> +/*
> + * Get a bitmap of supported monitor events in the form
> + * (1 << XEN_DOMCTL_MONITOR_EVENT_*).
> + */
> +int xc_monitor_get_capabilities(xc_interface *xch, domid_t domain_id,
> +                                uint32_t *capabilities);
>  int xc_monitor_write_ctrlreg(xc_interface *xch, domid_t domain_id,
>                               uint16_t index, bool enable, bool sync,
>                               bool onchangeonly);
> diff --git a/tools/libxc/xc_monitor.c b/tools/libxc/xc_monitor.c
> index 63013de..3221bdd 100644
> --- a/tools/libxc/xc_monitor.c
> +++ b/tools/libxc/xc_monitor.c
> @@ -45,6 +45,27 @@ int xc_monitor_resume(xc_interface *xch, domid_t domain_id)
>                                 NULL);
>  }
>  
> +int xc_monitor_get_capabilities(xc_interface *xch, domid_t domain_id,
> +                                uint32_t *capabilities)
> +{
> +    int rc;
> +    DECLARE_DOMCTL;
> +
> +    if ( !capabilities )
> +        return -EINVAL;
> +
> +    domctl.cmd = XEN_DOMCTL_monitor_op;
> +    domctl.domain = domain_id;
> +    domctl.u.monitor_op.op = XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES;
> +
> +    rc = do_domctl(xch, &domctl);
> +    if ( rc )
> +        return rc;
> +
> +    *capabilities = domctl.u.monitor_op.event;
> +    return 0;
> +}
> +
>  int xc_monitor_write_ctrlreg(xc_interface *xch, domid_t domain_id,
>                               uint16_t index, bool enable, bool sync,
>                               bool onchangeonly)
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 535d622..d981f98 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -6431,6 +6431,11 @@ int hvm_debug_op(struct vcpu *v, int32_t op)
>      return rc;
>  }
>  
> +bool_t hvm_is_singlestep_supported(void)
> +{
> +    return cpu_has_monitor_trap_flag;
> +}
> +
>  int nhvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
>  {
>      if (hvm_funcs.nhvm_vcpu_hostrestore)
> diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
> index 896acf7..c41efb1 100644
> --- a/xen/arch/x86/monitor.c
> +++ b/xen/arch/x86/monitor.c
> @@ -42,6 +42,22 @@ int status_check(struct xen_domctl_monitor_op *mop, bool_t status)
>      return 0;
>  }
>  
> +static inline
> +void get_capabilities(struct domain *d, struct xen_domctl_monitor_op *mop)
> +{
> +    mop->event = 0;
> +
> +    if ( !is_hvm_domain(d) || !cpu_has_vmx )
> +        return;

We've tested the guest-requested vm_event with a PV domain on ARM (ARM
patch to come after the release of 4.6), so should we keep these HVM /
VMX checks until the first patch that changes the situation?


Regards,
Razvan

  reply	other threads:[~2015-07-07  6:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07  0:43 [PATCH] x86/monitor: add get_capabilities to monitor_op domctl Tamas K Lengyel
2015-07-07  6:03 ` Razvan Cojocaru [this message]
2015-07-07  8:22 ` Jan Beulich
2015-07-07 12:01   ` Lengyel, Tamas
2015-07-07 12:10     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=559B6B94.7070003@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tlengyel@novetta.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.