evtchn: replace FIFO-specific header by generic private one

Having a FIFO specific header is not (or at least no longer) warranted
with just three function declarations left there. Introduce a private
header instead, moving there some further items from xen/event.h.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Jan Beulich committed 2020-10-23 10:09:55 +02:00
1 parent dcbd1d8ae5
commit 5bc84281a9
6 files changed
+69 -70

No files matched your search

+2 -1
View File
@@ -7,11 +7,12 @@
* Version 2 or later. See the file COPYING for more details.
*/
#include "event_channel.h"
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
#include <xen/sched.h>
#include <xen/event.h>
#include <asm/guest_atomics.h>
+2 -2
View File
@@ -14,17 +14,17 @@
* along with this program; If not, see <http://www.gnu.org/licenses/>.
*/
#include "event_channel.h"
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
#include <xen/sched.h>
#include <xen/event.h>
#include <xen/irq.h>
#include <xen/iocap.h>
#include <xen/compat.h>
#include <xen/guest_access.h>
#include <xen/keyhandler.h>
#include <xen/event_fifo.h>
#include <asm/current.h>
#include <public/xen.h>
+63
View File
@@ -0,0 +1,63 @@
/* Event channel handling private header. */
#include <xen/event.h>
static inline unsigned int max_evtchns(const struct domain *d)
{
return d->evtchn_fifo ? EVTCHN_FIFO_NR_CHANNELS
: BITS_PER_EVTCHN_WORD(d) * BITS_PER_EVTCHN_WORD(d);
}
static inline bool evtchn_is_busy(const struct domain *d,
const struct evtchn *evtchn)
{
return d->evtchn_port_ops->is_busy &&
d->evtchn_port_ops->is_busy(d, evtchn);
}
static inline void evtchn_port_unmask(struct domain *d,
struct evtchn *evtchn)
{
if ( evtchn_usable(evtchn) )
d->evtchn_port_ops->unmask(d, evtchn);
}
static inline int evtchn_port_set_priority(struct domain *d,
struct evtchn *evtchn,
unsigned int priority)
{
if ( !d->evtchn_port_ops->set_priority )
return -ENOSYS;
if ( !evtchn_usable(evtchn) )
return -EACCES;
return d->evtchn_port_ops->set_priority(d, evtchn, priority);
}
static inline void evtchn_port_print_state(struct domain *d,
const struct evtchn *evtchn)
{
d->evtchn_port_ops->print_state(d, evtchn);
}
/* 2-level */
void evtchn_2l_init(struct domain *d);
/* FIFO */
struct evtchn_init_control;
struct evtchn_expand_array;
int evtchn_fifo_init_control(struct evtchn_init_control *init_control);
int evtchn_fifo_expand_array(const struct evtchn_expand_array *expand_array);
void evtchn_fifo_destroy(struct domain *d);
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/
+2 -2
View File
@@ -7,12 +7,12 @@
* Version 2 or later. See the file COPYING for more details.
*/
#include "event_channel.h"
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
#include <xen/sched.h>
#include <xen/event.h>
#include <xen/event_fifo.h>
#include <xen/paging.h>
#include <xen/mm.h>
#include <xen/domain_page.h>
-39
View File
@@ -105,12 +105,6 @@ void notify_via_xen_event_channel(struct domain *ld, int lport);
#define bucket_from_port(d, p) \
((group_from_port(d, p))[((p) % EVTCHNS_PER_GROUP) / EVTCHNS_PER_BUCKET])
static inline unsigned int max_evtchns(const struct domain *d)
{
return d->evtchn_fifo ? EVTCHN_FIFO_NR_CHANNELS
: BITS_PER_EVTCHN_WORD(d) * BITS_PER_EVTCHN_WORD(d);
}
static inline bool_t port_is_valid(struct domain *d, unsigned int p)
{
if ( p >= read_atomic(&d->valid_evtchns) )
@@ -176,8 +170,6 @@ static bool evtchn_usable(const struct evtchn *evtchn)
void evtchn_check_pollers(struct domain *d, unsigned int port);
void evtchn_2l_init(struct domain *d);
/* Close all event channels and reset to 2-level ABI. */
int evtchn_reset(struct domain *d, bool resuming);
@@ -227,13 +219,6 @@ static inline void evtchn_port_clear_pending(struct domain *d,
d->evtchn_port_ops->clear_pending(d, evtchn);
}
static inline void evtchn_port_unmask(struct domain *d,
struct evtchn *evtchn)
{
if ( evtchn_usable(evtchn) )
d->evtchn_port_ops->unmask(d, evtchn);
}
static inline bool evtchn_is_pending(const struct domain *d,
const struct evtchn *evtchn)
{
@@ -259,13 +244,6 @@ static inline bool evtchn_port_is_masked(struct domain *d, evtchn_port_t port)
return rc;
}
static inline bool evtchn_is_busy(const struct domain *d,
const struct evtchn *evtchn)
{
return d->evtchn_port_ops->is_busy &&
d->evtchn_port_ops->is_busy(d, evtchn);
}
/* Returns negative errno, zero for not pending, or positive for pending. */
static inline int evtchn_port_poll(struct domain *d, evtchn_port_t port)
{
@@ -285,21 +263,4 @@ static inline int evtchn_port_poll(struct domain *d, evtchn_port_t port)
return rc;
}
static inline int evtchn_port_set_priority(struct domain *d,
struct evtchn *evtchn,
unsigned int priority)
{
if ( !d->evtchn_port_ops->set_priority )
return -ENOSYS;
if ( !evtchn_usable(evtchn) )
return -EACCES;
return d->evtchn_port_ops->set_priority(d, evtchn, priority);
}
static inline void evtchn_port_print_state(struct domain *d,
const struct evtchn *evtchn)
{
d->evtchn_port_ops->print_state(d, evtchn);
}
#endif /* __XEN_EVENT_H__ */
-26
View File
@@ -1,26 +0,0 @@
/*
* FIFO-based event channel ABI.
*
* Copyright (C) 2013 Citrix Systems R&D Ltd.
*
* This source code is licensed under the GNU General Public License,
* Version 2 or later. See the file COPYING for more details.
*/
#ifndef __XEN_EVENT_FIFO_H__
#define __XEN_EVENT_FIFO_H__
int evtchn_fifo_init_control(struct evtchn_init_control *init_control);
int evtchn_fifo_expand_array(const struct evtchn_expand_array *expand_array);
void evtchn_fifo_destroy(struct domain *domain);
#endif /* __XEN_EVENT_FIFO_H__ */
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.