From: Stefano Stabellini <sstabellini@kernel.org>
To: stefanha@gmail.com
Cc: stefanha@redhat.com, peter.maydell@linaro.org,
sstabellini@kernel.org, anthony.perard@citrix.com,
xen-devel@lists.xenproject.org, qemu-devel@nongnu.org,
Juergen Gross <jgross@suse.com>
Subject: [Qemu-devel] [PULL 2/5] xen: add an own bus for xen backend devices
Date: Tue, 22 Nov 2016 10:46:06 -0800 [thread overview]
Message-ID: <1479840369-19503-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1479840369-19503-1-git-send-email-sstabellini@kernel.org>
From: Juergen Gross <jgross@suse.com>
Add a bus for Xen backend devices in order to be able to establish a
dedicated device path for pluggable devices.
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
---
hw/xen/xen_backend.c | 19 ++++++++++++++++---
include/hw/xen/xen_backend.h | 4 ++++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index 41ba5c5..5ad3caa 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -29,14 +29,14 @@
#include "hw/sysbus.h"
#include "sysemu/char.h"
#include "qemu/log.h"
+#include "qapi/error.h"
#include "hw/xen/xen_backend.h"
#include "hw/xen/xen_pvdev.h"
#include <xen/grant_table.h>
-#define TYPE_XENSYSDEV "xensysdev"
-
DeviceState *xen_sysdev;
+BusState *xen_sysbus;
/* ------------------------------------------------------------- */
@@ -528,6 +528,8 @@ int xen_be_init(void)
xen_sysdev = qdev_create(NULL, TYPE_XENSYSDEV);
qdev_init_nofail(xen_sysdev);
+ xen_sysbus = qbus_create(TYPE_XENSYSBUS, DEVICE(xen_sysdev), "xen-sysbus");
+ qbus_set_bus_hotplug_handler(xen_sysbus, &error_abort);
return 0;
@@ -586,6 +588,15 @@ int xen_be_bind_evtchn(struct XenDevice *xendev)
}
+static const TypeInfo xensysbus_info = {
+ .name = TYPE_XENSYSBUS,
+ .parent = TYPE_BUS,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { }
+ }
+};
+
static int xen_sysdev_init(SysBusDevice *dev)
{
return 0;
@@ -602,6 +613,7 @@ static void xen_sysdev_class_init(ObjectClass *klass, void *data)
k->init = xen_sysdev_init;
dc->props = xen_sysdev_properties;
+ dc->bus_type = TYPE_XENSYSBUS;
}
static const TypeInfo xensysdev_info = {
@@ -613,7 +625,8 @@ static const TypeInfo xensysdev_info = {
static void xenbe_register_types(void)
{
+ type_register_static(&xensysbus_info);
type_register_static(&xensysdev_info);
}
-type_init(xenbe_register_types);
+type_init(xenbe_register_types)
diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h
index cbda40e..38f730e 100644
--- a/include/hw/xen/xen_backend.h
+++ b/include/hw/xen/xen_backend.h
@@ -6,12 +6,16 @@
#include "sysemu/sysemu.h"
#include "net/net.h"
+#define TYPE_XENSYSDEV "xen-sysdev"
+#define TYPE_XENSYSBUS "xen-sysbus"
+
/* variables */
extern xc_interface *xen_xc;
extern xenforeignmemory_handle *xen_fmem;
extern struct xs_handle *xenstore;
extern const char *xen_protocol;
extern DeviceState *xen_sysdev;
+extern BusState *xen_sysbus;
int xenstore_mkdir(char *path, int p);
int xenstore_write_be_str(struct XenDevice *xendev, const char *node, const char *val);
--
1.9.1
next prev parent reply other threads:[~2016-11-22 18:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 18:45 [Qemu-devel] [PULL 0/5] xen-20161122-tag Stefano Stabellini
2016-11-22 18:46 ` [Qemu-devel] [PULL 1/5] xen: fix ioreq handling Stefano Stabellini
2016-11-22 18:46 ` Stefano Stabellini [this message]
2016-11-22 18:46 ` [Qemu-devel] [PULL 3/5] qdev: add function qdev_set_id() Stefano Stabellini
2016-11-22 18:46 ` [Qemu-devel] [PULL 4/5] xen: create qdev for each backend device Stefano Stabellini
2016-11-22 18:46 ` [Qemu-devel] [PULL 5/5] xen: attach pvusb usb bus to backend qdev Stefano Stabellini
2016-11-22 19:31 ` [Qemu-devel] [PULL 0/5] xen-20161122-tag Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479840369-19503-2-git-send-email-sstabellini@kernel.org \
--to=sstabellini@kernel.org \
--cc=anthony.perard@citrix.com \
--cc=jgross@suse.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).