diff options
| -rw-r--r-- | drivers/xen/xenbus/xenbus_comms.h | 1 | ||||
| -rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 27 | ||||
| -rw-r--r-- | 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 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); | |||
| 45 | int xs_input_avail(void); | 45 | int xs_input_avail(void); |
| 46 | extern struct xenstore_domain_interface *xen_store_interface; | 46 | extern struct xenstore_domain_interface *xen_store_interface; |
| 47 | extern int xen_store_evtchn; | 47 | extern int xen_store_evtchn; |
| 48 | extern enum xenstore_init xen_store_domain_type; | ||
| 48 | 49 | ||
| 49 | extern const struct file_operations xen_xenbus_fops; | 50 | extern 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); | |||
| 69 | struct xenstore_domain_interface *xen_store_interface; | 69 | struct xenstore_domain_interface *xen_store_interface; |
| 70 | EXPORT_SYMBOL_GPL(xen_store_interface); | 70 | EXPORT_SYMBOL_GPL(xen_store_interface); |
| 71 | 71 | ||
| 72 | enum xenstore_init xen_store_domain_type; | ||
| 73 | EXPORT_SYMBOL_GPL(xen_store_domain_type); | ||
| 74 | |||
| 72 | static unsigned long xen_store_mfn; | 75 | static unsigned long xen_store_mfn; |
| 73 | 76 | ||
| 74 | static BLOCKING_NOTIFIER_HEAD(xenstore_chain); | 77 | static 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 | ||
| 722 | enum xenstore_init { | ||
| 723 | UNKNOWN, | ||
| 724 | PV, | ||
| 725 | HVM, | ||
| 726 | LOCAL, | ||
| 727 | }; | ||
| 728 | static int __init xenbus_init(void) | 725 | static 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 | ||
| 50 | enum xenstore_init { | ||
| 51 | XS_UNKNOWN, | ||
| 52 | XS_PV, | ||
| 53 | XS_HVM, | ||
| 54 | XS_LOCAL, | ||
| 55 | }; | ||
| 56 | |||
| 50 | extern struct device_attribute xenbus_dev_attrs[]; | 57 | extern struct device_attribute xenbus_dev_attrs[]; |
| 51 | 58 | ||
| 52 | extern int xenbus_match(struct device *_dev, struct device_driver *_drv); | 59 | extern int xenbus_match(struct device *_dev, struct device_driver *_drv); |
