All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 1/4] x86/monitor: add get_capabilities to monitor_op domctl
@ 2015-07-09 13:14 Tamas K Lengyel
  2015-07-09 13:14 ` [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response Tamas K Lengyel
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Tamas K Lengyel @ 2015-07-09 13:14 UTC (permalink / raw)
  To: xen-devel
  Cc: kevin.tian, wei.liu2, ian.campbell, rcojocaru,
	stefano.stabellini, ian.jackson, eddie.dong, jbeulich,
	jun.nakajima, andrew.cooper3, Tamas K Lengyel, keir

Add option to monitor_op domctl to determine the monitor capabilities of the
system.

Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
v5: fix libxc error return format
v4: add inline function wrapper for is_singlestep_supported to hvm.h
v3: move is_singlestep_supported into vmx
    sanity check capabilities for each monitor_op enable/disable
    fix comment typo
v2: skipped
---
 tools/libxc/include/xenctrl.h |  6 ++++++
 tools/libxc/xc_monitor.c      | 24 ++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c    |  6 ++++++
 xen/arch/x86/monitor.c        | 33 +++++++++++++++++++++++++++++++--
 xen/common/domctl.c           |  2 ++
 xen/include/asm-x86/hvm/hvm.h |  6 ++++++
 xen/include/public/domctl.h   | 18 +++++++++++++++---
 7 files changed, 90 insertions(+), 5 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 71539a7..4fe347b 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -2364,6 +2364,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..b64bce3 100644
--- a/tools/libxc/xc_monitor.c
+++ b/tools/libxc/xc_monitor.c
@@ -45,6 +45,30 @@ 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 )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    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/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index e0e9e75..1f7f9e5 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1763,6 +1763,11 @@ static void vmx_enable_msr_exit_interception(struct domain *d)
                                          MSR_TYPE_W);
 }
 
+static bool_t vmx_is_singlestep_supported(void)
+{
+    return cpu_has_monitor_trap_flag;
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -1820,6 +1825,7 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .nhvm_hap_walk_L1_p2m = nvmx_hap_walk_L1_p2m,
     .hypervisor_cpuid_leaf = vmx_hypervisor_cpuid_leaf,
     .enable_msr_exit_interception = vmx_enable_msr_exit_interception,
+    .is_singlestep_supported = vmx_is_singlestep_supported,
 };
 
 const struct hvm_function_table * __init start_vmx(void)
diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
index 896acf7..590a45d 100644
--- a/xen/arch/x86/monitor.c
+++ b/xen/arch/x86/monitor.c
@@ -42,10 +42,29 @@ int status_check(struct xen_domctl_monitor_op *mop, bool_t status)
     return 0;
 }
 
+static inline uint32_t get_capabilities(struct domain *d)
+{
+    uint32_t capabilities = 0;
+
+    if ( !is_hvm_domain(d) || !cpu_has_vmx )
+        return capabilities;
+
+    capabilities = (1 << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) |
+                   (1 << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) |
+                   (1 << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT);
+
+    /* Since we know this is on VMX, we can just call the hvm func */
+    if ( hvm_is_singlestep_supported() )
+        capabilities |= (1 << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP);
+
+    return capabilities;
+}
+
 int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
 {
     int rc;
     struct arch_domain *ad = &d->arch;
+    uint32_t capabilities = get_capabilities(d);
 
     rc = xsm_vm_event_control(XSM_PRIV, d, mop->op, mop->event);
     if ( rc )
@@ -55,8 +74,12 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
      * At the moment only Intel HVM domains are supported. However, event
      * delivery could be extended to AMD and PV domains.
      */
-    if ( !is_hvm_domain(d) || !cpu_has_vmx )
-        return -EOPNOTSUPP;
+
+    if ( mop->op == XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES )
+    {
+        mop->event = capabilities;
+        return 0;
+    }
 
     /*
      * Sanity check
@@ -65,6 +88,12 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
          mop->op != XEN_DOMCTL_MONITOR_OP_DISABLE )
         return -EOPNOTSUPP;
 
+    /*
+     * Check if event type is available.
+     */
+    if ( !( capabilities & (1 << mop->event) ) )
+        return -EOPNOTSUPP;
+
     switch ( mop->event )
     {
     case XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG:
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index a06f15c..7f959f3 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -1167,6 +1167,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             break;
 
         ret = monitor_domctl(d, &op->u.monitor_op);
+        if ( !ret )
+            copyback = 1;
         break;
 
     default:
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 1d1fd35..c9a7184 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -202,6 +202,7 @@ struct hvm_function_table {
                                   uint32_t *ecx, uint32_t *edx);
 
     void (*enable_msr_exit_interception)(struct domain *d);
+    bool_t (*is_singlestep_supported)(void);
 };
 
 extern struct hvm_function_table hvm_funcs;
@@ -510,6 +511,11 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
     return hvm_funcs.nhvm_intr_blocked(v);
 }
 
+static inline bool_t hvm_is_singlestep_supported(void)
+{
+    return (hvm_funcs.is_singlestep_supported &&
+            hvm_funcs.is_singlestep_supported());
+}
 
 #ifndef NDEBUG
 /* Permit use of the Forced Emulation Prefix in HVM guests */
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 2128171..8b1d6b4 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -994,12 +994,16 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_psr_cmt_op_t);
  * via the ring buffer "MONITOR". The ring has to be first enabled
  * with the domctl XEN_DOMCTL_VM_EVENT_OP_MONITOR.
  *
+ * GET_CAPABILITIES can be used to determine which of these features is
+ * available on a given platform.
+ *
  * NOTICE: mem_access events are also delivered via the "MONITOR" ring buffer;
  * however, enabling/disabling those events is performed with the use of
  * memory_op hypercalls!
  */
-#define XEN_DOMCTL_MONITOR_OP_ENABLE   0
-#define XEN_DOMCTL_MONITOR_OP_DISABLE  1
+#define XEN_DOMCTL_MONITOR_OP_ENABLE            0
+#define XEN_DOMCTL_MONITOR_OP_DISABLE           1
+#define XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES  2
 
 #define XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG         0
 #define XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR            1
@@ -1008,7 +1012,15 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_psr_cmt_op_t);
 
 struct xen_domctl_monitor_op {
     uint32_t op; /* XEN_DOMCTL_MONITOR_OP_* */
-    uint32_t event; /* XEN_DOMCTL_MONITOR_EVENT_* */
+
+    /*
+     * When used with ENABLE/DISABLE this has to be set to
+     * the requested XEN_DOMCTL_MONITOR_EVENT_* value.
+     * With GET_CAPABILITIES this field returns a bitmap of
+     * events supported by the platform, in the format
+     * (1 << XEN_DOMCTL_MONITOR_EVENT_*).
+     */
+    uint32_t event;
 
     /*
      * Further options when issuing XEN_DOMCTL_MONITOR_OP_ENABLE.
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response
  2015-07-09 13:14 [PATCH v5 1/4] x86/monitor: add get_capabilities to monitor_op domctl Tamas K Lengyel
@ 2015-07-09 13:14 ` Tamas K Lengyel
  2015-07-10 10:30   ` Jan Beulich
  2015-07-10 11:36   ` Ian Campbell
  2015-07-09 13:14 ` [PATCH v5 3/4] x86/monitor: don't use hvm_funcs directly Tamas K Lengyel
  2015-07-09 13:14 ` [PATCH v5 4/4] MAINTAINERS: support for xen-access Tamas K Lengyel
  2 siblings, 2 replies; 10+ messages in thread
