2009-04-22 19:19:15 +04:00
|
|
|
#ifndef QEMU_HW_XEN_BACKEND_H
|
2016-06-29 16:29:06 +03:00
|
|
|
#define QEMU_HW_XEN_BACKEND_H
|
2009-04-22 19:19:15 +04:00
|
|
|
|
2013-02-05 20:06:20 +04:00
|
|
|
#include "hw/xen/xen_common.h"
|
2016-10-25 08:50:09 +03:00
|
|
|
#include "hw/xen/xen_pvdev.h"
|
2012-12-17 21:20:04 +04:00
|
|
|
#include "sysemu/sysemu.h"
|
2012-10-24 10:43:34 +04:00
|
|
|
#include "net/net.h"
|
2009-04-22 19:19:15 +04:00
|
|
|
|
2016-11-22 09:10:56 +03:00
|
|
|
#define TYPE_XENSYSDEV "xen-sysdev"
|
|
|
|
#define TYPE_XENSYSBUS "xen-sysbus"
|
2016-11-22 09:10:58 +03:00
|
|
|
#define TYPE_XENBACKEND "xen-backend"
|
|
|
|
|
|
|
|
#define XENBACKEND_DEVICE(obj) \
|
2019-01-08 17:48:46 +03:00
|
|
|
OBJECT_CHECK(XenLegacyDevice, (obj), TYPE_XENBACKEND)
|
2016-11-22 09:10:56 +03:00
|
|
|
|
2009-04-22 19:19:15 +04:00
|
|
|
/* variables */
|
|
|
|
extern struct xs_handle *xenstore;
|
2009-04-22 19:19:39 +04:00
|
|
|
extern const char *xen_protocol;
|
2016-05-12 17:13:39 +03:00
|
|
|
extern DeviceState *xen_sysdev;
|
2016-11-22 09:10:56 +03:00
|
|
|
extern BusState *xen_sysbus;
|
2009-04-22 19:19:15 +04:00
|
|
|
|
2016-05-12 17:13:40 +03:00
|
|
|
int xenstore_mkdir(char *path, int p);
|
2019-01-08 17:48:46 +03:00
|
|
|
int xenstore_write_be_str(struct XenLegacyDevice *xendev, const char *node,
|
|
|
|
const char *val);
|
|
|
|
int xenstore_write_be_int(struct XenLegacyDevice *xendev, const char *node,
|
|
|
|
int ival);
|
|
|
|
int xenstore_write_be_int64(struct XenLegacyDevice *xendev, const char *node,
|
|
|
|
int64_t ival);
|
|
|
|
char *xenstore_read_be_str(struct XenLegacyDevice *xendev, const char *node);
|
|
|
|
int xenstore_read_be_int(struct XenLegacyDevice *xendev, const char *node,
|
|
|
|
int *ival);
|
|
|
|
void xenstore_update_fe(char *watch, struct XenLegacyDevice *xendev);
|
2016-10-25 08:50:10 +03:00
|
|
|
void xenstore_update_be(char *watch, char *type, int dom,
|
|
|
|
struct XenDevOps *ops);
|
2019-01-08 17:48:46 +03:00
|
|
|
char *xenstore_read_fe_str(struct XenLegacyDevice *xendev, const char *node);
|
|
|
|
int xenstore_read_fe_int(struct XenLegacyDevice *xendev, const char *node,
|
|
|
|
int *ival);
|
|
|
|
int xenstore_read_fe_uint64(struct XenLegacyDevice *xendev, const char *node,
|
2016-10-25 08:50:08 +03:00
|
|
|
uint64_t *uval);
|
2009-04-22 19:19:15 +04:00
|
|
|
|
2019-01-08 17:48:46 +03:00
|
|
|
void xen_be_check_state(struct XenLegacyDevice *xendev);
|
2009-04-22 19:19:15 +04:00
|
|
|
|
|
|
|
/* xen backend driver bits */
|
|
|
|
int xen_be_init(void);
|
2016-08-02 09:32:32 +03:00
|
|
|
void xen_be_register_common(void);
|
2009-04-22 19:19:15 +04:00
|
|
|
int xen_be_register(const char *type, struct XenDevOps *ops);
|
2019-01-08 17:48:46 +03:00
|
|
|
int xen_be_set_state(struct XenLegacyDevice *xendev, enum xenbus_state state);
|
|
|
|
int xen_be_bind_evtchn(struct XenLegacyDevice *xendev);
|
|
|
|
void xen_be_set_max_grant_refs(struct XenLegacyDevice *xendev,
|
2018-05-17 18:35:51 +03:00
|
|
|
unsigned int nr_refs);
|
2019-01-08 17:48:46 +03:00
|
|
|
void *xen_be_map_grant_refs(struct XenLegacyDevice *xendev, uint32_t *refs,
|
2018-05-17 18:35:51 +03:00
|
|
|
unsigned int nr_refs, int prot);
|
2019-01-08 17:48:46 +03:00
|
|
|
void xen_be_unmap_grant_refs(struct XenLegacyDevice *xendev, void *ptr,
|
2018-05-17 18:35:51 +03:00
|
|
|
unsigned int nr_refs);
|
|
|
|
|
|
|
|
typedef struct XenGrantCopySegment {
|
|
|
|
union {
|
|
|
|
void *virt;
|
|
|
|
struct {
|
|
|
|
uint32_t ref;
|
|
|
|
off_t offset;
|
|
|
|
} foreign;
|
|
|
|
} source, dest;
|
|
|
|
size_t len;
|
|
|
|
} XenGrantCopySegment;
|
|
|
|
|
2019-01-08 17:48:46 +03:00
|
|
|
int xen_be_copy_grant_refs(struct XenLegacyDevice *xendev,
|
2018-05-17 18:35:51 +03:00
|
|
|
bool to_domain, XenGrantCopySegment segs[],
|
|
|
|
unsigned int nr_segs);
|
|
|
|
|
2019-01-08 17:48:46 +03:00
|
|
|
static inline void *xen_be_map_grant_ref(struct XenLegacyDevice *xendev,
|
2018-05-17 18:35:51 +03:00
|
|
|
uint32_t ref, int prot)
|
|
|
|
{
|
|
|
|
return xen_be_map_grant_refs(xendev, &ref, 1, prot);
|
|
|
|
}
|
|
|
|
|
2019-01-08 17:48:46 +03:00
|
|
|
static inline void xen_be_unmap_grant_ref(struct XenLegacyDevice *xendev,
|
2018-05-17 18:35:51 +03:00
|
|
|
void *ptr)
|
|
|
|
{
|
|
|
|
return xen_be_unmap_grant_refs(xendev, ptr, 1);
|
|
|
|
}
|
2009-04-22 19:19:15 +04:00
|
|
|
|
2009-04-22 19:19:19 +04:00
|
|
|
/* actual backend drivers */
|
|
|
|
extern struct XenDevOps xen_console_ops; /* xen_console.c */
|
2009-04-22 19:19:25 +04:00
|
|
|
extern struct XenDevOps xen_kbdmouse_ops; /* xen_framebuffer.c */
|
|
|
|
extern struct XenDevOps xen_framebuffer_ops; /* xen_framebuffer.c */
|
2009-04-22 19:19:30 +04:00
|
|
|
extern struct XenDevOps xen_blkdev_ops; /* xen_disk.c */
|
2017-03-22 20:17:09 +03:00
|
|
|
#ifdef CONFIG_VIRTFS
|
|
|
|
extern struct XenDevOps xen_9pfs_ops; /* xen-9p-backend.c */
|
|
|
|
#endif
|
2009-04-22 19:19:35 +04:00
|
|
|
extern struct XenDevOps xen_netdev_ops; /* xen_nic.c */
|
2016-05-12 17:13:41 +03:00
|
|
|
#ifdef CONFIG_USB_LIBUSB
|
|
|
|
extern struct XenDevOps xen_usb_ops; /* xen-usb.c */
|
|
|
|
#endif
|
2009-04-22 19:19:25 +04:00
|
|
|
|
2009-04-22 19:19:39 +04:00
|
|
|
/* configuration (aka xenbus setup) */
|
2010-03-21 22:13:02 +03:00
|
|
|
void xen_config_cleanup(void);
|
2009-04-22 19:19:39 +04:00
|
|
|
int xen_config_dev_blk(DriveInfo *disk);
|
|
|
|
int xen_config_dev_nic(NICInfo *nic);
|
2009-04-22 19:19:44 +04:00
|
|
|
int xen_config_dev_vfb(int vdev, const char *type);
|
|
|
|
int xen_config_dev_vkbd(int vdev);
|
|
|
|
int xen_config_dev_console(int vdev);
|
2009-04-22 19:19:39 +04:00
|
|
|
|
2009-04-22 19:19:15 +04:00
|
|
|
#endif /* QEMU_HW_XEN_BACKEND_H */
|