mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
hw/xen: Add evtchn operations to allow redirection to internal emulation
The existing implementation calling into the real libxenevtchn moves to a new file hw/xen/xen-operations.c, and is called via a function table which in a subsequent commit will also be able to invoke the emulated event channel support. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
parent
831b0db8ab
commit
b6cacfea0b
13 changed files with 242 additions and 57 deletions
71
hw/xen/xen-operations.c
Normal file
71
hw/xen/xen-operations.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* QEMU Xen backend support: Operations for true Xen
|
||||
*
|
||||
* Copyright © 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Authors: David Woodhouse <dwmw2@infradead.org>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
#include "hw/xen/xen_backend_ops.h"
|
||||
#include "hw/xen/xen_common.h"
|
||||
|
||||
/*
|
||||
* If we have new enough libxenctrl then we do not want/need these compat
|
||||
* interfaces, despite what the user supplied cflags might say. They
|
||||
* must be undefined before including xenctrl.h
|
||||
*/
|
||||
#undef XC_WANT_COMPAT_EVTCHN_API
|
||||
|
||||
#include <xenctrl.h>
|
||||
|
||||
/*
|
||||
* We don't support Xen prior to 4.2.0.
|
||||
*/
|
||||
|
||||
/* Xen 4.2 through 4.6 */
|
||||
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40701
|
||||
|
||||
typedef xc_evtchn xenevtchn_handle;
|
||||
typedef evtchn_port_or_error_t xenevtchn_port_or_error_t;
|
||||
|
||||
#define xenevtchn_open(l, f) xc_evtchn_open(l, f);
|
||||
#define xenevtchn_close(h) xc_evtchn_close(h)
|
||||
#define xenevtchn_fd(h) xc_evtchn_fd(h)
|
||||
#define xenevtchn_pending(h) xc_evtchn_pending(h)
|
||||
#define xenevtchn_notify(h, p) xc_evtchn_notify(h, p)
|
||||
#define xenevtchn_bind_interdomain(h, d, p) xc_evtchn_bind_interdomain(h, d, p)
|
||||
#define xenevtchn_unmask(h, p) xc_evtchn_unmask(h, p)
|
||||
#define xenevtchn_unbind(h, p) xc_evtchn_unbind(h, p)
|
||||
|
||||
#else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40701 */
|
||||
|
||||
#include <xenevtchn.h>
|
||||
|
||||
#endif
|
||||
|
||||
static xenevtchn_handle *libxenevtchn_backend_open(void)
|
||||
{
|
||||
return xenevtchn_open(NULL, 0);
|
||||
}
|
||||
|
||||
struct evtchn_backend_ops libxenevtchn_backend_ops = {
|
||||
.open = libxenevtchn_backend_open,
|
||||
.close = xenevtchn_close,
|
||||
.bind_interdomain = xenevtchn_bind_interdomain,
|
||||
.unbind = xenevtchn_unbind,
|
||||
.get_fd = xenevtchn_fd,
|
||||
.notify = xenevtchn_notify,
|
||||
.unmask = xenevtchn_unmask,
|
||||
.pending = xenevtchn_pending,
|
||||
};
|
||||
|
||||
void setup_xen_backend_ops(void)
|
||||
{
|
||||
xen_evtchn_ops = &libxenevtchn_backend_ops;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue