aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAurelien Chartier <aurelien.chartier@citrix.com>2013-05-28 13:09:55 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-05-29 09:04:20 -0400
commit33c1174bae3ea8f420abce53cf8aded778987583 (patch)
tree74a458af2d4b164d6ff8bb2149a23775a12e4411 /drivers
parent2abb274629614bef4044a0b98ada42e977feadfd (diff)
xenbus: save xenstore local status for later use
Save the xenstore local status computed in xenbus_init. It can then be used later to check if xenstored is running in this domain. Signed-off-by: Aurelien Chartier <aurelien.chartier@citrix.com> [Changes in v4: - Change variable name to xen_store_domain_type] Reviewed-by: David Vrabel <david.vrabel@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/xen/xenbus/xenbus_comms.h1
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c27
-rw-r--r--drivers/xen/xenbus/xenbus_probe.h7
3 files changed, 20 insertions, 15 deletions
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
index c8abd3b8a6c4..e74f9c1fbd80 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);
45int xs_input_avail(void); 45int xs_input_avail(void);
46extern struct xenstore_domain_interface *xen_store_interface; 46extern struct xenstore_domain_interface *xen_store_interface;
47extern int xen_store_evtchn; 47extern int xen_store_evtchn;
48extern enum xenstore_init xen_store_domain_type;
48 49
49extern const struct file_operations xen_xenbus_fops; 50extern const struct file_operations xen_xenbus_fops;
50 51
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 3325884c693f..56cfaaa9d006 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);
69struct xenstore_domain_interface *xen_store_interface; 69struct xenstore_domain_interface *xen_store_interface;
70EXPORT_SYMBOL_GPL(xen_store_interface); 70EXPORT_SYMBOL_GPL(xen_store_interface);
71 71
72enum xenstore_init xen_store_domain_type;
73EXPORT_SYMBOL_GPL(xen_store_domain_type);
74
72static unsigned long xen_store_mfn; 75static unsigned long xen_store_mfn;
73 76
74static BLOCKING_NOTIFIER_HEAD(xenstore_chain); 77static BLOCKING_NOTIFIER_HEAD(xenstore_chain);
@@ -719,17 +722,11 @@ static int __init xenstored_local_init(void)
719 return err; 722 return err;
720} 723}
721 724
722enum xenstore_init {
723 UNKNOWN,
724 PV,
725 HVM,
726 LOCAL,
727};
728static int __init xenbus_init(void) 725static int __init xenbus_init(void)
729{ 726{
730 int err = 0; 727 int err = 0;
731 enum xenstore_init usage = UNKNOWN;
732 uint64_t v = 0; 728 uint64_t v = 0;
729 xen_store_domain_type = XS_UNKNOWN;
733 730
734 if (!xen_domain()) 731 if (!xen_domain())
735 return -ENODEV; 732 return -ENODEV;
@@ -737,29 +734,29 @@ static int __init xenbus_init(void)
737 xenbus_ring_ops_init(); 734 xenbus_ring_ops_init();
738 735
739 if (xen_pv_domain()) 736 if (xen_pv_domain())
740 usage = PV; 737 xen_store_domain_type = XS_PV;
741 if (xen_hvm_domain()) 738 if (xen_hvm_domain())
742 usage = HVM; 739 xen_store_domain_type = XS_HVM;
743 if (xen_hvm_domain() && xen_initial_domain()) 740 if (xen_hvm_domain() && xen_initial_domain())
744 usage = LOCAL; 741 xen_store_domain_type = XS_LOCAL;
745 if (xen_pv_domain() && !xen_start_info->store_evtchn) 742 if (xen_pv_domain() && !xen_start_info->store_evtchn)
746 usage = LOCAL; 743 xen_store_domain_type = XS_LOCAL;
747 if (xen_pv_domain() && xen_start_info->store_evtchn) 744 if (xen_pv_domain() && xen_start_info->store_evtchn)
748 xenstored_ready = 1; 745 xenstored_ready = 1;
749 746
750 switch (usage) { 747 switch (xen_store_domain_type) {
751 case LOCAL: 748 case XS_LOCAL:
752 err = xenstored_local_init(); 749 err = xenstored_local_init();
753 if (err) 750 if (err)
754 goto out_error; 751 goto out_error;
755 xen_store_interface = mfn_to_virt(xen_store_mfn); 752 xen_store_interface = mfn_to_virt(xen_store_mfn);
756 break; 753 break;
757 case PV: 754 case XS_PV:
758 xen_store_evtchn = xen_start_info->store_evtchn; 755 xen_store_evtchn = xen_start_info->store_evtchn;
759 xen_store_mfn = xen_start_info->store_mfn; 756 xen_store_mfn = xen_start_info->store_mfn;
760 xen_store_interface = mfn_to_virt(xen_store_mfn); 757 xen_store_interface = mfn_to_virt(xen_store_mfn);
761 break; 758 break;
762 case HVM: 759 case XS_HVM:
763 err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v); 760 err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v);
764 if (err) 761 if (err)
765 goto out_error; 762 goto out_error;
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h
index bb4f92ed8730..146f857a36f8 100644
--- a/drivers/xen/xenbus/xenbus_probe.h
+++ b/drivers/xen/xenbus/xenbus_probe.h
@@ -47,6 +47,13 @@ struct xen_bus_type {
47 struct bus_type bus; 47 struct bus_type bus;
48}; 48};
49 49
50enum xenstore_init {
51 XS_UNKNOWN,
52 XS_PV,
53 XS_HVM,
54 XS_LOCAL,
55};
56
50extern struct device_attribute xenbus_dev_attrs[]; 57extern struct device_attribute xenbus_dev_attrs[];
51 58
52extern int xenbus_match(struct device *_dev, struct device_driver *_drv); 59extern int xenbus_match(struct device *_dev, struct device_driver *_drv);