From: Tamas K Lengyel @ 2015-07-09 13:14 UTC (permalink / raw)
  To: xen-devel
  Cc: kevin.tian, wei.liu2, ian.campbell, rcojocaru,
	stefano.stabellini, ian.jackson, eddie.dong, jbeulich,
	jun.nakajima, andrew.cooper3, Tamas K Lengyel, keir

Add an option to the vm_event response to toggle singlestepping on the vCPU.
This is only supported on Intel CPUs which have Monitor Trap Flag capability.

Singed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
v4: Use new inline wrapper for hvm_func
    Fix comment still referring to mem_event in vm_event.h
v3: Remove comment describing the limitation of the flag in the public header
    Use the new is_singlestep_supported hvm_func to check availability
v2: Include sched.h in headers and sanity check that vcpu is paused.
---
 MAINTAINERS                    |  1 +
 xen/arch/x86/Makefile          |  1 +
 xen/arch/x86/hvm/hvm.c         | 10 ++++++++++
 xen/arch/x86/vm_event.c        | 41 +++++++++++++++++++++++++++++++++++++++++
 xen/common/vm_event.c          |  7 ++++++-
 xen/include/asm-arm/vm_event.h | 31 +++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h  |  3 +++
 xen/include/asm-x86/vm_event.h | 27 +++++++++++++++++++++++++++
 xen/include/public/vm_event.h  | 15 ++++++++++-----
 9 files changed, 130 insertions(+), 6 deletions(-)
 create mode 100644 xen/arch/x86/vm_event.c
 create mode 100644 xen/include/asm-arm/vm_event.h
 create mode 100644 xen/include/asm-x86/vm_event.h

