[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081112162333.GD2891@local>
Date: Wed, 12 Nov 2008 17:23:33 +0100
From: "Hans J. Koch" <hjk@...utronix.de>
To: Neil Armstrong <narmstrong@...tion.com>
Cc: "Hans J. Koch" <hjk@...utronix.de>, gregkh@...e.de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] uio: add ioctl callback
On Wed, Nov 12, 2008 at 04:59:56PM +0100, Neil Armstrong wrote:
> Hi Hans,
>
> We need an ioctl callback because we need to query some values only
> available when the irq handler is running.
> For example, we have 3 types of reasons why the irq is triggered and
> these bits are no more available when the irq is cleared.
Ah, that one. That's why we invented the irqcontrol hook. In case of
such broken hardware, you need to mask the irq in the kernel without
touching the register containing those volatile bits. On a system where
you can be sure the irq is not shared, you can simply use disable_irq().
If the irq might be shared, you need to find something else. PCI cards,
for example, often have a register within their PCI bridge that contains
irq mask bits (that's how it is done in uio_cif.c).
Userspace can then reenable the irq by writing the value 1 as a signed
32-bit int to /dev/uioX. You need to implement an irqcontrol() function
in your kernel driver that does the right thing (e.g. call enable_irq()
in the first example).
>
> The cleanest way to have this very specific information is to have a
> dirty old ioctl returning this data.
The cleanest way would be to throw such hardware into the trash bin :-)
A chip where the irq mask register cannot be written without destroying
the irq status register is simply broken and bad design.
Thanks,
Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists