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

[Xen-devel] [PATCH 04/16] x86/monitor: relocate vm_event_register_write_resume() function to monitor code



vm_event_register_write_resume is part of the monitor subsystem, relocate and
rename appropriately.

Signed-off-by: Corneliu ZUZU <czuzu@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/monitor.c         | 38 ++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/vm_event.c        | 37 -------------------------------------
 xen/common/vm_event.c          |  2 +-
 xen/include/asm-arm/monitor.h  |  6 ++++++
 xen/include/asm-arm/vm_event.h |  6 ------
 xen/include/asm-x86/monitor.h  |  2 ++
 xen/include/asm-x86/vm_event.h |  2 --
 7 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
index 043815a..06d21b1 100644
--- a/xen/arch/x86/monitor.c
+++ b/xen/arch/x86/monitor.c
@@ -20,6 +20,7 @@
  */
 
 #include <asm/monitor.h>
+#include <asm/vm_event.h>
 #include <public/vm_event.h>
 
 int monitor_init_domain(struct domain *d)
@@ -41,6 +42,43 @@ void monitor_cleanup_domain(struct domain *d)
     memset(&d->monitor, 0, sizeof(d->monitor));
 }
 
+void monitor_ctrlreg_write_resume(struct vcpu *v, vm_event_response_t *rsp)
+{
+    if ( rsp->flags & VM_EVENT_FLAG_DENY )
+    {
+        struct monitor_write_data *w;
+
+        ASSERT(v->arch.vm_event);
+
+        /* deny flag requires the vCPU to be paused */
+        if ( !atomic_read(&v->vm_event_pause_count) )
+            return;
+
+        w = &v->arch.vm_event->write_data;
+
+        switch ( rsp->reason )
+        {
+        case VM_EVENT_REASON_MOV_TO_MSR:
+            w->do_write.msr = 0;
+            break;
+        case VM_EVENT_REASON_WRITE_CTRLREG:
+            switch ( rsp->u.write_ctrlreg.index )
+            {
+            case VM_EVENT_X86_CR0:
+                w->do_write.cr0 = 0;
+                break;
+            case VM_EVENT_X86_CR3:
+                w->do_write.cr3 = 0;
+                break;
+            case VM_EVENT_X86_CR4:
+                w->do_write.cr4 = 0;
+                break;
+            }
+            break;
+        }
+    }
+}
+
 static unsigned long *monitor_bitmap_for_msr(const struct domain *d, u32 *msr)
 {
     ASSERT(d->arch.monitor.msr_bitmap && msr);
diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index e938ca3..6e19df8 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -66,43 +66,6 @@ void vm_event_toggle_singlestep(struct domain *d, struct 
vcpu *v)
     hvm_toggle_singlestep(v);
 }
 
-void vm_event_register_write_resume(struct vcpu *v, vm_event_response_t *rsp)
-{
-    if ( rsp->flags & VM_EVENT_FLAG_DENY )
-    {
-        struct monitor_write_data *w;
-
-        ASSERT(v->arch.vm_event);
-
-        /* deny flag requires the vCPU to be paused */
-        if ( !atomic_read(&v->vm_event_pause_count) )
-            return;
-
-        w = &v->arch.vm_event->write_data;
-
-        switch ( rsp->reason )
-        {
-        case VM_EVENT_REASON_MOV_TO_MSR:
-            w->do_write.msr = 0;
-            break;
-        case VM_EVENT_REASON_WRITE_CTRLREG:
-            switch ( rsp->u.write_ctrlreg.index )
-            {
-            case VM_EVENT_X86_CR0:
-                w->do_write.cr0 = 0;
-                break;
-            case VM_EVENT_X86_CR3:
-                w->do_write.cr3 = 0;
-                break;
-            case VM_EVENT_X86_CR4:
-                w->do_write.cr4 = 0;
-                break;
-            }
-            break;
-        }
-    }
-}
-
 void vm_event_set_registers(struct vcpu *v, vm_event_response_t *rsp)
 {
     ASSERT(atomic_read(&v->vm_event_pause_count));
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index b4f9fd3..e60e1f2 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -397,7 +397,7 @@ void vm_event_resume(struct domain *d, struct 
vm_event_domain *ved)
         case VM_EVENT_REASON_MOV_TO_MSR:
 #endif
         case VM_EVENT_REASON_WRITE_CTRLREG:
-            vm_event_register_write_resume(v, &rsp);
+            monitor_ctrlreg_write_resume(v, &rsp);
             break;
 
 #ifdef CONFIG_HAS_MEM_ACCESS
diff --git a/xen/include/asm-arm/monitor.h b/xen/include/asm-arm/monitor.h
index c72ee42..5a0fc65 100644
--- a/xen/include/asm-arm/monitor.h
+++ b/xen/include/asm-arm/monitor.h
@@ -57,6 +57,12 @@ static inline void monitor_cleanup_domain(struct domain *d)
     /* No arch-specific domain cleanup on ARM. */
 }
 
+static inline
+void monitor_ctrlreg_write_resume(struct vcpu *v, vm_event_response_t *rsp)
+{
+    /* Not supported on ARM. */
+}
+
 static inline uint32_t monitor_get_capabilities(struct domain *d)
 {
     uint32_t capabilities = 0;
diff --git a/xen/include/asm-arm/vm_event.h b/xen/include/asm-arm/vm_event.h
index ccc4b60..0129b04 100644
--- a/xen/include/asm-arm/vm_event.h
+++ b/xen/include/asm-arm/vm_event.h
@@ -40,12 +40,6 @@ static inline void vm_event_toggle_singlestep(struct domain 
*d, struct vcpu *v)
 }
 
 static inline
-void vm_event_register_write_resume(struct vcpu *v, vm_event_response_t *rsp)
-{
-    /* Not supported on ARM. */
-}
-
-static inline
 void vm_event_set_registers(struct vcpu *v, vm_event_response_t *rsp)
 {
     /* Not supported on ARM. */
diff --git a/xen/include/asm-x86/monitor.h b/xen/include/asm-x86/monitor.h
index c5ae7ef..adca378 100644
--- a/xen/include/asm-x86/monitor.h
+++ b/xen/include/asm-x86/monitor.h
@@ -91,6 +91,8 @@ int monitor_init_domain(struct domain *d);
 
 void monitor_cleanup_domain(struct domain *d);
 
+void monitor_ctrlreg_write_resume(struct vcpu *v, vm_event_response_t *rsp);
+
 bool_t monitored_msr(const struct domain *d, u32 msr);
 
 #endif /* __ASM_X86_MONITOR_H__ */
diff --git a/xen/include/asm-x86/vm_event.h b/xen/include/asm-x86/vm_event.h
index 7e6adff..c53effb 100644
--- a/xen/include/asm-x86/vm_event.h
+++ b/xen/include/asm-x86/vm_event.h
@@ -37,8 +37,6 @@ void vm_event_cleanup_domain(struct domain *d);
 
 void vm_event_toggle_singlestep(struct domain *d, struct vcpu *v);
 
-void vm_event_register_write_resume(struct vcpu *v, vm_event_response_t *rsp);
-
 void vm_event_set_registers(struct vcpu *v, vm_event_response_t *rsp);
 
 void vm_event_fill_regs(vm_event_request_t *req);
-- 
2.5.0


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

 


Rackspace

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