All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tamas K Lengyel <tamas.lengyel@zentific.com>
To: xen-devel@lists.xenproject.org
Cc: Tamas K Lengyel <tamas.lengyel@zentific.com>,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v8 1/6] monitor: rename and relocate vm_event_monitor_traps
Date: Tue,  5 Jul 2016 12:37:46 -0600	[thread overview]
Message-ID: <1467743871-9644-1-git-send-email-tamas.lengyel@zentific.com> (raw)

The function vm_event_monitor_traps actually belongs in the monitor subsystem.
As part of this patch we fix the sync input's type to bool_t to match how
the callers use it.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
 xen/arch/x86/hvm/monitor.c |  7 ++++---
 xen/common/monitor.c       | 44 +++++++++++++++++++++++++++++++++++++++++++-
 xen/common/vm_event.c      | 45 ---------------------------------------------
 xen/include/xen/monitor.h  |  6 +++++-
 xen/include/xen/vm_event.h |  6 ------
 5 files changed, 52 insertions(+), 56 deletions(-)

diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index bbe5952..fb493bb 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -23,6 +23,7 @@
  */
 
 #include <xen/vm_event.h>
+#include <xen/monitor.h>
 #include <asm/hvm/monitor.h>
 #include <asm/monitor.h>
 #include <asm/vm_event.h>
@@ -48,7 +49,7 @@ bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old
             .u.write_ctrlreg.old_value = old
         };
 
-        if ( vm_event_monitor_traps(curr, sync, &req) >= 0 )
+        if ( monitor_traps(curr, sync, &req) >= 0 )
             return 1;
     }
 
@@ -68,7 +69,7 @@ void hvm_monitor_msr(unsigned int msr, uint64_t value)
             .u.mov_to_msr.value = value,
         };
 
-        vm_event_monitor_traps(curr, 1, &req);
+        monitor_traps(curr, 1, &req);
     }
 }
 
@@ -131,7 +132,7 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,
 
     req.vcpu_id = curr->vcpu_id;
 
-    return vm_event_monitor_traps(curr, sync, &req);
+    return monitor_traps(curr, sync, &req);
 }
 
 /*
diff --git a/xen/common/monitor.c b/xen/common/monitor.c
index 436214a..5fce61e 100644
--- a/xen/common/monitor.c
+++ b/xen/common/monitor.c
@@ -19,12 +19,15 @@
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <xen/event.h>
 #include <xen/monitor.h>
 #include <xen/sched.h>
 #include <xen/vm_event.h>
 #include <xsm/xsm.h>
 #include <public/domctl.h>
+#include <asm/altp2m.h>
 #include <asm/monitor.h>
+#include <asm/vm_event.h>
 
 int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
 {
@@ -85,6 +88,45 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
     return 0;
 }
 
+int monitor_traps(struct vcpu *v, bool_t sync, vm_event_request_t *req)
+{
+    int rc;
+    struct domain *d = v->domain;
+
+    rc = vm_event_claim_slot(d, &d->vm_event->monitor);
+    switch ( rc )
+    {
+    case 0:
+        break;
+    case -ENOSYS:
+        /*
+         * If there was no ring to handle the event, then
+         * simply continue executing normally.
+         */
+        return 0;
+    default:
+        return rc;
+    };
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+        rc = 1;
+    }
+
+    if ( altp2m_active(d) )
+    {
+        req->flags |= VM_EVENT_FLAG_ALTERNATE_P2M;
+        req->altp2m_idx = altp2m_vcpu_idx(v);
+    }
+
+    vm_event_fill_regs(req);
+    vm_event_put_request(d, &d->vm_event->monitor, req);
+
+    return rc;
+}
+
 void monitor_guest_request(void)
 {
     struct vcpu *curr = current;
@@ -97,7 +139,7 @@ void monitor_guest_request(void)
             .vcpu_id = curr->vcpu_id,
         };
 
-        vm_event_monitor_traps(curr, d->monitor.guest_request_sync, &req);
+        monitor_traps(curr, d->monitor.guest_request_sync, &req);
     }
 }
 
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 17d2716..22bbfc1 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -26,7 +26,6 @@
 #include <xen/vm_event.h>
 #include <xen/mem_access.h>
 #include <asm/p2m.h>
-#include <asm/altp2m.h>
 #include <asm/monitor.h>
 #include <asm/vm_event.h>
 #include <xsm/xsm.h>
@@ -789,50 +788,6 @@ void vm_event_vcpu_unpause(struct vcpu *v)
 }
 
 /*
- * Monitor vm-events
- */
-
-int vm_event_monitor_traps(struct vcpu *v, uint8_t sync,
-                           vm_event_request_t *req)
-{
-    int rc;
-    struct domain *d = v->domain;
-
-    rc = vm_event_claim_slot(d, &d->vm_event->monitor);
-    switch ( rc )
-    {
-    case 0:
-        break;
-    case -ENOSYS:
-        /*
-         * If there was no ring to handle the event, then
-         * simply continue executing normally.
-         */
-        return 0;
-    default:
-        return rc;
-    };
-
-    if ( sync )
-    {
-        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
-        vm_event_vcpu_pause(v);
-        rc = 1;
-    }
-
-    if ( altp2m_active(d) )
-    {
-        req->flags |= VM_EVENT_FLAG_ALTERNATE_P2M;
-        req->altp2m_idx = altp2m_vcpu_idx(v);
-    }
-
-    vm_event_fill_regs(req);
-    vm_event_put_request(d, &d->vm_event->monitor, req);
-
-    return rc;
-}
-
-/*
  * Local variables:
  * mode: C
  * c-file-style: "BSD"
diff --git a/xen/include/xen/monitor.h b/xen/include/xen/monitor.h
index 204d5cc..2171d04 100644
--- a/xen/include/xen/monitor.h
+++ b/xen/include/xen/monitor.h
@@ -3,7 +3,7 @@
  *
  * Common monitor_op domctl handler.
  *
- * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
+ * Copyright (c) 2015-2016 Tamas K Lengyel (tamas@tklengyel.com)
  * Copyright (c) 2016, Bitdefender S.R.L.
  *
  * This program is free software; you can redistribute it and/or
@@ -22,10 +22,14 @@
 #ifndef __XEN_MONITOR_H__
 #define __XEN_MONITOR_H__
 
+#include <public/vm_event.h>
+
 struct domain;
 struct xen_domctl_monitor_op;
 
 int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *op);
 void monitor_guest_request(void);
 
+int monitor_traps(struct vcpu *v, bool_t sync, vm_event_request_t *req);
+
 #endif /* __XEN_MONITOR_H__ */
diff --git a/xen/include/xen/vm_event.h b/xen/include/xen/vm_event.h
index 89e6243..42bd9f6 100644
--- a/xen/include/xen/vm_event.h
+++ b/xen/include/xen/vm_event.h
@@ -75,12 +75,6 @@ int vm_event_domctl(struct domain *d, xen_domctl_vm_event_op_t *vec,
 void vm_event_vcpu_pause(struct vcpu *v);
 void vm_event_vcpu_unpause(struct vcpu *v);
 
-/*
- * Monitor vm-events
- */
-int vm_event_monitor_traps(struct vcpu *v, uint8_t sync,
-                           vm_event_request_t *req);
-
 #endif /* __VM_EVENT_H__ */
 
 
-- 
2.8.1


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

             reply	other threads:[~2016-07-05 18:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 18:37 Tamas K Lengyel [this message]
2016-07-05 18:37 ` [PATCH v8 2/6] arm: filter SMC exceptions with failed condition checks Tamas K Lengyel
2016-07-06 17:31   ` Julien Grall
2016-07-06 18:52     ` Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 3/6] monitor: ARM SMC events Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 4/6] arm/vm_event: get/set registers Tamas K Lengyel
2016-07-06  7:43   ` Jan Beulich
2016-07-06  7:59     ` Razvan Cojocaru
2016-07-06 17:39     ` Julien Grall
2016-07-06 19:23     ` Tamas K Lengyel
2016-07-06 21:12       ` Julien Grall
2016-07-06 22:01         ` Tamas K Lengyel
2016-07-06 18:04   ` Julien Grall
2016-07-06 19:12     ` Tamas K Lengyel
2016-07-07  8:23       ` Jan Beulich
2016-07-07  9:46         ` Julien Grall
2016-07-07  9:57           ` Jan Beulich
2016-07-07 10:09             ` Julien Grall
2016-07-07 15:53               ` Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 5/6] tools/libxc: add xc_monitor_privileged_call Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 6/6] tools/xen-access: add test-case for ARM SMC Tamas K Lengyel
2016-07-07 10:05   ` Julien Grall
2016-07-07 15:54     ` Tamas K Lengyel
2016-07-05 19:15 ` [PATCH v8 1/6] monitor: rename and relocate vm_event_monitor_traps Razvan Cojocaru

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=1467743871-9644-1-git-send-email-tamas.lengyel@zentific.com \
    --to=tamas.lengyel@zentific.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=xen-devel@lists.xenproject.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.