* [PATCH 0/4] V2, Move stuff out of xenfs
@ 2011-12-07 21:13 Bastian Blank
2011-12-07 21:13 ` [PATCH 1/4] xen: Add privcmd device driver Bastian Blank
` (5 more replies)
0 siblings, 6 replies; 17+ messages in thread
From: Bastian Blank @ 2011-12-07 21:13 UTC (permalink / raw)
To: xen-devel, linux-kernel; +Cc: konrad.wilk
In <20100605162947.GA31336@wavehammer.waldi.eu.org> I started the
discussion about xenfs and the usage of it. This is the second try to
move stuff over into normal device drivers.
Changes:
- Remove guest_capabilities stuff. It is only used to detect if the init
scripts should start anything.
- Fix error values.
Bastian
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/4] xen: Add privcmd device driver
2011-12-07 21:13 [PATCH 0/4] V2, Move stuff out of xenfs Bastian Blank
@ 2011-12-07 21:13 ` Bastian Blank
2011-12-08 8:19 ` [Xen-devel] " Ian Campbell
2011-12-07 21:13 ` [PATCH 2/4] xen: Add xenbus " Bastian Blank
` (4 subsequent siblings)
5 siblings, 1 reply; 17+ messages in thread
From: Bastian Blank @ 2011-12-07 21:13 UTC (permalink / raw)
To: xen-devel, linux-kernel; +Cc: konrad.wilk
Access to arbitrary hypercalls is currently provided via xenfs. This
adds a standard character device to handle this. The support in xenfs
remains for backward compatibility and uses the device driver code.
Signed-off-by: Bastian Blank <waldi@debian.org>
---
drivers/xen/Kconfig | 7 ++++++
drivers/xen/Makefile | 2 +
drivers/xen/{xenfs => }/privcmd.c | 39 ++++++++++++++++++++++++++++++++++++-
drivers/xen/privcmd.h | 3 ++
drivers/xen/xenfs/Makefile | 2 +-
drivers/xen/xenfs/super.c | 3 +-
drivers/xen/xenfs/xenfs.h | 1 -
7 files changed, 53 insertions(+), 4 deletions(-)
rename drivers/xen/{xenfs => }/privcmd.c (92%)
create mode 100644 drivers/xen/privcmd.h
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index 8795480..a1ced52 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -86,6 +86,7 @@ config XEN_BACKEND
config XENFS
tristate "Xen filesystem"
+ select XEN_PRIVCMD
default y
help
The xen filesystem provides a way for domains to share
@@ -171,4 +172,10 @@ config XEN_PCIDEV_BACKEND
xen-pciback.hide=(03:00.0)(04:00.0)
If in doubt, say m.
+
+config XEN_PRIVCMD
+ tristate
+ depends on XEN
+ default m
+
endmenu
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 974fffd..aa31337 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -19,7 +19,9 @@ obj-$(CONFIG_XEN_TMEM) += tmem.o
obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o
obj-$(CONFIG_XEN_DOM0) += pci.o
obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/
+obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o
xen-evtchn-y := evtchn.o
xen-gntdev-y := gntdev.o
xen-gntalloc-y := gntalloc.o
+xen-privcmd-y := privcmd.o
diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/privcmd.c
similarity index 92%
rename from drivers/xen/xenfs/privcmd.c
rename to drivers/xen/privcmd.c
index dbd3b16..863fbd0 100644
--- a/drivers/xen/xenfs/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -7,6 +7,7 @@
*/
#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/string.h>
@@ -18,6 +19,7 @@
#include <linux/highmem.h>
#include <linux/pagemap.h>
#include <linux/seq_file.h>
+#include <linux/miscdevice.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
@@ -32,6 +34,10 @@
#include <xen/page.h>
#include <xen/xen-ops.h>
+#include "privcmd.h"
+
+MODULE_LICENSE("GPL");
+
#ifndef HAVE_ARCH_PRIVCMD_MMAP
static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
#endif
@@ -394,7 +400,38 @@ static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma)
}
#endif
-const struct file_operations privcmd_file_ops = {
+const struct file_operations xen_privcmd_fops = {
+ .owner = THIS_MODULE,
.unlocked_ioctl = privcmd_ioctl,
.mmap = privcmd_mmap,
};
+EXPORT_SYMBOL_GPL(xen_privcmd_fops);
+
+static struct miscdevice privcmd_dev = {
+ .minor = MISC_DYNAMIC_MINOR,
+ .name = "xen/privcmd",
+ .fops = &xen_privcmd_fops,
+};
+
+static int __init privcmd_init(void)
+{
+ int err;
+
+ if (!xen_domain())
+ return -ENODEV;
+
+ err = misc_register(&privcmd_dev);
+ if (err != 0) {
+ printk(KERN_ERR "Could not register privcmd device\n");
+ return err;
+ }
+ return 0;
+}
+
+static void __exit privcmd_exit(void)
+{
+ misc_deregister(&privcmd_dev);
+}
+
+module_init(privcmd_init);
+module_exit(privcmd_exit);
diff --git a/drivers/xen/privcmd.h b/drivers/xen/privcmd.h
new file mode 100644
index 0000000..14facae
--- /dev/null
+++ b/drivers/xen/privcmd.h
@@ -0,0 +1,3 @@
+#include <linux/fs.h>
+
+extern const struct file_operations xen_privcmd_fops;
diff --git a/drivers/xen/xenfs/Makefile b/drivers/xen/xenfs/Makefile
index 4fde944..5d45ff1 100644
--- a/drivers/xen/xenfs/Makefile
+++ b/drivers/xen/xenfs/Makefile
@@ -1,4 +1,4 @@
obj-$(CONFIG_XENFS) += xenfs.o
-xenfs-y = super.o xenbus.o privcmd.o
+xenfs-y = super.o xenbus.o
xenfs-$(CONFIG_XEN_DOM0) += xenstored.o
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index 1aa3897..a55fbf9 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -16,6 +16,7 @@
#include <xen/xen.h>
#include "xenfs.h"
+#include "../privcmd.h"
#include <asm/xen/hypervisor.h>
@@ -84,7 +85,7 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
[1] = {},
{ "xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR },
{ "capabilities", &capabilities_file_ops, S_IRUGO },
- { "privcmd", &privcmd_file_ops, S_IRUSR|S_IWUSR },
+ { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },
{""},
};
int rc;
diff --git a/drivers/xen/xenfs/xenfs.h b/drivers/xen/xenfs/xenfs.h
index b68aa62..5056306 100644
--- a/drivers/xen/xenfs/xenfs.h
+++ b/drivers/xen/xenfs/xenfs.h
@@ -2,7 +2,6 @@
#define _XENFS_XENBUS_H
extern const struct file_operations xenbus_file_ops;
-extern const struct file_operations privcmd_file_ops;
extern const struct file_operations xsd_kva_file_ops;
extern const struct file_operations xsd_port_file_ops;
--
1.7.7.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/4] xen: Add xenbus device driver
2011-12-07 21:13 [PATCH 0/4] V2, Move stuff out of xenfs Bastian Blank
2011-12-07 21:13 ` [PATCH 1/4] xen: Add privcmd device driver Bastian Blank
@ 2011-12-07 21:13 ` Bastian Blank
2011-12-08 8:20 ` [Xen-devel] " Ian Campbell
2011-12-07 21:13 ` [PATCH 3/4] xen: Add xenbusd " Bastian Blank
` (3 subsequent siblings)
5 siblings, 1 reply; 17+ messages in thread
From: Bastian Blank @ 2011-12-07 21:13 UTC (permalink / raw)
To: xen-devel, linux-kernel; +Cc: konrad.wilk
Access to xenbus is currently handled via xenfs. This adds a device
driver for xenbus and makes xenfs use this code.
Signed-off-by: Bastian Blank <waldi@debian.org>
---
drivers/xen/xenbus/Makefile | 1 +
drivers/xen/xenbus/xenbus_comms.h | 4 ++
.../xenbus.c => xenbus/xenbus_dev_frontend.c} | 37 ++++++++++++++++++--
drivers/xen/xenfs/Makefile | 2 +-
drivers/xen/xenfs/super.c | 3 +-
drivers/xen/xenfs/xenfs.h | 1 -
6 files changed, 42 insertions(+), 6 deletions(-)
rename drivers/xen/{xenfs/xenbus.c => xenbus/xenbus_dev_frontend.c} (95%)
diff --git a/drivers/xen/xenbus/Makefile b/drivers/xen/xenbus/Makefile
index 8dca685..a2ea363 100644
--- a/drivers/xen/xenbus/Makefile
+++ b/drivers/xen/xenbus/Makefile
@@ -1,4 +1,5 @@
obj-y += xenbus.o
+obj-y += xenbus_dev_frontend.o
xenbus-objs =
xenbus-objs += xenbus_client.o
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
index c21db75..6e42800 100644
--- a/drivers/xen/xenbus/xenbus_comms.h
+++ b/drivers/xen/xenbus/xenbus_comms.h
@@ -31,6 +31,8 @@
#ifndef _XENBUS_COMMS_H
#define _XENBUS_COMMS_H
+#include <linux/fs.h>
+
int xs_init(void);
int xb_init_comms(void);
@@ -43,4 +45,6 @@ int xs_input_avail(void);
extern struct xenstore_domain_interface *xen_store_interface;
extern int xen_store_evtchn;
+extern const struct file_operations xen_xenbus_fops;
+
#endif /* _XENBUS_COMMS_H */
diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
similarity index 95%
rename from drivers/xen/xenfs/xenbus.c
rename to drivers/xen/xenbus/xenbus_dev_frontend.c
index bbd000f..fb30cff 100644
--- a/drivers/xen/xenfs/xenbus.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -52,13 +52,16 @@
#include <linux/namei.h>
#include <linux/string.h>
#include <linux/slab.h>
+#include <linux/miscdevice.h>
+#include <linux/module.h>
-#include "xenfs.h"
-#include "../xenbus/xenbus_comms.h"
+#include "xenbus_comms.h"
#include <xen/xenbus.h>
#include <asm/xen/hypervisor.h>
+MODULE_LICENSE("GPL");
+
/*
* An element of a list of outstanding transactions, for which we're
* still waiting a reply.
@@ -583,7 +586,7 @@ static unsigned int xenbus_file_poll(struct file *file, poll_table *wait)
return 0;
}
-const struct file_operations xenbus_file_ops = {
+const struct file_operations xen_xenbus_fops = {
.read = xenbus_file_read,
.write = xenbus_file_write,
.open = xenbus_file_open,
@@ -591,3 +594,31 @@ const struct file_operations xenbus_file_ops = {
.poll = xenbus_file_poll,
.llseek = no_llseek,
};
+EXPORT_SYMBOL_GPL(xen_xenbus_fops);
+
+static struct miscdevice xenbus_dev = {
+ .minor = MISC_DYNAMIC_MINOR,
+ .name = "xen/xenbus",
+ .fops = &xen_xenbus_fops,
+};
+
+static int __init xenbus_init(void)
+{
+ int err;
+
+ if (!xen_domain())
+ return -ENODEV;
+
+ err = misc_register(&xenbus_dev);
+ if (err)
+ printk(KERN_ERR "Could not register xenbus device\n");
+ return err;
+}
+
+static void __exit xenbus_exit(void)
+{
+ misc_deregister(&xenbus_dev);
+}
+
+module_init(xenbus_init);
+module_exit(xenbus_exit);
diff --git a/drivers/xen/xenfs/Makefile b/drivers/xen/xenfs/Makefile
index 5d45ff1..b019865 100644
--- a/drivers/xen/xenfs/Makefile
+++ b/drivers/xen/xenfs/Makefile
@@ -1,4 +1,4 @@
obj-$(CONFIG_XENFS) += xenfs.o
-xenfs-y = super.o xenbus.o
+xenfs-y = super.o
xenfs-$(CONFIG_XEN_DOM0) += xenstored.o
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index a55fbf9..a84b53c 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -17,6 +17,7 @@
#include "xenfs.h"
#include "../privcmd.h"
+#include "../xenbus/xenbus_comms.h"
#include <asm/xen/hypervisor.h>
@@ -83,7 +84,7 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
{
static struct tree_descr xenfs_files[] = {
[1] = {},
- { "xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR },
+ { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR },
{ "capabilities", &capabilities_file_ops, S_IRUGO },
{ "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },
{""},
diff --git a/drivers/xen/xenfs/xenfs.h b/drivers/xen/xenfs/xenfs.h
index 5056306..6b80c77 100644
--- a/drivers/xen/xenfs/xenfs.h
+++ b/drivers/xen/xenfs/xenfs.h
@@ -1,7 +1,6 @@
#ifndef _XENFS_XENBUS_H
#define _XENFS_XENBUS_H
-extern const struct file_operations xenbus_file_ops;
extern const struct file_operations xsd_kva_file_ops;
extern const struct file_operations xsd_port_file_ops;
--
1.7.7.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/4] xen: Add xenbusd device driver
2011-12-07 21:13 [PATCH 0/4] V2, Move stuff out of xenfs Bastian Blank
2011-12-07 21:13 ` [PATCH 1/4] xen: Add privcmd device driver Bastian Blank
2011-12-07 21:13 ` [PATCH 2/4] xen: Add xenbus " Bastian Blank
@ 2011-12-07 21:13 ` Bastian Blank
2011-12-08 8:24 ` [Xen-devel] " Ian Campbell
2011-12-07 21:13 ` [PATCH 4/4] xen/privcmd: Remove unused support for arch specific privcmp mmap Bastian Blank
` (2 subsequent siblings)
5 siblings, 1 reply; 17+ messages in thread
From: Bastian Blank @ 2011-12-07 21:13 UTC (permalink / raw)
To: xen-devel, linux-kernel; +Cc: konrad.wilk
Access for xenstored to the event channel and pre-allocated ring is
managed via xenfs. This adds its own device driver featuring mmap for
the ring and an ioctl for the event channel.
Signed-off-by: Bastian Blank <waldi@debian.org>
---
drivers/xen/xenbus/Makefile | 1 +
drivers/xen/xenbus/xenbus_dev_backend.c | 79 +++++++++++++++++++++++++++++++
include/xen/xenbus_dev.h | 41 ++++++++++++++++
3 files changed, 121 insertions(+), 0 deletions(-)
create mode 100644 drivers/xen/xenbus/xenbus_dev_backend.c
create mode 100644 include/xen/xenbus_dev.h
diff --git a/drivers/xen/xenbus/Makefile b/drivers/xen/xenbus/Makefile
index a2ea363..31e2e90 100644
--- a/drivers/xen/xenbus/Makefile
+++ b/drivers/xen/xenbus/Makefile
@@ -10,4 +10,5 @@ xenbus-objs += xenbus_probe.o
xenbus-be-objs-$(CONFIG_XEN_BACKEND) += xenbus_probe_backend.o
xenbus-objs += $(xenbus-be-objs-y)
+obj-$(CONFIG_XEN_BACKEND) += xenbus_dev_backend.o
obj-$(CONFIG_XEN_XENBUS_FRONTEND) += xenbus_probe_frontend.o
diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c
new file mode 100644
index 0000000..58cf621
--- /dev/null
+++ b/drivers/xen/xenbus/xenbus_dev_backend.c
@@ -0,0 +1,79 @@
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
+#include <linux/module.h>
+
+#include <xen/page.h>
+#include <xen/xenbus_dev.h>
+
+#include "xenbus_comms.h"
+
+MODULE_LICENSE("GPL");
+
+static long xenbusd_ioctl(struct file *file, unsigned int cmd, unsigned long data)
+{
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
+
+ switch (cmd) {
+ case IOCTL_XENBUSD_EVTCHN:
+ if (xen_store_evtchn > 0)
+ return xen_store_evtchn;
+ return -ENODEV;
+
+ default:
+ return -ENOTTY;
+ }
+}
+
+static int xenbusd_mmap(struct file *file, struct vm_area_struct *vma)
+{
+ size_t size = vma->vm_end - vma->vm_start;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
+
+ if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
+ return -EINVAL;
+
+ if (remap_pfn_range(vma, vma->vm_start,
+ virt_to_pfn(xen_store_interface),
+ size, vma->vm_page_prot))
+ return -EAGAIN;
+
+ return 0;
+}
+
+const struct file_operations xenbusd_fops = {
+ .mmap = xenbusd_mmap,
+ .unlocked_ioctl = xenbusd_ioctl,
+};
+
+static struct miscdevice xenbusd_dev = {
+ .minor = MISC_DYNAMIC_MINOR,
+ .name = "xen/xenbusd",
+ .fops = &xenbusd_fops,
+};
+
+static int __init xenbusd_init(void)
+{
+ int err;
+
+ if (!xen_initial_domain())
+ return -ENODEV;
+
+ err = misc_register(&xenbusd_dev);
+ if (err)
+ printk(KERN_ERR "Could not register xenbus device\n");
+ return err;
+}
+
+static void __exit xenbusd_exit(void)
+{
+ misc_deregister(&xenbusd_dev);
+}
+
+module_init(xenbusd_init);
+module_exit(xenbusd_exit);
diff --git a/include/xen/xenbus_dev.h b/include/xen/xenbus_dev.h
new file mode 100644
index 0000000..3008c03
--- /dev/null
+++ b/include/xen/xenbus_dev.h
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * evtchn.h
+ *
+ * Interface to /dev/xen/xenbusd.
+ *
+ * Copyright (c) 2011 Bastian Blank <waldi@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __LINUX_XEN_XENBUS_DEV_H__
+#define __LINUX_XEN_XENBUS_DEV_H__
+
+#include <linux/ioctl.h>
+
+#define IOCTL_XENBUSD_EVTCHN \
+ _IOC(_IOC_NONE, 'B', 0, 0)
+
+#endif /* __LINUX_XEN_XENBUS_DEV_H__ */
--
1.7.7.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/4] xen/privcmd: Remove unused support for arch specific privcmp mmap
2011-12-07 21:13 [PATCH 0/4] V2, Move stuff out of xenfs Bastian Blank
` (2 preceding siblings ...)
2011-12-07 21:13 ` [PATCH 3/4] xen: Add xenbusd " Bastian Blank
@ 2011-12-07 21:13 ` Bastian Blank
2011-12-08 8:32 ` [Xen-devel] " Ian Campbell
2011-12-08 8:34 ` [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs Ian Campbell
2011-12-08 11:09 ` David Vrabel
5 siblings, 1 reply; 17+ messages in thread
From: Bastian Blank @ 2011-12-07 21:13 UTC (permalink / raw)
To: xen-devel, linux-kernel; +Cc: konrad.wilk
---
drivers/xen/privcmd.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 863fbd0..c13d26a 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -365,7 +365,6 @@ static long privcmd_ioctl(struct file *file,
return ret;
}
-#ifndef HAVE_ARCH_PRIVCMD_MMAP
static int privcmd_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
printk(KERN_DEBUG "privcmd_fault: vma=%p %lx-%lx, pgoff=%lx, uv=%p\n",
@@ -398,7 +397,6 @@ static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma)
{
return (xchg(&vma->vm_private_data, (void *)1) == NULL);
}
-#endif
const struct file_operations xen_privcmd_fops = {
.owner = THIS_MODULE,
--
1.7.7.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 1/4] xen: Add privcmd device driver
2011-12-07 21:13 ` [PATCH 1/4] xen: Add privcmd device driver Bastian Blank
@ 2011-12-08 8:19 ` Ian Campbell
0 siblings, 0 replies; 17+ messages in thread
From: Ian Campbell @ 2011-12-08 8:19 UTC (permalink / raw)
To: Bastian Blank
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
konrad.wilk@oracle.com
On Wed, 2011-12-07 at 21:13 +0000, Bastian Blank wrote:
> +static int __init privcmd_init(void)
> +{
> + int err;
> +
> + if (!xen_domain())
> + return -ENODEV;
> +
> + err = misc_register(&privcmd_dev);
> + if (err != 0) {
> + printk(KERN_ERR "Could not register privcmd device\n");
Should say "...register Xen privcmd device". Otherwise:
Acked-by: Ian Campbell <ian.campbell@citrix.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 2/4] xen: Add xenbus device driver
2011-12-07 21:13 ` [PATCH 2/4] xen: Add xenbus " Bastian Blank
@ 2011-12-08 8:20 ` Ian Campbell
0 siblings, 0 replies; 17+ messages in thread
From: Ian Campbell @ 2011-12-08 8:20 UTC (permalink / raw)
To: Bastian Blank
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
konrad.wilk@oracle.com
On Wed, 2011-12-07 at 21:13 +0000, Bastian Blank wrote:
> Access to xenbus is currently handled via xenfs. This adds a device
> driver for xenbus and makes xenfs use this code.
>
> Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> drivers/xen/xenbus/Makefile | 1 +
> drivers/xen/xenbus/xenbus_comms.h | 4 ++
> .../xenbus.c => xenbus/xenbus_dev_frontend.c} | 37 ++++++++++++++++++--
> drivers/xen/xenfs/Makefile | 2 +-
> drivers/xen/xenfs/super.c | 3 +-
> drivers/xen/xenfs/xenfs.h | 1 -
> 6 files changed, 42 insertions(+), 6 deletions(-)
> rename drivers/xen/{xenfs/xenbus.c => xenbus/xenbus_dev_frontend.c} (95%)
>
> diff --git a/drivers/xen/xenbus/Makefile b/drivers/xen/xenbus/Makefile
> index 8dca685..a2ea363 100644
> --- a/drivers/xen/xenbus/Makefile
> +++ b/drivers/xen/xenbus/Makefile
> @@ -1,4 +1,5 @@
> obj-y += xenbus.o
> +obj-y += xenbus_dev_frontend.o
>
> xenbus-objs =
> xenbus-objs += xenbus_client.o
> diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
> index c21db75..6e42800 100644
> --- a/drivers/xen/xenbus/xenbus_comms.h
> +++ b/drivers/xen/xenbus/xenbus_comms.h
> @@ -31,6 +31,8 @@
> #ifndef _XENBUS_COMMS_H
> #define _XENBUS_COMMS_H
>
> +#include <linux/fs.h>
> +
> int xs_init(void);
> int xb_init_comms(void);
>
> @@ -43,4 +45,6 @@ int xs_input_avail(void);
> extern struct xenstore_domain_interface *xen_store_interface;
> extern int xen_store_evtchn;
>
> +extern const struct file_operations xen_xenbus_fops;
> +
> #endif /* _XENBUS_COMMS_H */
> diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
> similarity index 95%
> rename from drivers/xen/xenfs/xenbus.c
> rename to drivers/xen/xenbus/xenbus_dev_frontend.c
> index bbd000f..fb30cff 100644
> --- a/drivers/xen/xenfs/xenbus.c
> +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
> @@ -52,13 +52,16 @@
> #include <linux/namei.h>
> #include <linux/string.h>
> #include <linux/slab.h>
> +#include <linux/miscdevice.h>
> +#include <linux/module.h>
>
> -#include "xenfs.h"
> -#include "../xenbus/xenbus_comms.h"
> +#include "xenbus_comms.h"
>
> #include <xen/xenbus.h>
> #include <asm/xen/hypervisor.h>
>
> +MODULE_LICENSE("GPL");
> +
> /*
> * An element of a list of outstanding transactions, for which we're
> * still waiting a reply.
> @@ -583,7 +586,7 @@ static unsigned int xenbus_file_poll(struct file *file, poll_table *wait)
> return 0;
> }
>
> -const struct file_operations xenbus_file_ops = {
> +const struct file_operations xen_xenbus_fops = {
> .read = xenbus_file_read,
> .write = xenbus_file_write,
> .open = xenbus_file_open,
> @@ -591,3 +594,31 @@ const struct file_operations xenbus_file_ops = {
> .poll = xenbus_file_poll,
> .llseek = no_llseek,
> };
> +EXPORT_SYMBOL_GPL(xen_xenbus_fops);
> +
> +static struct miscdevice xenbus_dev = {
> + .minor = MISC_DYNAMIC_MINOR,
> + .name = "xen/xenbus",
> + .fops = &xen_xenbus_fops,
> +};
> +
> +static int __init xenbus_init(void)
> +{
> + int err;
> +
> + if (!xen_domain())
> + return -ENODEV;
> +
> + err = misc_register(&xenbus_dev);
> + if (err)
> + printk(KERN_ERR "Could not register xenbus device\n");
> + return err;
> +}
> +
> +static void __exit xenbus_exit(void)
> +{
> + misc_deregister(&xenbus_dev);
> +}
> +
> +module_init(xenbus_init);
> +module_exit(xenbus_exit);
> diff --git a/drivers/xen/xenfs/Makefile b/drivers/xen/xenfs/Makefile
> index 5d45ff1..b019865 100644
> --- a/drivers/xen/xenfs/Makefile
> +++ b/drivers/xen/xenfs/Makefile
> @@ -1,4 +1,4 @@
> obj-$(CONFIG_XENFS) += xenfs.o
>
> -xenfs-y = super.o xenbus.o
> +xenfs-y = super.o
> xenfs-$(CONFIG_XEN_DOM0) += xenstored.o
> diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
> index a55fbf9..a84b53c 100644
> --- a/drivers/xen/xenfs/super.c
> +++ b/drivers/xen/xenfs/super.c
> @@ -17,6 +17,7 @@
>
> #include "xenfs.h"
> #include "../privcmd.h"
> +#include "../xenbus/xenbus_comms.h"
>
> #include <asm/xen/hypervisor.h>
>
> @@ -83,7 +84,7 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
> {
> static struct tree_descr xenfs_files[] = {
> [1] = {},
> - { "xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR },
> + { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR },
> { "capabilities", &capabilities_file_ops, S_IRUGO },
> { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },
> {""},
> diff --git a/drivers/xen/xenfs/xenfs.h b/drivers/xen/xenfs/xenfs.h
> index 5056306..6b80c77 100644
> --- a/drivers/xen/xenfs/xenfs.h
> +++ b/drivers/xen/xenfs/xenfs.h
> @@ -1,7 +1,6 @@
> #ifndef _XENFS_XENBUS_H
> #define _XENFS_XENBUS_H
>
> -extern const struct file_operations xenbus_file_ops;
> extern const struct file_operations xsd_kva_file_ops;
> extern const struct file_operations xsd_port_file_ops;
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 3/4] xen: Add xenbusd device driver
2011-12-07 21:13 ` [PATCH 3/4] xen: Add xenbusd " Bastian Blank
@ 2011-12-08 8:24 ` Ian Campbell
2011-12-08 9:27 ` Bastian Blank
0 siblings, 1 reply; 17+ messages in thread
From: Ian Campbell @ 2011-12-08 8:24 UTC (permalink / raw)
To: Bastian Blank
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
konrad.wilk@oracle.com
On Wed, 2011-12-07 at 21:13 +0000, Bastian Blank wrote:
> Access for xenstored to the event channel and pre-allocated ring is
> managed via xenfs. This adds its own device driver featuring mmap for
> the ring and an ioctl for the event channel.
>
> Signed-off-by: Bastian Blank <waldi@debian.org>
> ---
> drivers/xen/xenbus/Makefile | 1 +
> drivers/xen/xenbus/xenbus_dev_backend.c | 79 +++++++++++++++++++++++++++++++
> include/xen/xenbus_dev.h | 41 ++++++++++++++++
> 3 files changed, 121 insertions(+), 0 deletions(-)
> create mode 100644 drivers/xen/xenbus/xenbus_dev_backend.c
> create mode 100644 include/xen/xenbus_dev.h
>
> diff --git a/drivers/xen/xenbus/Makefile b/drivers/xen/xenbus/Makefile
> index a2ea363..31e2e90 100644
> --- a/drivers/xen/xenbus/Makefile
> +++ b/drivers/xen/xenbus/Makefile
> @@ -10,4 +10,5 @@ xenbus-objs += xenbus_probe.o
> xenbus-be-objs-$(CONFIG_XEN_BACKEND) += xenbus_probe_backend.o
> xenbus-objs += $(xenbus-be-objs-y)
>
> +obj-$(CONFIG_XEN_BACKEND) += xenbus_dev_backend.o
In principal this could be its own module which does not depend on any
of the backend stuff but I think this is fine for now.
> [...]
> +static int __init xenbusd_init(void)
> +{
> + int err;
> +
> + if (!xen_initial_domain())
> + return -ENODEV;
> +
> + err = misc_register(&xenbusd_dev);
> + if (err)
> + printk(KERN_ERR "Could not register xenbus device\n");
"Could not register xenbus backend device" to distinguish from the f.e.
failure message, you could also add "frontend" there I suppose. Other
than that:
Acked-by: Ian Campbell <ian.campbell@citrix.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 4/4] xen/privcmd: Remove unused support for arch specific privcmp mmap
2011-12-07 21:13 ` [PATCH 4/4] xen/privcmd: Remove unused support for arch specific privcmp mmap Bastian Blank
@ 2011-12-08 8:32 ` Ian Campbell
0 siblings, 0 replies; 17+ messages in thread
From: Ian Campbell @ 2011-12-08 8:32 UTC (permalink / raw)
To: Bastian Blank
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
konrad.wilk@oracle.com
On Wed, 2011-12-07 at 21:13 +0000, Bastian Blank wrote:
> ---
You've forgotten the S-o-b for this patch.
Once upon a time this was used by the ia64 privcmd support[0] but since
no one appears to be working on ia64 dom0 support for upstream I'm not
sure if this is an issue or not. I lean towards "not", this can always
be put back as necessary.
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[0]
http://xenbits.xen.org/hg/linux-2.6.18-xen.hg/file/bffd07392da5/arch/ia64/xen/hypervisor.c#l659
http://xenbits.xen.org/hg/linux-2.6.18-xen.hg/file/bffd07392da5/include/asm-ia64/hypervisor.h#l132
> drivers/xen/privcmd.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
> index 863fbd0..c13d26a 100644
> --- a/drivers/xen/privcmd.c
> +++ b/drivers/xen/privcmd.c
> @@ -365,7 +365,6 @@ static long privcmd_ioctl(struct file *file,
> return ret;
> }
>
> -#ifndef HAVE_ARCH_PRIVCMD_MMAP
> static int privcmd_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> {
> printk(KERN_DEBUG "privcmd_fault: vma=%p %lx-%lx, pgoff=%lx, uv=%p\n",
> @@ -398,7 +397,6 @@ static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma)
> {
> return (xchg(&vma->vm_private_data, (void *)1) == NULL);
> }
> -#endif
>
> const struct file_operations xen_privcmd_fops = {
> .owner = THIS_MODULE,
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs
2011-12-07 21:13 [PATCH 0/4] V2, Move stuff out of xenfs Bastian Blank
` (3 preceding siblings ...)
2011-12-07 21:13 ` [PATCH 4/4] xen/privcmd: Remove unused support for arch specific privcmp mmap Bastian Blank
@ 2011-12-08 8:34 ` Ian Campbell
2011-12-08 9:28 ` Bastian Blank
2011-12-08 11:09 ` David Vrabel
5 siblings, 1 reply; 17+ messages in thread
From: Ian Campbell @ 2011-12-08 8:34 UTC (permalink / raw)
To: Bastian Blank
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
konrad.wilk@oracle.com
On Wed, 2011-12-07 at 21:13 +0000, Bastian Blank wrote:
> In <20100605162947.GA31336@wavehammer.waldi.eu.org> I started the
> discussion about xenfs and the usage of it. This is the second try to
> move stuff over into normal device drivers.
I had a few nit picks about error messages but otherwise I'm happy with
this.
How are we doing on the corresponding toolstack changes?
Ian.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 3/4] xen: Add xenbusd device driver
2011-12-08 8:24 ` [Xen-devel] " Ian Campbell
@ 2011-12-08 9:27 ` Bastian Blank
2011-12-08 9:32 ` Ian Campbell
2011-12-08 11:08 ` Bastian Blank
0 siblings, 2 replies; 17+ messages in thread
From: Bastian Blank @ 2011-12-08 9:27 UTC (permalink / raw)
To: Ian Campbell
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
konrad.wilk@oracle.com
On Thu, Dec 08, 2011 at 08:24:46AM +0000, Ian Campbell wrote:
> On Wed, 2011-12-07 at 21:13 +0000, Bastian Blank wrote:
> > +obj-$(CONFIG_XEN_BACKEND) += xenbus_dev_backend.o
> In principal this could be its own module which does not depend on any
> of the backend stuff but I think this is fine for now.
I even think about registering this device from xenstored_local_init in
xenbus_probe.c. Then it will be available only if the kernel also owns
the communcation ring.
> "Could not register xenbus backend device" to distinguish from the f.e.
> failure message, you could also add "frontend" there I suppose. Other
> than that:
Yep.
Will someone mind if I rename this device to xenbus_backend? It's more
clear.
Bastian
--
Deflector shields just came on, Captain.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs
2011-12-08 8:34 ` [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs Ian Campbell
@ 2011-12-08 9:28 ` Bastian Blank
2011-12-08 11:10 ` David Vrabel
0 siblings, 1 reply; 17+ messages in thread
From: Bastian Blank @ 2011-12-08 9:28 UTC (permalink / raw)
To: Ian Campbell
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
konrad.wilk@oracle.com
On Thu, Dec 08, 2011 at 08:34:19AM +0000, Ian Campbell wrote:
> How are we doing on the corresponding toolstack changes?
I have at least parts of it somewhere on my workstation. I'll polish and
submit them also.
Bastian
--
Witch! Witch! They'll burn ya!
-- Hag, "Tomorrow is Yesterday", stardate unknown
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 3/4] xen: Add xenbusd device driver
2011-12-08 9:27 ` Bastian Blank
@ 2011-12-08 9:32 ` Ian Campbell
2011-12-08 11:08 ` Bastian Blank
1 sibling, 0 replies; 17+ messages in thread
From: Ian Campbell @ 2011-12-08 9:32 UTC (permalink / raw)
To: Bastian Blank
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
konrad.wilk@oracle.com
On Thu, 2011-12-08 at 09:27 +0000, Bastian Blank wrote:
> On Thu, Dec 08, 2011 at 08:24:46AM +0000, Ian Campbell wrote:
> > On Wed, 2011-12-07 at 21:13 +0000, Bastian Blank wrote:
> > > +obj-$(CONFIG_XEN_BACKEND) += xenbus_dev_backend.o
> > In principal this could be its own module which does not depend on any
> > of the backend stuff but I think this is fine for now.
>
> I even think about registering this device from xenstored_local_init in
> xenbus_probe.c. Then it will be available only if the kernel also owns
> the communcation ring.
That sounds like a good idea.
> > "Could not register xenbus backend device" to distinguish from the f.e.
> > failure message, you could also add "frontend" there I suppose. Other
> > than that:
>
> Yep.
>
> Will someone mind if I rename this device to xenbus_backend? It's more
> clear.
It's ok by me. You could even use "xenstored"?
Ian.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 3/4] xen: Add xenbusd device driver
2011-12-08 9:27 ` Bastian Blank
2011-12-08 9:32 ` Ian Campbell
@ 2011-12-08 11:08 ` Bastian Blank
1 sibling, 0 replies; 17+ messages in thread
From: Bastian Blank @ 2011-12-08 11:08 UTC (permalink / raw)
To: Ian Campbell, xen-devel@lists.xensource.com,
linux-kernel@vger.kernel.org, konrad.wilk@oracle.com
On Thu, Dec 08, 2011 at 10:27:58AM +0100, Bastian Blank wrote:
> I even think about registering this device from xenstored_local_init in
> xenbus_probe.c. Then it will be available only if the kernel also owns
> the communcation ring.
I'm not sure if I'm allowed to register character devices from a
postcore_initcall. Isn't this function called a bit early anyway?
Bastian
--
Each kiss is as the first.
-- Miramanee, Kirk's wife, "The Paradise Syndrome",
stardate 4842.6
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs
2011-12-07 21:13 [PATCH 0/4] V2, Move stuff out of xenfs Bastian Blank
` (4 preceding siblings ...)
2011-12-08 8:34 ` [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs Ian Campbell
@ 2011-12-08 11:09 ` David Vrabel
5 siblings, 0 replies; 17+ messages in thread
From: David Vrabel @ 2011-12-08 11:09 UTC (permalink / raw)
To: Bastian Blank; +Cc: xen-devel, linux-kernel, konrad.wilk
On 07/12/2011 21:13, Bastian Blank wrote:
> In<20100605162947.GA31336@wavehammer.waldi.eu.org> I started the
> discussion about xenfs and the usage of it. This is the second try to
> move stuff over into normal device drivers.
You still don't say why this is needed in the commit messages. I can't
find the message you refer to in the previous thread (the mail archives
don't let you search by message-id).
David
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs
2011-12-08 9:28 ` Bastian Blank
@ 2011-12-08 11:10 ` David Vrabel
2011-12-10 16:08 ` Bastian Blank
0 siblings, 1 reply; 17+ messages in thread
From: David Vrabel @ 2011-12-08 11:10 UTC (permalink / raw)
To: Bastian Blank, Ian Campbell, xen-devel@lists.xensource.com,
linux-kernel@vger.kernel.org, konrad.wilk@oracle.com
On 08/12/11 09:28, Bastian Blank wrote:
> On Thu, Dec 08, 2011 at 08:34:19AM +0000, Ian Campbell wrote:
>> How are we doing on the corresponding toolstack changes?
>
> I have at least parts of it somewhere on my workstation. I'll polish and
> submit them also.
I assume the toolstack will fall back to xenfs if the devices don't exist?
David
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs
2011-12-08 11:10 ` David Vrabel
@ 2011-12-10 16:08 ` Bastian Blank
0 siblings, 0 replies; 17+ messages in thread
From: Bastian Blank @ 2011-12-10 16:08 UTC (permalink / raw)
To: David Vrabel
Cc: Ian Campbell, xen-devel@lists.xensource.com,
linux-kernel@vger.kernel.org, konrad.wilk@oracle.com
On Thu, Dec 08, 2011 at 11:10:58AM +0000, David Vrabel wrote:
> On 08/12/11 09:28, Bastian Blank wrote:
> > On Thu, Dec 08, 2011 at 08:34:19AM +0000, Ian Campbell wrote:
> >> How are we doing on the corresponding toolstack changes?
> > I have at least parts of it somewhere on my workstation. I'll polish and
> > submit them also.
> I assume the toolstack will fall back to xenfs if the devices don't exist?
This was the plan.
Bastian
--
"Get back to your stations!"
"We're beaming down to the planet, sir."
-- Kirk and Mr. Leslie, "This Side of Paradise",
stardate 3417.3
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2011-12-10 16:08 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-07 21:13 [PATCH 0/4] V2, Move stuff out of xenfs Bastian Blank
2011-12-07 21:13 ` [PATCH 1/4] xen: Add privcmd device driver Bastian Blank
2011-12-08 8:19 ` [Xen-devel] " Ian Campbell
2011-12-07 21:13 ` [PATCH 2/4] xen: Add xenbus " Bastian Blank
2011-12-08 8:20 ` [Xen-devel] " Ian Campbell
2011-12-07 21:13 ` [PATCH 3/4] xen: Add xenbusd " Bastian Blank
2011-12-08 8:24 ` [Xen-devel] " Ian Campbell
2011-12-08 9:27 ` Bastian Blank
2011-12-08 9:32 ` Ian Campbell
2011-12-08 11:08 ` Bastian Blank
2011-12-07 21:13 ` [PATCH 4/4] xen/privcmd: Remove unused support for arch specific privcmp mmap Bastian Blank
2011-12-08 8:32 ` [Xen-devel] " Ian Campbell
2011-12-08 8:34 ` [Xen-devel] [PATCH 0/4] V2, Move stuff out of xenfs Ian Campbell
2011-12-08 9:28 ` Bastian Blank
2011-12-08 11:10 ` David Vrabel
2011-12-10 16:08 ` Bastian Blank
2011-12-08 11:09 ` David Vrabel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox