|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 25/25] argo: implement the get_config op to query notification config
Needed by a guest to obtain the evtchn port to use, if notifications are via
event channel, so: this operation will return the current notification method
active for the domain, and method-specific configuration data:
* event channel: port number
* VIRQ: virq number
Return structure has reserved space intentionally to for future alternative
notification mechanism to return data about both an IRQ number and bound VCPU.
Signed-off-by: Christopher Clark <christopher.clark6@xxxxxxxxxxxxxx>
---
xen/common/argo.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++
xen/include/public/argo.h | 28 +++++++++++++++++++++++
2 files changed, 85 insertions(+)
diff --git a/xen/common/argo.c b/xen/common/argo.c
index 98de9a9..f6cc764 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -1656,6 +1656,46 @@ argo_sendv(struct domain *src_d, const argo_addr_t
*src_addr,
return ( ret < 0 ) ? ret : len;
}
+static void
+argo_get_config(struct domain *d, argo_get_config_t *get_config)
+{
+ unsigned int method = argo_signal_method(d);
+
+ get_config->signal_method = method;
+
+ switch ( method )
+ {
+ case ARGO_SIGNAL_METHOD_EVTCHN:
+ {
+ read_lock(&argo_lock);
+ read_lock(&d->argo->lock);
+
+ get_config->signal.evtchn = d->argo->evtchn_port;
+
+ read_unlock(&d->argo->lock);
+ read_unlock(&argo_lock);
+
+ argo_dprintk("signal for dom:%d evtchn %u\n", d->domain_id,
+ get_config->signal.evtchn);
+
+ break;
+ }
+ case ARGO_SIGNAL_METHOD_VIRQ:
+ {
+ get_config->signal.virq = VIRQ_ARGO;
+
+ argo_dprintk("signal for dom:%d virq %u\n", d->domain_id,
+ get_config->signal.virq);
+ break;
+ }
+ default:
+ {
+ BUG();
+ break;
+ }
+ }
+}
+
long
do_argo_message_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1,
XEN_GUEST_HANDLE_PARAM(void) arg2,
@@ -1746,6 +1786,23 @@ do_argo_message_op(int cmd, XEN_GUEST_HANDLE_PARAM(void)
arg1,
rc = argo_notify(d, ring_data_hnd);
break;
}
+ case ARGO_MESSAGE_OP_get_config:
+ {
+ XEN_GUEST_HANDLE_PARAM(argo_get_config_t) get_config_hnd =
+ guest_handle_cast(arg1, argo_get_config_t);
+ argo_get_config_t get_config;
+
+ if ( unlikely(!guest_handle_okay(get_config_hnd, 1)) )
+ break;
+
+ argo_get_config(d, &get_config);
+
+ if ( __copy_to_guest(get_config_hnd, &get_config, 1) )
+ break;
+
+ rc = 0;
+ break;
+ }
default:
rc = -ENOSYS;
break;
diff --git a/xen/include/public/argo.h b/xen/include/public/argo.h
index 710baa6..1e78ea0 100644
--- a/xen/include/public/argo.h
+++ b/xen/include/public/argo.h
@@ -20,6 +20,7 @@
#define __XEN_PUBLIC_ARGO_H__
#include "xen.h"
+#include "event_channel.h"
#define ARGO_RING_MAGIC 0xbd67e163e7777f2fULL
#define ARGO_RING_DATA_MAGIC 0xcce4d30fbc82e92aULL
@@ -153,6 +154,18 @@ struct argo_ring_message_header
#define ARGO_SIGNAL_METHOD_EVTCHN 1
#define ARGO_SIGNAL_METHOD_VIRQ 2
+typedef struct argo_get_config
+{
+ uint32_t signal_method;
+ union
+ {
+ evtchn_port_t evtchn;
+ uint32_t virq;
+ } signal;
+ uint32_t reserved;
+} argo_get_config_t;
+DEFINE_XEN_GUEST_HANDLE(argo_get_config_t);
+
/*
* Hypercall operations
*/
@@ -244,6 +257,21 @@ struct argo_ring_message_header
*/
#define ARGO_MESSAGE_OP_notify 4
+/*
+ * ARGO_MESSAGE_OP_get_config
+ *
+ * Queries Xen for argo configuration values.
+ *
+ * Used by a guest to obtain the signal method in use for Argo notifications
+ * and the event channel port or isa irq in use.
+ *
+ * arg1: XEN_GUEST_HANDLE(argo_get_config_t)
+ * arg2: NULL
+ * arg3: 0 (ZERO)
+ * arg4: 0 (ZERO)
+ */
+#define ARGO_MESSAGE_OP_get_config 6
+
/* The maximum size of a guest message that may be sent on an Argo ring. */
#define ARGO_MAX_MSG_SIZE ((ARGO_MAX_RING_SIZE) - \
(sizeof(struct argo_ring_message_header)) - \
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |