mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190114' into staging
Xen queue * Xen PV backend 'qdevification'. Starting with xen_disk. * Performance improvements for xen-block. * Remove of the Xen PV domain builder. * bug fixes. # gpg: Signature made Mon 14 Jan 2019 13:46:33 GMT # gpg: using RSA key 0CF5572FD7FB55AF # gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>" # gpg: aka "Anthony PERARD <anthony.perard@citrix.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 5379 2F71 024C 600F 778A 7161 D8D5 7199 DF83 42C8 # Subkey fingerprint: F80C 0063 08E2 2CFD 8A92 E798 0CF5 572F D7FB 55AF * remotes/aperard/tags/pull-xen-20190114: (25 commits) xen-block: avoid repeated memory allocation xen-block: improve response latency xen-block: improve batching behaviour xen: Replace few mentions of xend by libxl Remove broken Xen PV domain builder xen: remove the legacy 'xen_disk' backend MAINTAINERS: add myself as a Xen maintainer xen: automatically create XenBlockDevice-s xen: add a mechanism to automatically create XenDevice-s... xen: add implementations of xen-block connect and disconnect functions... xen: purge 'blk' and 'ioreq' from function names in dataplane/xen-block.c xen: remove 'ioreq' struct/varable/field names from dataplane/xen-block.c xen: remove 'XenBlkDev' and 'blkdev' names from dataplane/xen-block xen: add header and build dataplane/xen-block.c xen: remove unnecessary code from dataplane/xen-block.c xen: duplicate xen_disk.c as basis of dataplane/xen-block.c xen: add event channel interface for XenDevice-s xen: add grant table interface for XenDevice-s xen: add xenstore watcher infrastructure xen: create xenstore areas for XenDevice-s ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+4
-1
@@ -407,6 +407,7 @@ Guest CPU Cores (Xen):
|
||||
X86
|
||||
M: Stefano Stabellini <sstabellini@kernel.org>
|
||||
M: Anthony Perard <anthony.perard@citrix.com>
|
||||
M: Paul Durrant <paul.durrant@citrix.com>
|
||||
L: xen-devel@lists.xenproject.org
|
||||
S: Supported
|
||||
F: */xen*
|
||||
@@ -414,10 +415,12 @@ F: hw/9pfs/xen-9p-backend.c
|
||||
F: hw/char/xen_console.c
|
||||
F: hw/display/xenfb.c
|
||||
F: hw/net/xen_nic.c
|
||||
F: hw/block/xen_*
|
||||
F: hw/block/xen*
|
||||
F: hw/block/dataplane/xen*
|
||||
F: hw/xen/
|
||||
F: hw/xenpv/
|
||||
F: hw/i386/xen/
|
||||
F: include/hw/block/dataplane/xen*
|
||||
F: include/hw/xen/
|
||||
F: include/sysemu/xen-mapcache.h
|
||||
|
||||
|
||||
@@ -357,7 +357,6 @@ vnc_png=""
|
||||
xkbcommon=""
|
||||
xen=""
|
||||
xen_ctrl_version=""
|
||||
xen_pv_domain_build="no"
|
||||
xen_pci_passthrough=""
|
||||
linux_aio=""
|
||||
cap_ng=""
|
||||
@@ -1119,10 +1118,6 @@ for opt do
|
||||
;;
|
||||
--enable-xen-pci-passthrough) xen_pci_passthrough="yes"
|
||||
;;
|
||||
--disable-xen-pv-domain-build) xen_pv_domain_build="no"
|
||||
;;
|
||||
--enable-xen-pv-domain-build) xen_pv_domain_build="yes"
|
||||
;;
|
||||
--disable-brlapi) brlapi="no"
|
||||
;;
|
||||
--enable-brlapi) brlapi="yes"
|
||||
@@ -1685,8 +1680,6 @@ Advanced options (experts only):
|
||||
--tls-priority default TLS protocol/cipher priority string
|
||||
--enable-gprof QEMU profiling with gprof
|
||||
--enable-profiler profiler support
|
||||
--enable-xen-pv-domain-build
|
||||
xen pv domain builder
|
||||
--enable-debug-stack-usage
|
||||
track the maximum stack usage of stacks created by qemu_alloc_stack
|
||||
|
||||
@@ -2678,12 +2671,6 @@ if test "$xen_pci_passthrough" != "no"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$xen_pv_domain_build" = "yes" &&
|
||||
test "$xen" != "yes"; then
|
||||
error_exit "User requested Xen PV domain builder support" \
|
||||
"which requires Xen support."
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# Windows Hypervisor Platform accelerator (WHPX) check
|
||||
if test "$whpx" != "no" ; then
|
||||
@@ -6069,7 +6056,6 @@ fi
|
||||
echo "xen support $xen"
|
||||
if test "$xen" = "yes" ; then
|
||||
echo "xen ctrl version $xen_ctrl_version"
|
||||
echo "pv dom build $xen_pv_domain_build"
|
||||
fi
|
||||
echo "brlapi support $brlapi"
|
||||
echo "bluez support $bluez"
|
||||
@@ -6539,9 +6525,6 @@ fi
|
||||
if test "$xen" = "yes" ; then
|
||||
echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
|
||||
echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
|
||||
if test "$xen_pv_domain_build" = "yes" ; then
|
||||
echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak
|
||||
fi
|
||||
fi
|
||||
if test "$linux_aio" = "yes" ; then
|
||||
echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "hw/hw.h"
|
||||
#include "hw/9pfs/9p.h"
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/xen/xen-legacy-backend.h"
|
||||
#include "hw/9pfs/xen-9pfs.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/config-file.h"
|
||||
@@ -45,7 +45,7 @@ typedef struct Xen9pfsRing {
|
||||
} Xen9pfsRing;
|
||||
|
||||
typedef struct Xen9pfsDev {
|
||||
struct XenDevice xendev; /* must be first */
|
||||
struct XenLegacyDevice xendev; /* must be first */
|
||||
V9fsState state;
|
||||
char *path;
|
||||
char *security_model;
|
||||
@@ -56,7 +56,7 @@ typedef struct Xen9pfsDev {
|
||||
Xen9pfsRing *rings;
|
||||
} Xen9pfsDev;
|
||||
|
||||
static void xen_9pfs_disconnect(struct XenDevice *xendev);
|
||||
static void xen_9pfs_disconnect(struct XenLegacyDevice *xendev);
|
||||
|
||||
static void xen_9pfs_in_sg(Xen9pfsRing *ring,
|
||||
struct iovec *in_sg,
|
||||
@@ -243,7 +243,7 @@ static const V9fsTransport xen_9p_transport = {
|
||||
.push_and_notify = xen_9pfs_push_and_notify,
|
||||
};
|
||||
|
||||
static int xen_9pfs_init(struct XenDevice *xendev)
|
||||
static int xen_9pfs_init(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ static void xen_9pfs_evtchn_event(void *opaque)
|
||||
qemu_bh_schedule(ring->bh);
|
||||
}
|
||||
|
||||
static void xen_9pfs_disconnect(struct XenDevice *xendev)
|
||||
static void xen_9pfs_disconnect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
Xen9pfsDev *xen_9pdev = container_of(xendev, Xen9pfsDev, xendev);
|
||||
int i;
|
||||
@@ -321,7 +321,7 @@ static void xen_9pfs_disconnect(struct XenDevice *xendev)
|
||||
}
|
||||
}
|
||||
|
||||
static int xen_9pfs_free(struct XenDevice *xendev)
|
||||
static int xen_9pfs_free(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
Xen9pfsDev *xen_9pdev = container_of(xendev, Xen9pfsDev, xendev);
|
||||
int i;
|
||||
@@ -354,7 +354,7 @@ static int xen_9pfs_free(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int xen_9pfs_connect(struct XenDevice *xendev)
|
||||
static int xen_9pfs_connect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int i;
|
||||
@@ -467,7 +467,7 @@ out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void xen_9pfs_alloc(struct XenDevice *xendev)
|
||||
static void xen_9pfs_alloc(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
xenstore_write_be_str(xendev, "versions", VERSIONS);
|
||||
xenstore_write_be_int(xendev, "max-rings", MAX_RINGS);
|
||||
|
||||
@@ -4,7 +4,7 @@ common-obj-$(CONFIG_SSI_M25P80) += m25p80.o
|
||||
common-obj-$(CONFIG_NAND) += nand.o
|
||||
common-obj-$(CONFIG_PFLASH_CFI01) += pflash_cfi01.o
|
||||
common-obj-$(CONFIG_PFLASH_CFI02) += pflash_cfi02.o
|
||||
common-obj-$(CONFIG_XEN) += xen_disk.o
|
||||
common-obj-$(CONFIG_XEN) += xen-block.o
|
||||
common-obj-$(CONFIG_ECC) += ecc.o
|
||||
common-obj-$(CONFIG_ONENAND) += onenand.o
|
||||
common-obj-$(CONFIG_NVME_PCI) += nvme.o
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
obj-y += virtio-blk.o
|
||||
obj-$(CONFIG_XEN) += xen-block.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Citrix Systems Inc.
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef HW_BLOCK_DATAPLANE_XEN_BLOCK_H
|
||||
#define HW_BLOCK_DATAPLANE_XEN_BLOCK_H
|
||||
|
||||
#include "hw/block/block.h"
|
||||
#include "hw/xen/xen-bus.h"
|
||||
#include "sysemu/iothread.h"
|
||||
|
||||
typedef struct XenBlockDataPlane XenBlockDataPlane;
|
||||
|
||||
XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
|
||||
BlockConf *conf,
|
||||
IOThread *iothread);
|
||||
void xen_block_dataplane_destroy(XenBlockDataPlane *dataplane);
|
||||
void xen_block_dataplane_start(XenBlockDataPlane *dataplane,
|
||||
const unsigned int ring_ref[],
|
||||
unsigned int nr_ring_ref,
|
||||
unsigned int event_channel,
|
||||
unsigned int protocol,
|
||||
Error **errp);
|
||||
void xen_block_dataplane_stop(XenBlockDataPlane *dataplane);
|
||||
|
||||
#endif /* HW_BLOCK_DATAPLANE_XEN_BLOCK_H */
|
||||
@@ -127,3 +127,17 @@ xen_disk_init(char *name) "%s"
|
||||
xen_disk_connect(char *name) "%s"
|
||||
xen_disk_disconnect(char *name) "%s"
|
||||
xen_disk_free(char *name) "%s"
|
||||
|
||||
# hw/block/xen-block.c
|
||||
xen_block_realize(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
||||
xen_block_connect(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
||||
xen_block_disconnect(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
||||
xen_block_unrealize(const char *type, uint32_t disk, uint32_t partition) "%s d%up%u"
|
||||
xen_disk_realize(void) ""
|
||||
xen_disk_unrealize(void) ""
|
||||
xen_cdrom_realize(void) ""
|
||||
xen_cdrom_unrealize(void) ""
|
||||
xen_block_blockdev_add(char *str) "%s"
|
||||
xen_block_blockdev_del(const char *node_name) "%s"
|
||||
xen_block_device_create(unsigned int number) "%u"
|
||||
xen_block_device_destroy(unsigned int number) "%u"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
-1011
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "hw/hw.h"
|
||||
#include "chardev/char-fe.h"
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/xen/xen-legacy-backend.h"
|
||||
|
||||
#include <xen/io/console.h>
|
||||
|
||||
@@ -39,7 +39,7 @@ struct buffer {
|
||||
};
|
||||
|
||||
struct XenConsole {
|
||||
struct XenDevice xendev; /* must be first */
|
||||
struct XenLegacyDevice xendev; /* must be first */
|
||||
struct buffer buffer;
|
||||
char console[XEN_BUFSIZE];
|
||||
int ring_ref;
|
||||
@@ -173,7 +173,7 @@ static void xencons_send(struct XenConsole *con)
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
static int con_init(struct XenDevice *xendev)
|
||||
static int con_init(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
|
||||
char *type, *dom, label[32];
|
||||
@@ -222,7 +222,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int con_initialise(struct XenDevice *xendev)
|
||||
static int con_initialise(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
|
||||
int limit;
|
||||
@@ -259,7 +259,7 @@ static int con_initialise(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void con_disconnect(struct XenDevice *xendev)
|
||||
static void con_disconnect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
|
||||
|
||||
@@ -276,7 +276,7 @@ static void con_disconnect(struct XenDevice *xendev)
|
||||
}
|
||||
}
|
||||
|
||||
static void con_event(struct XenDevice *xendev)
|
||||
static void con_event(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
|
||||
|
||||
|
||||
+13
-12
@@ -30,7 +30,7 @@
|
||||
#include "hw/hw.h"
|
||||
#include "ui/input.h"
|
||||
#include "ui/console.h"
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/xen/xen-legacy-backend.h"
|
||||
|
||||
#include <xen/event_channel.h>
|
||||
#include <xen/io/fbif.h>
|
||||
@@ -46,7 +46,7 @@
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
struct common {
|
||||
struct XenDevice xendev; /* must be first */
|
||||
struct XenLegacyDevice xendev; /* must be first */
|
||||
void *page;
|
||||
};
|
||||
|
||||
@@ -342,14 +342,14 @@ static QemuInputHandler xenfb_rel_mouse = {
|
||||
.sync = xenfb_mouse_sync,
|
||||
};
|
||||
|
||||
static int input_init(struct XenDevice *xendev)
|
||||
static int input_init(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
xenstore_write_be_int(xendev, "feature-abs-pointer", 1);
|
||||
xenstore_write_be_int(xendev, "feature-raw-pointer", 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int input_initialise(struct XenDevice *xendev)
|
||||
static int input_initialise(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
|
||||
int rc;
|
||||
@@ -361,7 +361,7 @@ static int input_initialise(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void input_connected(struct XenDevice *xendev)
|
||||
static void input_connected(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
|
||||
|
||||
@@ -395,7 +395,7 @@ static void input_connected(struct XenDevice *xendev)
|
||||
}
|
||||
}
|
||||
|
||||
static void input_disconnect(struct XenDevice *xendev)
|
||||
static void input_disconnect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
|
||||
|
||||
@@ -410,7 +410,7 @@ static void input_disconnect(struct XenDevice *xendev)
|
||||
common_unbind(&in->c);
|
||||
}
|
||||
|
||||
static void input_event(struct XenDevice *xendev)
|
||||
static void input_event(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenInput *xenfb = container_of(xendev, struct XenInput, c.xendev);
|
||||
struct xenkbd_page *page = xenfb->c.page;
|
||||
@@ -867,7 +867,7 @@ static void xenfb_handle_events(struct XenFB *xenfb)
|
||||
page->out_cons = cons;
|
||||
}
|
||||
|
||||
static int fb_init(struct XenDevice *xendev)
|
||||
static int fb_init(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
#ifdef XENFB_TYPE_RESIZE
|
||||
xenstore_write_be_int(xendev, "feature-resize", 1);
|
||||
@@ -875,7 +875,7 @@ static int fb_init(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fb_initialise(struct XenDevice *xendev)
|
||||
static int fb_initialise(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev);
|
||||
struct xenfb_page *fb_page;
|
||||
@@ -912,7 +912,7 @@ static int fb_initialise(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void fb_disconnect(struct XenDevice *xendev)
|
||||
static void fb_disconnect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev);
|
||||
|
||||
@@ -935,7 +935,8 @@ static void fb_disconnect(struct XenDevice *xendev)
|
||||
fb->bug_trigger = 0;
|
||||
}
|
||||
|
||||
static void fb_frontend_changed(struct XenDevice *xendev, const char *node)
|
||||
static void fb_frontend_changed(struct XenLegacyDevice *xendev,
|
||||
const char *node)
|
||||
{
|
||||
struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev);
|
||||
|
||||
@@ -953,7 +954,7 @@ static void fb_frontend_changed(struct XenDevice *xendev, const char *node)
|
||||
}
|
||||
}
|
||||
|
||||
static void fb_event(struct XenDevice *xendev)
|
||||
static void fb_event(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenFB *xenfb = container_of(xendev, struct XenFB, c.xendev);
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
#include "hw/i386/pc.h"
|
||||
#include "hw/i386/apic-msidef.h"
|
||||
#include "hw/xen/xen_common.h"
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/xen/xen-legacy-backend.h"
|
||||
#include "hw/xen/xen-bus.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qemu/error-report.h"
|
||||
@@ -1484,6 +1485,8 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
|
||||
QLIST_INIT(&state->dev_list);
|
||||
device_listener_register(&state->device_listener);
|
||||
|
||||
xen_bus_init();
|
||||
|
||||
/* Initialize backend core & drivers */
|
||||
if (xen_be_init() != 0) {
|
||||
error_report("xen backend core setup failed");
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/xen/xen-legacy-backend.h"
|
||||
#include "qemu/bitmap.h"
|
||||
|
||||
#include <xen/hvm/params.h>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/xen/xen_common.h"
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/xen/xen-legacy-backend.h"
|
||||
#include "trace.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
|
||||
+7
-7
@@ -28,14 +28,14 @@
|
||||
#include "net/net.h"
|
||||
#include "net/checksum.h"
|
||||
#include "net/util.h"
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/xen/xen-legacy-backend.h"
|
||||
|
||||
#include <xen/io/netif.h>
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
struct XenNetDev {
|
||||
struct XenDevice xendev; /* must be first */
|
||||
struct XenLegacyDevice xendev; /* must be first */
|
||||
char *mac;
|
||||
int tx_work;
|
||||
int tx_ring_ref;
|
||||
@@ -276,7 +276,7 @@ static NetClientInfo net_xen_info = {
|
||||
.receive = net_rx_packet,
|
||||
};
|
||||
|
||||
static int net_init(struct XenDevice *xendev)
|
||||
static int net_init(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev);
|
||||
|
||||
@@ -308,7 +308,7 @@ static int net_init(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int net_connect(struct XenDevice *xendev)
|
||||
static int net_connect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev);
|
||||
int rx_copy;
|
||||
@@ -363,7 +363,7 @@ static int net_connect(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void net_disconnect(struct XenDevice *xendev)
|
||||
static void net_disconnect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev);
|
||||
|
||||
@@ -379,14 +379,14 @@ static void net_disconnect(struct XenDevice *xendev)
|
||||
}
|
||||
}
|
||||
|
||||
static void net_event(struct XenDevice *xendev)
|
||||
static void net_event(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev);
|
||||
net_tx_packets(netdev);
|
||||
qemu_flush_queued_packets(qemu_get_queue(netdev->nic));
|
||||
}
|
||||
|
||||
static int net_free(struct XenDevice *xendev)
|
||||
static int net_free(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev);
|
||||
|
||||
|
||||
+13
-12
@@ -27,7 +27,7 @@
|
||||
#include "qemu/option.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/usb.h"
|
||||
#include "hw/xen/xen_backend.h"
|
||||
#include "hw/xen/xen-legacy-backend.h"
|
||||
#include "monitor/qdev.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
@@ -99,7 +99,7 @@ struct usbback_hotplug {
|
||||
};
|
||||
|
||||
struct usbback_info {
|
||||
struct XenDevice xendev; /* must be first */
|
||||
struct XenLegacyDevice xendev; /* must be first */
|
||||
USBBus bus;
|
||||
void *urb_sring;
|
||||
void *conn_sring;
|
||||
@@ -142,7 +142,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req)
|
||||
unsigned int nr_segs, i, prot;
|
||||
uint32_t ref[USBIF_MAX_SEGMENTS_PER_REQUEST];
|
||||
struct usbback_info *usbif = usbback_req->usbif;
|
||||
struct XenDevice *xendev = &usbif->xendev;
|
||||
struct XenLegacyDevice *xendev = &usbif->xendev;
|
||||
struct usbif_request_segment *seg;
|
||||
void *addr;
|
||||
|
||||
@@ -220,7 +220,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req)
|
||||
|
||||
static int usbback_init_packet(struct usbback_req *usbback_req)
|
||||
{
|
||||
struct XenDevice *xendev = &usbback_req->usbif->xendev;
|
||||
struct XenLegacyDevice *xendev = &usbback_req->usbif->xendev;
|
||||
USBPacket *packet = &usbback_req->packet;
|
||||
USBDevice *dev = usbback_req->stub->dev;
|
||||
USBEndpoint *ep;
|
||||
@@ -279,7 +279,7 @@ static void usbback_do_response(struct usbback_req *usbback_req, int32_t status,
|
||||
{
|
||||
struct usbback_info *usbif;
|
||||
struct usbif_urb_response *res;
|
||||
struct XenDevice *xendev;
|
||||
struct XenLegacyDevice *xendev;
|
||||
unsigned int notify;
|
||||
|
||||
usbif = usbback_req->usbif;
|
||||
@@ -824,7 +824,7 @@ static void usbback_process_port(struct usbback_info *usbif, unsigned port)
|
||||
g_free(busid);
|
||||
}
|
||||
|
||||
static void usbback_disconnect(struct XenDevice *xendev)
|
||||
static void usbback_disconnect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct usbback_info *usbif;
|
||||
unsigned int i;
|
||||
@@ -853,7 +853,7 @@ static void usbback_disconnect(struct XenDevice *xendev)
|
||||
TR_BUS(xendev, "finished\n");
|
||||
}
|
||||
|
||||
static int usbback_connect(struct XenDevice *xendev)
|
||||
static int usbback_connect(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct usbback_info *usbif;
|
||||
struct usbif_urb_sring *urb_sring;
|
||||
@@ -913,7 +913,8 @@ static int usbback_connect(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void usbback_backend_changed(struct XenDevice *xendev, const char *node)
|
||||
static void usbback_backend_changed(struct XenLegacyDevice *xendev,
|
||||
const char *node)
|
||||
{
|
||||
struct usbback_info *usbif;
|
||||
unsigned int i;
|
||||
@@ -926,7 +927,7 @@ static void usbback_backend_changed(struct XenDevice *xendev, const char *node)
|
||||
}
|
||||
}
|
||||
|
||||
static int usbback_init(struct XenDevice *xendev)
|
||||
static int usbback_init(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct usbback_info *usbif;
|
||||
|
||||
@@ -1005,7 +1006,7 @@ static USBPortOps xen_usb_port_ops = {
|
||||
static USBBusOps xen_usb_bus_ops = {
|
||||
};
|
||||
|
||||
static void usbback_alloc(struct XenDevice *xendev)
|
||||
static void usbback_alloc(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct usbback_info *usbif;
|
||||
USBPort *p;
|
||||
@@ -1027,7 +1028,7 @@ static void usbback_alloc(struct XenDevice *xendev)
|
||||
usbif->bh = qemu_bh_new(usbback_bh, usbif);
|
||||
}
|
||||
|
||||
static int usbback_free(struct XenDevice *xendev)
|
||||
static int usbback_free(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct usbback_info *usbif;
|
||||
struct usbback_req *usbback_req;
|
||||
@@ -1066,7 +1067,7 @@ static int usbback_free(struct XenDevice *xendev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void usbback_event(struct XenDevice *xendev)
|
||||
static void usbback_event(struct XenLegacyDevice *xendev)
|
||||
{
|
||||
struct usbback_info *usbif;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# xen backend driver support
|
||||
common-obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o xen_pvdev.o xen-common.o
|
||||
common-obj-$(CONFIG_XEN) += xen-legacy-backend.o xen_devconfig.o xen_pvdev.o xen-common.o xen-bus.o xen-bus-helper.o xen-backend.o
|
||||
|
||||
obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
|
||||
obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
|
||||
|
||||
@@ -12,3 +12,29 @@ xen_unmap_portio_range(uint32_t id, uint64_t start_addr, uint64_t end_addr) "id:
|
||||
xen_map_pcidev(uint32_t id, uint8_t bus, uint8_t dev, uint8_t func) "id: %u bdf: %02x.%02x.%02x"
|
||||
xen_unmap_pcidev(uint32_t id, uint8_t bus, uint8_t dev, uint8_t func) "id: %u bdf: %02x.%02x.%02x"
|
||||
xen_domid_restrict(int err) "err: %u"
|
||||
|
||||
# include/hw/xen/xen-bus.c
|
||||
xen_bus_realize(void) ""
|
||||
xen_bus_unrealize(void) ""
|
||||
xen_bus_enumerate(void) ""
|
||||
xen_bus_type_enumerate(const char *type) "type: %s"
|
||||
xen_bus_backend_create(const char *type, const char *path) "type: %s path: %s"
|
||||
xen_bus_add_watch(const char *node, const char *key, char *token) "node: %s key: %s token: %s"
|
||||
xen_bus_remove_watch(const char *node, const char *key, char *token) "node: %s key: %s token: %s"
|
||||
xen_bus_watch(const char *token) "token: %s"
|
||||
xen_device_realize(const char *type, char *name) "type: %s name: %s"
|
||||
xen_device_unrealize(const char *type, char *name) "type: %s name: %s"
|
||||
xen_device_backend_state(const char *type, char *name, const char *state) "type: %s name: %s -> %s"
|
||||
xen_device_backend_online(const char *type, char *name, bool online) "type: %s name: %s -> %u"
|
||||
xen_device_backend_changed(const char *type, char *name) "type: %s name: %s"
|
||||
xen_device_frontend_state(const char *type, char *name, const char *state) "type: %s name: %s -> %s"
|
||||
xen_device_frontend_changed(const char *type, char *name) "type: %s name: %s"
|
||||
xen_device_unplug(const char *type, char *name) "type: %s name: %s"
|
||||
|
||||
# include/hw/xen/xen-bus-helper.c
|
||||
xs_node_create(const char *node) "%s"
|
||||
xs_node_destroy(const char *node) "%s"
|
||||
xs_node_vprintf(char *path, char *value) "%s %s"
|
||||
xs_node_vscanf(char *path, char *value) "%s %s"
|
||||
xs_node_watch(char *path) "%s"
|
||||
xs_node_unwatch(char *path) "%s"
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Citrix Systems Inc.
|
||||
*
|
||||
* 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 "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/xen/xen-backend.h"
|
||||
#include "hw/xen/xen-bus.h"
|
||||
|
||||
typedef struct XenBackendImpl {
|
||||
const char *type;
|
||||
XenBackendDeviceCreate create;
|
||||
XenBackendDeviceDestroy destroy;
|
||||
} XenBackendImpl;
|
||||
|
||||
struct XenBackendInstance {
|
||||
QLIST_ENTRY(XenBackendInstance) entry;
|
||||
const XenBackendImpl *impl;
|
||||
XenBus *xenbus;
|
||||
char *name;
|
||||
XenDevice *xendev;
|
||||
};
|
||||
|
||||
static GHashTable *xen_backend_table_get(void)
|
||||
{
|
||||
static GHashTable *table;
|
||||
|
||||
if (table == NULL) {
|
||||
table = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
static void xen_backend_table_add(XenBackendImpl *impl)
|
||||
{
|
||||
g_hash_table_insert(xen_backend_table_get(), (void *)impl->type, impl);
|
||||
}
|
||||
|
||||
static const XenBackendImpl *xen_backend_table_lookup(const char *type)
|
||||
{
|
||||
return g_hash_table_lookup(xen_backend_table_get(), type);
|
||||
}
|
||||
|
||||
void xen_backend_register(const XenBackendInfo *info)
|
||||
{
|
||||
XenBackendImpl *impl = g_new0(XenBackendImpl, 1);
|
||||
|
||||
g_assert(info->type);
|
||||
|
||||
if (xen_backend_table_lookup(info->type)) {
|
||||
error_report("attempt to register duplicate Xen backend type '%s'",
|
||||
info->type);
|
||||
abort();
|
||||
}
|
||||
|
||||
if (!info->create) {
|
||||
error_report("backend type '%s' has no creator", info->type);
|
||||
abort();
|
||||
}
|
||||
|
||||
impl->type = info->type;
|
||||
impl->create = info->create;
|
||||
impl->destroy = info->destroy;
|
||||
|
||||
xen_backend_table_add(impl);
|
||||
}
|
||||
|
||||
static QLIST_HEAD(, XenBackendInstance) backend_list;
|
||||
|
||||
static void xen_backend_list_add(XenBackendInstance *backend)
|
||||
{
|
||||
QLIST_INSERT_HEAD(&backend_list, backend, entry);
|
||||
}
|
||||
|
||||
static XenBackendInstance *xen_backend_list_find(XenDevice *xendev)
|
||||
{
|
||||
XenBackendInstance *backend;
|
||||
|
||||
QLIST_FOREACH(backend, &backend_list, entry) {
|
||||
if (backend->xendev == xendev) {
|
||||
return backend;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void xen_backend_list_remove(XenBackendInstance *backend)
|
||||
{
|
||||
QLIST_REMOVE(backend, entry);
|
||||
}
|
||||
|
||||
void xen_backend_device_create(XenBus *xenbus, const char *type,
|
||||
const char *name, QDict *opts, Error **errp)
|
||||
{
|
||||
const XenBackendImpl *impl = xen_backend_table_lookup(type);
|
||||
XenBackendInstance *backend;
|
||||
Error *local_error = NULL;
|
||||
|
||||
if (!impl) {
|
||||
return;
|
||||
}
|
||||
|
||||
backend = g_new0(XenBackendInstance, 1);
|
||||
backend->xenbus = xenbus;
|
||||
backend->name = g_strdup(name);
|
||||
|
||||
impl->create(backend, opts, &local_error);
|
||||
if (local_error) {
|
||||
error_propagate(errp, local_error);
|
||||
g_free(backend->name);
|
||||
g_free(backend);
|
||||
return;
|
||||
}
|
||||
|
||||
backend->impl = impl;
|
||||
xen_backend_list_add(backend);
|
||||
}
|
||||
|
||||
XenBus *xen_backend_get_bus(XenBackendInstance *backend)
|
||||
{
|
||||
return backend->xenbus;
|
||||
}
|
||||
|
||||
const char *xen_backend_get_name(XenBackendInstance *backend)
|
||||
{
|
||||
return backend->name;
|
||||
}
|
||||
|
||||
void xen_backend_set_device(XenBackendInstance *backend,
|
||||
XenDevice *xendev)
|
||||
{
|
||||
g_assert(!backend->xendev);
|
||||
backend->xendev = xendev;
|
||||
}
|
||||
|
||||
XenDevice *xen_backend_get_device(XenBackendInstance *backend)
|
||||
{
|
||||
return backend->xendev;
|
||||
}
|
||||
|
||||
|
||||
bool xen_backend_try_device_destroy(XenDevice *xendev, Error **errp)
|
||||
{
|
||||
XenBackendInstance *backend = xen_backend_list_find(xendev);
|
||||
const XenBackendImpl *impl;
|
||||
|
||||
if (!backend) {
|
||||
return false;
|
||||
}
|
||||
|
||||
impl = backend->impl;
|
||||
impl->destroy(backend, errp);
|
||||
|
||||
xen_backend_list_remove(backend);
|
||||
g_free(backend->name);
|
||||
g_free(backend);
|
||||
|
||||
return true;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user