From: Aurelien Chartier <aurelien.chartier@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Aurelien Chartier <aurelien.chartier@citrix.com>,
stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com,
JBeulich@suse.com, konrad.wilk@oracle.com
Subject: [PATCH V3 1/2] xenbus: save xenstore local status for later use
Date: Mon, 13 May 2013 14:13:12 +0100 [thread overview]
Message-ID: <1368450793-10030-2-git-send-email-aurelien.chartier@citrix.com> (raw)
In-Reply-To: <1368450793-10030-1-git-send-email-aurelien.chartier@citrix.com>
Save the xenstore local status computed in xenbus_init. It can then be used
later to check if xenstored is running in that domain
Signed-off-by: Aurelien Chartier <aurelien.chartier@citrix.com>
---
drivers/xen/xenbus/xenbus_comms.h | 1 +
drivers/xen/xenbus/xenbus_probe.c | 27 ++++++++++++---------------
drivers/xen/xenbus/xenbus_probe.h | 7 +++++++
3 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
index c8abd3b..be329a1 100644
--- a/drivers/xen/xenbus/xenbus_comms.h
+++ b/drivers/xen/xenbus/xenbus_comms.h
@@ -45,6 +45,7 @@ int xb_wait_for_data_to_read(void);
int xs_input_avail(void);
extern struct xenstore_domain_interface *xen_store_interface;
extern int xen_store_evtchn;
+extern enum xenstore_init xen_store_domain;
extern const struct file_operations xen_xenbus_fops;
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 3325884..c3375ba 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -69,6 +69,9 @@ EXPORT_SYMBOL_GPL(xen_store_evtchn);
struct xenstore_domain_interface *xen_store_interface;
EXPORT_SYMBOL_GPL(xen_store_interface);
+enum xenstore_init xen_store_domain;
+EXPORT_SYMBOL_GPL(xen_store_domain);
+
static unsigned long xen_store_mfn;
static BLOCKING_NOTIFIER_HEAD(xenstore_chain);
@@ -719,17 +722,11 @@ static int __init xenstored_local_init(void)
return err;
}
-enum xenstore_init {
- UNKNOWN,
- PV,
- HVM,
- LOCAL,
-};
static int __init xenbus_init(void)
{
int err = 0;
- enum xenstore_init usage = UNKNOWN;
uint64_t v = 0;
+ xen_store_domain = XS_UNKNOWN;
if (!xen_domain())
return -ENODEV;
@@ -737,29 +734,29 @@ static int __init xenbus_init(void)
xenbus_ring_ops_init();
if (xen_pv_domain())
- usage = PV;
+ xen_store_domain = XS_PV;
if (xen_hvm_domain())
- usage = HVM;
+ xen_store_domain = XS_HVM;
if (xen_hvm_domain() && xen_initial_domain())
- usage = LOCAL;
+ xen_store_domain = XS_LOCAL;
if (xen_pv_domain() && !xen_start_info->store_evtchn)
- usage = LOCAL;
+ xen_store_domain = XS_LOCAL;
if (xen_pv_domain() && xen_start_info->store_evtchn)
xenstored_ready = 1;
- switch (usage) {
- case LOCAL:
+ switch (xen_store_domain) {
+ case XS_LOCAL:
err = xenstored_local_init();
if (err)
goto out_error;
xen_store_interface = mfn_to_virt(xen_store_mfn);
break;
- case PV:
+ case XS_PV:
xen_store_evtchn = xen_start_info->store_evtchn;
xen_store_mfn = xen_start_info->store_mfn;
xen_store_interface = mfn_to_virt(xen_store_mfn);
break;
- case HVM:
+ case XS_HVM:
err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v);
if (err)
goto out_error;
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h
index bb4f92e..146f857 100644
--- a/drivers/xen/xenbus/xenbus_probe.h
+++ b/drivers/xen/xenbus/xenbus_probe.h
@@ -47,6 +47,13 @@ struct xen_bus_type {
struct bus_type bus;
};
+enum xenstore_init {
+ XS_UNKNOWN,
+ XS_PV,
+ XS_HVM,
+ XS_LOCAL,
+};
+
extern struct device_attribute xenbus_dev_attrs[];
extern int xenbus_match(struct device *_dev, struct device_driver *_drv);
--
1.7.10.4
next prev parent reply other threads:[~2013-05-13 13:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-13 13:13 [PATCH V3 0/2] xenbus: Fix S3 frontend resume when xenstored is not running Aurelien Chartier
2013-05-13 13:13 ` Aurelien Chartier [this message]
2013-05-14 10:17 ` [PATCH V3 1/2] xenbus: save xenstore local status for later use David Vrabel
2013-05-14 13:07 ` Aurelien Chartier
2013-05-13 13:13 ` [PATCH V3 2/2] xenbus: delay xenbus frontend resume is xenstored is not running Aurelien Chartier
2013-05-14 10:09 ` David Vrabel
2013-05-14 13:04 ` Aurelien Chartier
2013-05-14 13:38 ` David Vrabel
2013-05-14 13:54 ` Aurelien Chartier
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=1368450793-10030-2-git-send-email-aurelien.chartier@citrix.com \
--to=aurelien.chartier@citrix.com \
--cc=JBeulich@suse.com \
--cc=ian.campbell@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.