diff --git a/MAINTAINERS b/MAINTAINERS
index e6616d2..1e74688 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -388,6 +388,7 @@ F:	xen/common/vm_event.c
 F:	xen/common/mem_access.c
 F:	xen/arch/x86/hvm/event.c
 F:	xen/arch/x86/monitor.c
+F:	xen/arch/x86/vm_event.c
 
 XENTRACE
 M:	George Dunlap <george.dunlap@eu.citrix.com>
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 37e547c..5f24951 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -60,6 +60,7 @@ obj-y += machine_kexec.o
 obj-y += crash.o
 obj-y += tboot.o
 obj-y += hpet.o
+obj-y += vm_event.o
 obj-y += xstate.o
 
 obj-$(crash_debug) += gdbstub.o
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0a616a7..e41a304 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -6431,6 +6431,16 @@ int hvm_debug_op(struct vcpu *v, int32_t op)
     return rc;
 }
 
+void hvm_toggle_singlestep(struct vcpu *v)
+{
+    ASSERT(atomic_read(&v->pause_count));
+
+    if ( !hvm_is_singlestep_supported() )
+        return;
+
+    v->arch.hvm_vcpu.single_step = !v->arch.hvm_vcpu.single_step;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
new file mode 100644
index 0000000..c390225
--- /dev/null
+++ b/xen/arch/x86/vm_event.c
@@ -0,0 +1,41 @@
+/*
+ * arch/x86/vm_event.c
+ *
+ * Architecture-specific vm_event handling routines
+ *
+ * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#include <xen/sched.h>
+#include <asm/hvm/hvm.h>
+
+void vm_event_toggle_singlestep(struct domain *d, struct vcpu *v)
+{
+    if ( !is_hvm_domain(d) || !atomic_read(&v->vm_event_pause_count) )
+        return;
+
+    hvm_toggle_singlestep(v);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 120a78a..a4b9c36 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -27,6 +27,7 @@
 #include <xen/vm_event.h>
 #include <xen/mem_access.h>
 #include <asm/p2m.h>
+#include <asm/vm_event.h>
 #include <xsm/xsm.h>
 
 /* for public/io/ring.h macros */
@@ -399,9 +400,13 @@ void vm_event_resume(struct domain *d, struct vm_event_domain *ved)
 
         };
 
-        /* Unpause domain. */
         if ( rsp.flags & VM_EVENT_FLAG_VCPU_PAUSED )
+        {
+            if ( rsp.flags & VM_EVENT_FLAG_TOGGLE_SINGLESTEP )
+                vm_event_toggle_singlestep(d, v);
+
             vm_event_vcpu_unpause(v);
+        }
     }
 }
 
diff --git a/xen/include/asm-arm/vm_event.h b/xen/include/asm-arm/vm_event.h
new file mode 100644
index 0000000..a517495
--- /dev/null
+++ b/xen/include/asm-arm/vm_event.h
@@ -0,0 +1,31 @@
+/*
+ * vm_event.h: architecture specific vm_event handling routines
+ *
+ * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef __ASM_ARM_VM_EVENT_H__
+#define __ASM_ARM_VM_EVENT_H__
+
+#include <xen/sched.h>
+
+static inline
+void vm_event_toggle_singlestep(struct domain *d, struct vcpu *v)
+{
+    /* Not supported on ARM. */
+}
+
+#endif /* __ASM_ARM_VM_EVENT_H__ */
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index c9a7184..aa8ab8d 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -444,6 +444,9 @@ static inline void hvm_set_info_guest(struct vcpu *v)
 
 int hvm_debug_op(struct vcpu *v, int32_t op);
 
+/* Caller should pause vcpu before calling this function */
+void hvm_toggle_singlestep(struct vcpu *v);
+
 static inline void hvm_invalidate_regs_fields(struct cpu_user_regs *regs)
 {
 #ifndef NDEBUG
diff --git a/xen/include/asm-x86/vm_event.h b/xen/include/asm-x86/vm_event.h
new file mode 100644
index 0000000..7cc3a3d
--- /dev/null
+++ b/xen/include/asm-x86/vm_event.h
@@ -0,0 +1,27 @@
+/*
+ * vm_event.h: architecture specific vm_event handling routines
+ *
+ * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef __ASM_X86_VM_EVENT_H__
+#define __ASM_X86_VM_EVENT_H__
+
+#include <xen/sched.h>
+
+void vm_event_toggle_singlestep(struct domain *d, struct vcpu *v);
+
+#endif /* __ASM_X86_VM_EVENT_H__ */
diff --git a/xen/include/public/vm_event.h b/xen/include/public/vm_event.h
index aa22052..c756c7c 100644
--- a/xen/include/public/vm_event.h
+++ b/xen/include/public/vm_event.h
@@ -44,9 +44,9 @@
  *  paused
  * VCPU_PAUSED in a response signals to unpause the vCPU
  */
-#define VM_EVENT_FLAG_VCPU_PAUSED     (1 << 0)
-/* Flags to aid debugging mem_event */
-#define VM_EVENT_FLAG_FOREIGN         (1 << 1)
+#define VM_EVENT_FLAG_VCPU_PAUSED       (1 << 0)
+/* Flags to aid debugging vm_event */
+#define VM_EVENT_FLAG_FOREIGN           (1 << 1)
 /*
  * The following flags can be set in response to a mem_access event.
  *
@@ -54,12 +54,17 @@
  * This will allow the guest to continue execution without lifting the page
  * access restrictions.
  */
-#define VM_EVENT_FLAG_EMULATE         (1 << 2)
+#define VM_EVENT_FLAG_EMULATE           (1 << 2)
 /*
  * Same as MEM_ACCESS_EMULATE, but with write operations or operations
  * potentially having side effects (like memory mapped or port I/O) disabled.
  */
-#define VM_EVENT_FLAG_EMULATE_NOWRITE (1 << 3)
+#define VM_EVENT_FLAG_EMULATE_NOWRITE   (1 << 3)
+/*
+ * Toggle singlestepping on vm_event response.
+ * Requires the vCPU to be paused already (synchronous events only).
+ */
+#define VM_EVENT_FLAG_TOGGLE_SINGLESTEP (1 << 4)
 
 /*
  * Reasons for the vm event request
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v5 3/4] x86/monitor: don't use hvm_funcs directly
  2015-07-09 13:14 [PATCH v5 1/4] x86/monitor: add get_capabilities to monitor_op domctl Tamas K Lengyel
  2015-07-09 13:14 ` [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response Tamas K Lengyel
@ 2015-07-09 13:14 ` Tamas K Lengyel
  2015-07-09 13:20   ` Razvan Cojocaru
  2015-07-09 13:14 ` [PATCH v5 4/4] MAINTAINERS: support for xen-access Tamas K Lengyel
  2 siblings, 1 reply; 10+ messages in thread
From: Tamas K Lengyel @ 2015-07-09 13:14 UTC (permalink / raw)
  To: xen-devel
  Cc: kevin.tian, wei.liu2, ian.campbell, rcojocaru,
	stefano.stabellini, ian.jackson, eddie.dong, jbeulich,
	jun.nakajima, andrew.cooper3, Tamas K Lengyel, keir

A couple spots in x86/monitor used hvm_funcs directly. This patch adds an extra
wrapper for enable_msr_exit_interception and changes monitor.c to use only the
wrappers.

Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
---
 xen/arch/x86/monitor.c        |  7 ++-----
 xen/include/asm-x86/hvm/hvm.h | 11 +++++++++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
index 590a45d..5af533c 100644
--- a/xen/arch/x86/monitor.c
+++ b/xen/arch/x86/monitor.c
@@ -130,7 +130,7 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
         if ( mop->u.mov_to_cr.index == VM_EVENT_X86_CR3 )
             /* Latches new CR3 mask through CR0 code */
             for_each_vcpu ( d, v )
-                hvm_funcs.update_guest_cr(v, 0);
+                hvm_update_guest_cr(v, 0);
 
         break;
     }
@@ -146,11 +146,8 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
         if ( mop->op == XEN_DOMCTL_MONITOR_OP_ENABLE &&
              mop->u.mov_to_msr.extended_capture )
         {
-            if ( hvm_funcs.enable_msr_exit_interception )
-            {
+            if ( hvm_enable_msr_exit_interception(d) )
                 ad->monitor.mov_to_msr_extended = 1;
-                hvm_funcs.enable_msr_exit_interception(d);
-            }
             else
                 return -EOPNOTSUPP;
         } else
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index aa8ab8d..c79386b 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -514,6 +514,17 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
     return hvm_funcs.nhvm_intr_blocked(v);
 }
 
+static inline bool_t hvm_enable_msr_exit_interception(struct domain *d)
+{
+    if ( hvm_funcs.enable_msr_exit_interception )
+    {
+        hvm_funcs.enable_msr_exit_interception(d);
+        return 1;
+    }
+
+    return 0;
+}
+
 static inline bool_t hvm_is_singlestep_supported(void)
 {
     return (hvm_funcs.is_singlestep_supported &&
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v5 4/4] MAINTAINERS: support for xen-access
  2015-07-09 13:14 [PATCH v5 1/4] x86/monitor: add get_capabilities to monitor_op domctl Tamas K Lengyel
  2015-07-09 13:14 ` [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response Tamas K Lengyel
  2015-07-09 13:14 ` [PATCH v5 3/4] x86/monitor: don't use hvm_funcs directly Tamas K Lengyel
@ 2015-07-09 13:14 ` Tamas K Lengyel
  2015-07-09 13:17   ` Razvan Cojocaru
  2 siblings, 1 reply; 10+ messages in thread
From: Tamas K Lengyel @ 2015-07-09 13:14 UTC (permalink / raw)
  To: xen-devel
  Cc: kevin.tian, wei.liu2, ian.campbell, rcojocaru,
	stefano.stabellini, ian.jackson, eddie.dong, jbeulich,
	jun.nakajima, andrew.cooper3, Tamas K Lengyel, keir

Add tools/tests/xen-acess to the supported list under VM EVENT/MEM ACCESS.

Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1e74688..dae0aa3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -389,6 +389,7 @@ F:	xen/common/mem_access.c
 F:	xen/arch/x86/hvm/event.c
 F:	xen/arch/x86/monitor.c
 F:	xen/arch/x86/vm_event.c
+F:  tools/tests/xen-access
 
 XENTRACE
 M:	George Dunlap <george.dunlap@eu.citrix.com>
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v5 4/4] MAINTAINERS: support for xen-access
  2015-07-09 13:14 ` [PATCH v5 4/4] MAINTAINERS: support for xen-access Tamas K Lengyel
@ 2015-07-09 13:17   ` Razvan Cojocaru
  2015-07-09 13:50     ` Lengyel, Tamas
  0 siblings, 1 reply; 10+ messages in thread
From: Razvan Cojocaru @ 2015-07-09 13:17 UTC (permalink / raw)
  To: Tamas K Lengyel, xen-devel
  Cc: kevin.tian, wei.liu2, ian.campbell, stefano.stabellini,
	ian.jackson, eddie.dong, jbeulich, jun.nakajima, andrew.cooper3,
	keir

On 07/09/2015 04:14 PM, Tamas K Lengyel wrote:
> Add tools/tests/xen-acess to the supported list under VM EVENT/MEM ACCESS.
> 
> Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1e74688..dae0aa3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -389,6 +389,7 @@ F:	xen/common/mem_access.c
>  F:	xen/arch/x86/hvm/event.c
>  F:	xen/arch/x86/monitor.c
>  F:	xen/arch/x86/vm_event.c
> +F:  tools/tests/xen-access

This seems to use the wrong indentation type, it doesn't align with the
rest.

With that fixed,
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>


Cheers,
Razvan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v5 3/4] x86/monitor: don't use hvm_funcs directly
  2015-07-09 13:14 ` [PATCH v5 3/4] x86/monitor: don't use hvm_funcs directly Tamas K Lengyel
@ 2015-07-09 13:20   ` Razvan Cojocaru
  0 siblings, 0 replies; 10+ messages in thread
From: Razvan Cojocaru @ 2015-07-09 13:20 UTC (permalink / raw)
  To: Tamas K Lengyel, xen-devel
  Cc: kevin.tian, wei.liu2, ian.campbell, stefano.stabellini,
	ian.jackson, eddie.dong, jbeulich, jun.nakajima, andrew.cooper3,
	keir

On 07/09/2015 04:14 PM, Tamas K Lengyel wrote:
> A couple spots in x86/monitor used hvm_funcs directly. This patch adds an extra
> wrapper for enable_msr_exit_interception and changes monitor.c to use only the
> wrappers.
> 
> Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
> ---
>  xen/arch/x86/monitor.c        |  7 ++-----
>  xen/include/asm-x86/hvm/hvm.h | 11 +++++++++++
>  2 files changed, 13 insertions(+), 5 deletions(-)

Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>


Cheers,
Razvan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v5 4/4] MAINTAINERS: support for xen-access
  2015-07-09 13:17   ` Razvan Cojocaru
@ 2015-07-09 13:50     ` Lengyel, Tamas
  0 siblings, 0 replies; 10+ messages in thread
From: Lengyel, Tamas @ 2015-07-09 13:50 UTC (permalink / raw)
  To: Razvan Cojocaru
  Cc: kevin.tian, Wei Liu, Ian Campbell, Stefano Stabellini,
	eddie.dong, Ian Jackson, Xen-devel, Jan Beulich, Jun Nakajima,
	Andrew Cooper, keir


[-- Attachment #1.1: Type: text/plain, Size: 946 bytes --]

On Thu, Jul 9, 2015 at 9:17 AM, Razvan Cojocaru <rcojocaru@bitdefender.com>
wrote:

> On 07/09/2015 04:14 PM, Tamas K Lengyel wrote:
> > Add tools/tests/xen-acess to the supported list under VM EVENT/MEM
> ACCESS.
> >
> > Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
> > ---
> >  MAINTAINERS | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 1e74688..dae0aa3 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -389,6 +389,7 @@ F:        xen/common/mem_access.c
> >  F:   xen/arch/x86/hvm/event.c
> >  F:   xen/arch/x86/monitor.c
> >  F:   xen/arch/x86/vm_event.c
> > +F:  tools/tests/xen-access
>
> This seems to use the wrong indentation type, it doesn't align with the
> rest.
>
> With that fixed,
> Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>
>
> Cheers,
> Razvan
>

Ah what, it's the only spot where it's not using whitespace for
indentation? =) Nice catch.

Tamas

[-- Attachment #1.2: Type: text/html, Size: 1586 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response
  2015-07-09 13:14 ` [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response Tamas K Lengyel
@ 2015-07-10 10:30   ` Jan Beulich
  2015-07-10 11:36   ` Ian Campbell
  1 sibling, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2015-07-10 10:30 UTC (permalink / raw)
  To: Tamas K Lengyel
  Cc: kevin.tian, wei.liu2, ian.campbell, rcojocaru,
	stefano.stabellini, andrew.cooper3, ian.jackson, xen-devel,
	eddie.dong, jun.nakajima, keir

>>> On 09.07.15 at 15:14, <tlengyel@novetta.com> wrote:
> Add an option to the vm_event response to toggle singlestepping on the vCPU.
> This is only supported on Intel CPUs which have Monitor Trap Flag 
> capability.
> 
> Singed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
> Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

> ---
>  MAINTAINERS                    |  1 +
>  xen/arch/x86/Makefile          |  1 +
>  xen/arch/x86/hvm/hvm.c         | 10 ++++++++++
>  xen/arch/x86/vm_event.c        | 41 +++++++++++++++++++++++++++++++++++++++++
>  xen/common/vm_event.c          |  7 ++++++-
>  xen/include/asm-arm/vm_event.h | 31 +++++++++++++++++++++++++++++++

Even if trivial, this requires an ARM maintainer's ack imo.

Jan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response
  2015-07-09 13:14 ` [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response Tamas K Lengyel
  2015-07-10 10:30   ` Jan Beulich
@ 2015-07-10 11:36   ` Ian Campbell
  2015-07-10 14:33     ` Lengyel, Tamas
  1 sibling, 1 reply; 10+ messages in thread
From: Ian Campbell @ 2015-07-10 11:36 UTC (permalink / raw)
  To: Tamas K Lengyel
  Cc: kevin.tian, wei.liu2, jun.nakajima, rcojocaru,
	stefano.stabellini, eddie.dong, ian.jackson, xen-devel, jbeulich,
	andrew.cooper3, keir

On Thu, 2015-07-09 at 09:14 -0400, Tamas K Lengyel wrote:
>  xen/include/asm-arm/vm_event.h | 31 +++++++++++++++++++++++++++++++

Acked-by: Ian Campbell <Ian.campbell@citrix.com>

> diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
> new file mode 100644
> index 0000000..c390225
> --- /dev/null
> +++ b/xen/arch/x86/vm_event.c
> @@ -0,0 +1,41 @@
> +/*
> + * arch/x86/vm_event.c
> + *
> + * Architecture-specific vm_event handling routines
> + *
> + * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public
> + * License v2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public
> + * License along with this program; if not, write to the
> + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> + * Boston, MA 021110-1307, USA.

FYI I think current best practice is to omit the paragraph with the
address.

The more so because this is not AIUI their current address...

This shouldn't block acceptance of the patch though IMHO

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response
  2015-07-10 11:36   ` Ian Campbell
@ 2015-07-10 14:33     ` Lengyel, Tamas
  0 siblings, 0 replies; 10+ messages in thread
From: Lengyel, Tamas @ 2015-07-10 14:33 UTC (permalink / raw)
  To: Ian Campbell
  Cc: kevin.tian, Wei Liu, Jun Nakajima, Razvan Cojocaru,
	Stefano Stabellini, eddie.dong, Ian Jackson, Xen-devel,
	Jan Beulich, Andrew Cooper, keir


[-- Attachment #1.1: Type: text/plain, Size: 1658 bytes --]

On Fri, Jul 10, 2015 at 7:36 AM, Ian Campbell <ian.campbell@citrix.com>
wrote:

> On Thu, 2015-07-09 at 09:14 -0400, Tamas K Lengyel wrote:
> >  xen/include/asm-arm/vm_event.h | 31 +++++++++++++++++++++++++++++++
>
> Acked-by: Ian Campbell <Ian.campbell@citrix.com>
>
> > diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
> > new file mode 100644
> > index 0000000..c390225
> > --- /dev/null
> > +++ b/xen/arch/x86/vm_event.c
> > @@ -0,0 +1,41 @@
> > +/*
> > + * arch/x86/vm_event.c
> > + *
> > + * Architecture-specific vm_event handling routines
> > + *
> > + * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public
> > + * License v2 as published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public
> > + * License along with this program; if not, write to the
> > + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> > + * Boston, MA 021110-1307, USA.
>
> FYI I think current best practice is to omit the paragraph with the
> address.
>
> The more so because this is not AIUI their current address...
>
> This shouldn't block acceptance of the patch though IMHO
>

Good to know. I just copy pasted it from another file (hvm.c if I recall
correctly).

Tamas

[-- Attachment #1.2: Type: text/html, Size: 2333 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-07-10 14:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 13:14 [PATCH v5 1/4] x86/monitor: add get_capabilities to monitor_op domctl Tamas K Lengyel
2015-07-09 13:14 ` [PATCH v5 2/4] x86/vm_event: toggle singlestep from vm_event response Tamas K Lengyel
2015-07-10 10:30   ` Jan Beulich
2015-07-10 11:36   ` Ian Campbell
2015-07-10 14:33     ` Lengyel, Tamas
2015-07-09 13:14 ` [PATCH v5 3/4] x86/monitor: don't use hvm_funcs directly Tamas K Lengyel
2015-07-09 13:20   ` Razvan Cojocaru
2015-07-09 13:14 ` [PATCH v5 4/4] MAINTAINERS: support for xen-access Tamas K Lengyel
2015-07-09 13:17   ` Razvan Cojocaru
2015-07-09 13:50     ` Lengyel, Tamas

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.