Skip to content

Commit

Permalink
xen: Move evtchn functions to xen_pvdev.c
Browse files Browse the repository at this point in the history
The name of the functions moved:
 * xen_be_evtchn_event
 * xen_be_unbind_evtchn
 * xen_be_send_notify

Signed-off-by: Emil Condrea <emilcondrea@gmail.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Quan Xu <xuquan8@huawei.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
  • Loading branch information
emilcondrea authored and sstabellini committed Oct 29, 2016
1 parent 046db9b commit 31c17aa
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 37 deletions.
35 changes: 0 additions & 35 deletions hw/xen/xen_backend.c
Expand Up @@ -607,25 +607,6 @@ void xenstore_update_fe(char *watch, struct XenDevice *xendev)
xen_be_frontend_changed(xendev, node);
xen_be_check_state(xendev);
}
static void xen_be_evtchn_event(void *opaque)
{
struct XenDevice *xendev = opaque;
evtchn_port_t port;

port = xenevtchn_pending(xendev->evtchndev);
if (port != xendev->local_port) {
xen_be_printf(xendev, 0,
"xenevtchn_pending returned %d (expected %d)\n",
port, xendev->local_port);
return;
}
xenevtchn_unmask(xendev->evtchndev, port);

if (xendev->ops->event) {
xendev->ops->event(xendev);
}
}

/* -------------------------------------------------------------------- */

int xen_be_init(void)
Expand Down Expand Up @@ -702,22 +683,6 @@ int xen_be_bind_evtchn(struct XenDevice *xendev)
return 0;
}

void xen_be_unbind_evtchn(struct XenDevice *xendev)
{
if (xendev->local_port == -1) {
return;
}
qemu_set_fd_handler(xenevtchn_fd(xendev->evtchndev), NULL, NULL, NULL);
xenevtchn_unbind(xendev->evtchndev, xendev->local_port);
xen_be_printf(xendev, 2, "unbind evtchn port %d\n", xendev->local_port);
xendev->local_port = -1;
}

int xen_be_send_notify(struct XenDevice *xendev)
{
return xenevtchn_notify(xendev->evtchndev, xendev->local_port);
}


static int xen_sysdev_init(SysBusDevice *dev)
{
Expand Down
35 changes: 35 additions & 0 deletions hw/xen/xen_pvdev.c
Expand Up @@ -171,3 +171,38 @@ void xen_be_printf(struct XenDevice *xendev, int msg_level,
}
qemu_log_flush();
}

void xen_be_evtchn_event(void *opaque)
{
struct XenDevice *xendev = opaque;
evtchn_port_t port;

port = xenevtchn_pending(xendev->evtchndev);
if (port != xendev->local_port) {
xen_be_printf(xendev, 0,
"xenevtchn_pending returned %d (expected %d)\n",
port, xendev->local_port);
return;
}
xenevtchn_unmask(xendev->evtchndev, port);

if (xendev->ops->event) {
xendev->ops->event(xendev);
}
}

void xen_be_unbind_evtchn(struct XenDevice *xendev)
{
if (xendev->local_port == -1) {
return;
}
qemu_set_fd_handler(xenevtchn_fd(xendev->evtchndev), NULL, NULL, NULL);
xenevtchn_unbind(xendev->evtchndev, xendev->local_port);
xen_be_printf(xendev, 2, "unbind evtchn port %d\n", xendev->local_port);
xendev->local_port = -1;
}

int xen_be_send_notify(struct XenDevice *xendev)
{
return xenevtchn_notify(xendev->evtchndev, xendev->local_port);
}
2 changes: 0 additions & 2 deletions include/hw/xen/xen_backend.h
Expand Up @@ -36,8 +36,6 @@ void xen_be_register_common(void);
int xen_be_register(const char *type, struct XenDevOps *ops);
int xen_be_set_state(struct XenDevice *xendev, enum xenbus_state state);
int xen_be_bind_evtchn(struct XenDevice *xendev);
void xen_be_unbind_evtchn(struct XenDevice *xendev);
int xen_be_send_notify(struct XenDevice *xendev);

/* actual backend drivers */
extern struct XenDevOps xen_console_ops; /* xen_console.c */
Expand Down
4 changes: 4 additions & 0 deletions include/hw/xen/xen_pvdev.h
Expand Up @@ -64,6 +64,10 @@ void xenstore_update(void *unused);

const char *xenbus_strstate(enum xenbus_state state);

void xen_be_evtchn_event(void *opaque);
void xen_be_unbind_evtchn(struct XenDevice *xendev);
int xen_be_send_notify(struct XenDevice *xendev);

void xen_be_printf(struct XenDevice *xendev, int msg_level,
const char *fmt, ...) GCC_FMT_ATTR(3, 4);

Expand Down

0 comments on commit 31c17aa

Please sign in to comment.