direct-io.hg

changeset 11083:e061f14161b0

[XENBUS] Avoid direct use of xen_start_info. It's unevailable when
building as a separate driver for an HVM guest.
Signed-off-by: Steven Smith <ssmith@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Aug 14 14:17:26 2006 +0100 (2006-08-14)
parents 9519445d9e9d
children d8338b28bcd6
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Mon Aug 14 13:55:17 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Mon Aug 14 14:17:26 2006 +0100
     1.3 @@ -47,11 +47,6 @@ static DECLARE_WORK(probe_work, xenbus_p
     1.4  
     1.5  DECLARE_WAIT_QUEUE_HEAD(xb_waitq);
     1.6  
     1.7 -static inline struct xenstore_domain_interface *xenstore_domain_interface(void)
     1.8 -{
     1.9 -	return mfn_to_virt(xen_start_info->store_mfn);
    1.10 -}
    1.11 -
    1.12  static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
    1.13  {
    1.14  	if (unlikely(xenstored_ready == 0)) {
    1.15 @@ -90,7 +85,7 @@ static const void *get_input_chunk(XENST
    1.16  
    1.17  int xb_write(const void *data, unsigned len)
    1.18  {
    1.19 -	struct xenstore_domain_interface *intf = xenstore_domain_interface();
    1.20 +	struct xenstore_domain_interface *intf = xen_store_interface;
    1.21  	XENSTORE_RING_IDX cons, prod;
    1.22  	int rc;
    1.23  
    1.24 @@ -129,7 +124,7 @@ int xb_write(const void *data, unsigned 
    1.25  		intf->req_prod += avail;
    1.26  
    1.27  		/* This implies mb() before other side sees interrupt. */
    1.28 -		notify_remote_via_evtchn(xen_start_info->store_evtchn);
    1.29 +		notify_remote_via_evtchn(xen_store_evtchn);
    1.30  	}
    1.31  
    1.32  	return 0;
    1.33 @@ -137,7 +132,7 @@ int xb_write(const void *data, unsigned 
    1.34  
    1.35  int xb_read(void *data, unsigned len)
    1.36  {
    1.37 -	struct xenstore_domain_interface *intf = xenstore_domain_interface();
    1.38 +	struct xenstore_domain_interface *intf = xen_store_interface;
    1.39  	XENSTORE_RING_IDX cons, prod;
    1.40  	int rc;
    1.41  
    1.42 @@ -180,7 +175,7 @@ int xb_read(void *data, unsigned len)
    1.43  		pr_debug("Finished read of %i bytes (%i to go)\n", avail, len);
    1.44  
    1.45  		/* Implies mb(): they will see new header. */
    1.46 -		notify_remote_via_evtchn(xen_start_info->store_evtchn);
    1.47 +		notify_remote_via_evtchn(xen_store_evtchn);
    1.48  	}
    1.49  
    1.50  	return 0;
    1.51 @@ -195,7 +190,7 @@ int xb_init_comms(void)
    1.52  		unbind_from_irqhandler(xenbus_irq, &xb_waitq);
    1.53  
    1.54  	err = bind_evtchn_to_irqhandler(
    1.55 -		xen_start_info->store_evtchn, wake_waiting,
    1.56 +		xen_store_evtchn, wake_waiting,
    1.57  		0, "xenbus", &xb_waitq);
    1.58  	if (err <= 0) {
    1.59  		printk(KERN_ERR "XENBUS request irq failed %i\n", err);
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h	Mon Aug 14 13:55:17 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h	Mon Aug 14 14:17:26 2006 +0100
     2.3 @@ -39,5 +39,7 @@ int xb_write(const void *data, unsigned 
     2.4  int xb_read(void *data, unsigned len);
     2.5  int xs_input_avail(void);
     2.6  extern wait_queue_head_t xb_waitq;
     2.7 +extern struct xenstore_domain_interface *xen_store_interface;
     2.8 +extern int xen_store_evtchn;
     2.9  
    2.10  #endif /* _XENBUS_COMMS_H */
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Mon Aug 14 13:55:17 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Mon Aug 14 14:17:26 2006 +0100
     3.3 @@ -285,7 +285,7 @@ static int xenbus_dev_open(struct inode 
     3.4  {
     3.5  	struct xenbus_dev_data *u;
     3.6  
     3.7 -	if (xen_start_info->store_evtchn == 0)
     3.8 +	if (xen_store_evtchn == 0)
     3.9  		return -ENOENT;
    3.10  
    3.11  	nonseekable_open(inode, filp);
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Mon Aug 14 13:55:17 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Mon Aug 14 14:17:26 2006 +0100
     4.3 @@ -54,6 +54,10 @@
     4.4  
     4.5  #include "xenbus_comms.h"
     4.6  
     4.7 +int xen_store_evtchn;
     4.8 +struct xenstore_domain_interface *xen_store_interface;
     4.9 +static unsigned long xen_store_mfn;
    4.10 +
    4.11  extern struct mutex xenwatch_mutex;
    4.12  
    4.13  static struct notifier_block *xenstore_chain;
    4.14 @@ -928,8 +932,7 @@ static int xsd_kva_mmap(struct file *fil
    4.15  	if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
    4.16  		return -EINVAL;
    4.17  
    4.18 -	if (remap_pfn_range(vma, vma->vm_start,
    4.19 -			    mfn_to_pfn(xen_start_info->store_mfn),
    4.20 +	if (remap_pfn_range(vma, vma->vm_start, mfn_to_pfn(xen_store_mfn),
    4.21  			    size, vma->vm_page_prot))
    4.22  		return -EAGAIN;
    4.23  
    4.24 @@ -941,7 +944,7 @@ static int xsd_kva_read(char *page, char
    4.25  {
    4.26  	int len;
    4.27  
    4.28 -	len  = sprintf(page, "0x%p", mfn_to_virt(xen_start_info->store_mfn));
    4.29 +	len  = sprintf(page, "0x%p", xen_store_interface);
    4.30  	*eof = 1;
    4.31  	return len;
    4.32  }
    4.33 @@ -951,13 +954,12 @@ static int xsd_port_read(char *page, cha
    4.34  {
    4.35  	int len;
    4.36  
    4.37 -	len  = sprintf(page, "%d", xen_start_info->store_evtchn);
    4.38 +	len  = sprintf(page, "%d", xen_store_evtchn);
    4.39  	*eof = 1;
    4.40  	return len;
    4.41  }
    4.42  #endif
    4.43  
    4.44 -
    4.45  static int __init xenbus_probe_init(void)
    4.46  {
    4.47  	int err = 0, dom0;
    4.48 @@ -985,7 +987,7 @@ static int __init xenbus_probe_init(void
    4.49  		if (!page)
    4.50  			return -ENOMEM;
    4.51  
    4.52 -		xen_start_info->store_mfn =
    4.53 +		xen_store_mfn = xen_start_info->store_mfn =
    4.54  			pfn_to_mfn(virt_to_phys((void *)page) >>
    4.55  				   PAGE_SHIFT);
    4.56  
    4.57 @@ -998,7 +1000,8 @@ static int __init xenbus_probe_init(void
    4.58  		if (err == -ENOSYS)
    4.59  			goto err;
    4.60  		BUG_ON(err);
    4.61 -		xen_start_info->store_evtchn = alloc_unbound.port;
    4.62 +		xen_store_evtchn = xen_start_info->store_evtchn =
    4.63 +			alloc_unbound.port;
    4.64  
    4.65  #ifdef CONFIG_PROC_FS
    4.66  		/* And finally publish the above info in /proc/xen */
    4.67 @@ -1014,8 +1017,13 @@ static int __init xenbus_probe_init(void
    4.68  		if (xsd_port_intf)
    4.69  			xsd_port_intf->read_proc = xsd_port_read;
    4.70  #endif
    4.71 -	} else
    4.72 +	} else {
    4.73  		xenstored_ready = 1;
    4.74 +		xen_store_evtchn = xen_start_info->store_evtchn;
    4.75 +		xen_store_mfn = xen_start_info->store_mfn;
    4.76 +	}
    4.77 +
    4.78 +	xen_store_interface = mfn_to_virt(xen_store_mfn);
    4.79  
    4.80  	/* Initialize the interface to xenstore. */
    4.81  	err = xs_init();