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

[Minios-devel] [UNIKRAFT-PATCH 2/3] plat/xen/common: Move event channel functions in events.h



From: Radu Nicolau <radunicolau102@xxxxxxxxx>

Move mask_evtchn, unmask_evtchn and clear_evtchn function
prototypes from hypervisor.h to events.h. Change parameter
type to evtchn_port_t. Remove hypervisor.h inclusion from
arm/arch_events.c and arm/arch_time.c

Move active_evtchns() macro to events.h

Signed-off-by: Radu Nicolau <radunicolau102@xxxxxxxxx>
---
 plat/xen/arm/arch_events.c           |  1 -
 plat/xen/arm/arch_time.c             |  1 -
 plat/xen/events.c                    |  8 +++-----
 plat/xen/hypervisor.c                |  4 ----
 plat/xen/include/common/events.h     | 22 ++++++++++++++++++++++
 plat/xen/include/common/hypervisor.h |  3 ---
 6 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/plat/xen/arm/arch_events.c b/plat/xen/arm/arch_events.c
index 91f0ecb..2037aca 100644
--- a/plat/xen/arm/arch_events.c
+++ b/plat/xen/arm/arch_events.c
@@ -26,7 +26,6 @@
 
 #include <xen-arm/os.h>
 #include <common/events.h>
-#include <common/hypervisor.h>
 #include <uk/print.h>
 #include <uk/assert.h>
 #include <uk/essentials.h>
diff --git a/plat/xen/arm/arch_time.c b/plat/xen/arm/arch_time.c
index c5d4551..fec89da 100644
--- a/plat/xen/arm/arch_time.c
+++ b/plat/xen/arm/arch_time.c
@@ -25,7 +25,6 @@
  */
 
 #include <xen-arm/os.h>
-#include <common/hypervisor.h>
 #include <common/events.h>
 #include <xen-arm/traps.h>
 #include <uk/print.h>
diff --git a/plat/xen/events.c b/plat/xen/events.c
index 6df3e4b..3a1d155 100644
--- a/plat/xen/events.c
+++ b/plat/xen/events.c
@@ -291,16 +291,14 @@ int evtchn_get_peercontext(evtchn_port_t local_port, char 
*ctx, int size)
        return rc;
 }
 
-/* TODO - these were moved from hypervisor.c; integrate into evtchn */
-
-inline void mask_evtchn(uint32_t port)
+inline void mask_evtchn(evtchn_port_t port)
 {
        shared_info_t *s = HYPERVISOR_shared_info;
 
        uk_set_bit(port, &s->evtchn_mask[0]);
 }
 
-inline void unmask_evtchn(uint32_t port)
+inline void unmask_evtchn(evtchn_port_t port)
 {
        shared_info_t *s = HYPERVISOR_shared_info;
        vcpu_info_t *vcpu_info = &s->vcpu_info[smp_processor_id()];
@@ -323,7 +321,7 @@ inline void unmask_evtchn(uint32_t port)
        }
 }
 
-inline void clear_evtchn(uint32_t port)
+inline void clear_evtchn(evtchn_port_t port)
 {
        shared_info_t *s = HYPERVISOR_shared_info;
 
diff --git a/plat/xen/hypervisor.c b/plat/xen/hypervisor.c
index ca16ed6..14f1642 100644
--- a/plat/xen/hypervisor.c
+++ b/plat/xen/hypervisor.c
@@ -42,10 +42,6 @@
 #include <uk/arch/lcpu.h>
 #include <uk/arch/atomic.h>
 
-// TODO revisit: move to evtchn; why cpu param?
-#define active_evtchns(cpu, sh, idx)                           \
-       ((sh)->evtchn_pending[idx] & ~(sh)->evtchn_mask[idx])
-
 int in_callback;
 
 #ifndef CONFIG_PARAVIRT
diff --git a/plat/xen/include/common/events.h b/plat/xen/include/common/events.h
index 971dff9..accddb8 100644
--- a/plat/xen/include/common/events.h
+++ b/plat/xen/include/common/events.h
@@ -47,6 +47,12 @@
 #include <xen/event_channel.h>
 #include <uk/arch/lcpu.h>
 
+/*
+ * TODO revisit: why cpu param?
+ * Taken from linux/drivers/xen/events/events_2l.c
+ */
+#define active_evtchns(cpu, sh, idx)                           \
+       ((sh)->evtchn_pending[idx] & ~(sh)->evtchn_mask[idx])
 
 typedef void (*evtchn_handler_t)(evtchn_port_t, struct __regs *, void *);
 
@@ -65,6 +71,22 @@ evtchn_port_t bind_pirq(uint32_t pirq, int will_share,
 evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
                          void *data);
 void unbind_evtchn(evtchn_port_t port);
+
+/* Disable events for <port> by setting the masking bit */
+void mask_evtchn(evtchn_port_t port);
+
+/*
+ * Enable events for <port> by unsetting the masking bit.
+ * If pending events are present, call ukplat_lcpu_irqs_handle_pending
+ */
+void unmask_evtchn(evtchn_port_t port);
+
+/*
+ * Clear pending events from <port> by unsetting the pending
+ * events bit
+ */
+void clear_evtchn(evtchn_port_t port);
+
 void init_events(void);
 int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
                         void *data, evtchn_port_t *port);
diff --git a/plat/xen/include/common/hypervisor.h 
b/plat/xen/include/common/hypervisor.h
index 4587b86..417498e 100644
--- a/plat/xen/include/common/hypervisor.h
+++ b/plat/xen/include/common/hypervisor.h
@@ -71,9 +71,6 @@ shared_info_t *map_shared_info(void *p);
 //TODO START from here on we have to cleanup/refactor/move stuff
 /* hypervisor.c */
 void do_hypervisor_callback(struct __regs *regs);
-void mask_evtchn(uint32_t port);
-void unmask_evtchn(uint32_t port);
-void clear_evtchn(uint32_t port);
 //TODO END
 
 extern int in_callback;
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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