xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xen.org
Cc: Keir Fraser <keir@xen.org>,
	David Vrabel <david.vrabel@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 08/11] evtchn: implement EVTCHNOP_set_priority and add the set_priority hook
Date: Fri, 13 Sep 2013 17:56:10 +0100	[thread overview]
Message-ID: <1379091373-30293-9-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1379091373-30293-1-git-send-email-david.vrabel@citrix.com>

From: David Vrabel <david.vrabel@citrix.com>

Implement EVTCHNOP_set_priority.  A new set_priority hook added to
struct evtchn_port_ops will do the ABI specific validation and setup.

If an ABI does not provide a set_priority hook (as is the case of the
2-level ABI), the sub-op will return -ENOSYS.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
 xen/common/event_channel.c |   29 +++++++++++++++++++++++++++++
 xen/include/xen/event.h    |   11 +++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 28c641b..d583d54 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -934,6 +934,27 @@ out:
     return rc;
 }
 
+static long evtchn_set_priority(const struct evtchn_set_priority *set_priority)
+{
+    struct domain *d = current->domain;
+    unsigned port = set_priority->port;
+    long ret;
+
+    spin_lock(&d->event_lock);
+
+    if ( !port_is_valid(d, port) )
+    {
+        spin_unlock(&d->event_lock);
+        return -EINVAL;
+    }
+
+    ret = evtchn_port_set_priority(d, evtchn_from_port(d, port),
+                                   set_priority->priority);
+
+    spin_unlock(&d->event_lock);
+
+    return ret;
+}
 
 long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
@@ -1043,6 +1064,14 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         break;
     }
 
+    case EVTCHNOP_set_priority: {
+        struct evtchn_set_priority set_priority;
+        if ( copy_from_guest(&set_priority, arg, 1) != 0 )
+            return -EFAULT;
+        rc = evtchn_set_priority(&set_priority);
+        break;
+    }
+
     default:
         rc = -ENOSYS;
         break;
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 091b53c..954ed89 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -123,6 +123,8 @@ struct evtchn_port_ops {
     void (*unmask)(struct domain *d, struct evtchn *evtchn);
     bool_t (*is_pending)(struct domain *d, const struct evtchn *evtchn);
     bool_t (*is_masked)(struct domain *d, const struct evtchn *evtchn);
+    int (*set_priority)(struct domain *d, struct evtchn *evtchn,
+                        unsigned priority);
     void (*print_state)(struct domain *d, const struct evtchn *evtchn);
 };
 
@@ -156,6 +158,15 @@ static inline bool_t evtchn_port_is_masked(struct domain *d,
     return d->evtchn_port_ops->is_masked(d, evtchn);
 }
 
+static inline int evtchn_port_set_priority(struct domain *d,
+                                           struct evtchn *evtchn,
+                                           unsigned priority)
+{
+    if ( !d->evtchn_port_ops->set_priority )
+        return -ENOSYS;
+    return d->evtchn_port_ops->set_priority(d, evtchn, priority);
+}
+
 static inline void evtchn_port_print_state(struct domain *d,
                                            const struct evtchn *evtchn)
 {
-- 
1.7.2.5

  parent reply	other threads:[~2013-09-13 16:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 16:56 [PATCHv3 0/11] Xen: FIFO-based event channel ABI David Vrabel
2013-09-13 16:56 ` [PATCH 01/11] debug: remove some event channel info from the 'i' and 'q' debug keys David Vrabel
2013-09-13 16:56 ` [PATCH 02/11] evtchn: refactor low-level event channel port ops David Vrabel
2013-09-15 13:06   ` Stefano Stabellini
2013-09-15 13:11     ` Stefano Stabellini
2013-09-16 10:08       ` David Vrabel
2013-09-15 13:20     ` Ian Campbell
2013-09-13 16:56 ` [PATCH 03/11] evtchn: print ABI specific state with the 'e' debug key David Vrabel
2013-09-13 16:56 ` [PATCH 04/11] evtchn: use a per-domain variable for the max number of event channels David Vrabel
2013-09-13 16:56 ` [PATCH 05/11] evtchn: dynamically allocate d->evtchn David Vrabel
2013-09-13 16:56 ` [PATCH 06/11] evtchn: alter internal object handling scheme David Vrabel
2013-09-13 16:56 ` [PATCH 07/11] evtchn: add FIFO-based event channel ABI David Vrabel
2013-09-16  6:59   ` Jan Beulich
2013-09-13 16:56 ` David Vrabel [this message]
2013-09-13 16:56 ` [PATCH 09/11] evtchn: implement EVTCHNOP_set_limit David Vrabel
2013-09-13 18:32   ` Daniel De Graaf
2013-09-16  7:07   ` Jan Beulich
2013-09-16 10:00     ` David Vrabel
2013-09-16 10:33       ` Jan Beulich
2013-09-16 10:57         ` David Vrabel
2013-09-13 16:56 ` [PATCH 10/11] libxc: add xc_evtchn_set_limit() David Vrabel
2013-09-13 16:56 ` [PATCH 11/11] evtchn: add FIFO-based event channel hypercalls and port ops David Vrabel

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=1379091373-30293-9-git-send-email-david.vrabel@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).