* [PATCH] uio: add support for ioctl
@ 2015-05-18 17:31 Stephen Hemminger
2015-05-18 17:36 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2015-05-18 17:31 UTC (permalink / raw)
To: Hans J. Koch, Greg Kroah-Hartman; +Cc: linux-kernel
Allow UIO device specific driver to provide ioctl interface.
This mechanism is used in DPDK uio_msi driver to allow creating
VFIO like events.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/drivers/uio/uio.c 2015-05-18 10:29:00.097129278 -0700
+++ b/drivers/uio/uio.c 2015-05-18 10:29:00.097129278 -0700
@@ -576,6 +576,20 @@ static ssize_t uio_write(struct file *fi
return retval ? retval : sizeof(s32);
}
+static long uio_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
+{
+ struct uio_listener *listener = filep->private_data;
+ struct uio_device *idev = listener->dev;
+
+ if (!idev->info)
+ return -EIO;
+
+ if (!idev->info->ioctl)
+ return -ENOTTY;
+
+ return idev->info->ioctl(idev->info, cmd, arg);
+}
+
static int uio_find_mem_index(struct vm_area_struct *vma)
{
struct uio_device *idev = vma->vm_private_data;
@@ -712,6 +726,7 @@ static const struct file_operations uio_
.write = uio_write,
.mmap = uio_mmap,
.poll = uio_poll,
+ .unlocked_ioctl = uio_ioctl,
.fasync = uio_fasync,
.llseek = noop_llseek,
};
--- a/include/linux/uio_driver.h 2015-05-18 10:29:00.097129278 -0700
+++ b/include/linux/uio_driver.h 2015-05-18 10:29:00.097129278 -0700
@@ -89,6 +89,7 @@ struct uio_device {
* @mmap: mmap operation for this uio device
* @open: open operation for this uio device
* @release: release operation for this uio device
+ * @ioctl: ioctl handler
* @irqcontrol: disable/enable irqs when 0/1 is written to /dev/uioX
*/
struct uio_info {
@@ -105,6 +106,7 @@ struct uio_info {
int (*open)(struct uio_info *info, struct inode *inode);
int (*release)(struct uio_info *info, struct inode *inode);
int (*irqcontrol)(struct uio_info *info, s32 irq_on);
+ int (*ioctl)(struct uio_info *info, unsigned int cmd, unsigned long arg);
};
extern int __must_check
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] uio: add support for ioctl
2015-05-18 17:31 [PATCH] uio: add support for ioctl Stephen Hemminger
@ 2015-05-18 17:36 ` Christoph Hellwig
2015-05-18 17:41 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2015-05-18 17:36 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Hans J. Koch, Greg Kroah-Hartman, linux-kernel
On Mon, May 18, 2015 at 10:31:36AM -0700, Stephen Hemminger wrote:
> Allow UIO device specific driver to provide ioctl interface.
> This mechanism is used in DPDK uio_msi driver to allow creating
> VFIO like events.
I can't find that driver anywhere in the kernel tree, and there is no
point adding new hooks just for out of tree code that doesn't even
get tested in tree.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] uio: add support for ioctl
2015-05-18 17:36 ` Christoph Hellwig
@ 2015-05-18 17:41 ` Stephen Hemminger
2015-05-19 6:29 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2015-05-18 17:41 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Hans J. Koch, Greg Kroah-Hartman, linux-kernel
On Mon, 18 May 2015 10:36:05 -0700
Christoph Hellwig <hch@infradead.org> wrote:
> On Mon, May 18, 2015 at 10:31:36AM -0700, Stephen Hemminger wrote:
> > Allow UIO device specific driver to provide ioctl interface.
> > This mechanism is used in DPDK uio_msi driver to allow creating
> > VFIO like events.
>
> I can't find that driver anywhere in the kernel tree, and there is no
> point adding new hooks just for out of tree code that doesn't even
> get tested in tree.
>
I will send that driver as soon as the DPDK folks are ready, like a couple
of days from now.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] uio: add support for ioctl
2015-05-18 17:41 ` Stephen Hemminger
@ 2015-05-19 6:29 ` Christoph Hellwig
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2015-05-19 6:29 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Christoph Hellwig, Hans J. Koch, Greg Kroah-Hartman, linux-kernel
On Mon, May 18, 2015 at 10:41:02AM -0700, Stephen Hemminger wrote:
> I will send that driver as soon as the DPDK folks are ready, like a couple
> of days from now.
Then jsut send the preparation patch that isn't useful without it
together with that one.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-19 6:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18 17:31 [PATCH] uio: add support for ioctl Stephen Hemminger
2015-05-18 17:36 ` Christoph Hellwig
2015-05-18 17:41 ` Stephen Hemminger
2015-05-19 6:29 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).