Re: PCI drivers and interrupts

2016-11-04 Thread Kenneth Adam Miller
Oh! It's just a particular memory addressed, and that's what is being
memory mapped into user land. Then I could just write a value in the
kernel land, just as I would from the user land, to the address that
is being memory mapped in. I should just read the device spec better
and test how to write to that memory with a function that I'll export.

On Fri, Nov 4, 2016 at 4:54 PM, Andrey Utkin  wrote:
> I've worked on a couple of PCI drivers for Linux, however I haven't
> studied actual PCI bus protocol and such fundamental details. Also I
> haven't read your post thoroughly and haven't visited your links. So I
> can be completely wrong...
>
> But I am very surprised that you want to send interrupts from kernel (to
> PCI peripheral device as I understand).
>
> It is peripheral device which sends interrupts usually, that's why
> there's no notion of interrups sending. To initiate some process on the
> device, which you really want I suppose, usual kernel driver for PCI
> device just writes to certain register of device.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: PCI drivers and interrupts

2016-11-04 Thread Andrey Utkin
I've worked on a couple of PCI drivers for Linux, however I haven't
studied actual PCI bus protocol and such fundamental details. Also I
haven't read your post thoroughly and haven't visited your links. So I
can be completely wrong...

But I am very surprised that you want to send interrupts from kernel (to
PCI peripheral device as I understand).

It is peripheral device which sends interrupts usually, that's why
there's no notion of interrups sending. To initiate some process on the
device, which you really want I suppose, usual kernel driver for PCI
device just writes to certain register of device.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


PCI drivers and interrupts

2016-11-04 Thread Kenneth Adam Miller
Hello,

I'm trying to author a driver that communicates over shared memory
within the kernel land between concurrent userland processes. I'm
using this as a base:

https://github.com/henning-schild/ivshmem-guest-code/blob/master/kernel_module/uio/uio_ivshmem.c

I've been able to build it and to insmod it into a linux that I have
built and started running in qemu. I need a way to send an interrupt,
as per the documentation mentions in the device_spec and in the guide.
But I'm looking in the uio_ivshmem driver and I don't see
functionality that corresponds to sending an interrupt at all. This
functionality is supposed to be demonstrated in
https://github.com/henning-schild/ivshmem-guest-code/tree/master/tests/Interrupts/VM,
but this is problematic because it seems to indicate that one of the
ioctls corresponds to an interrupt. Unless there's something I'm
missing, I think that the stub pci driver implementation that this
particular demo filled out implements some kind of interrupt, or else
it's actually implemented with one of the function calls on line 28 or
43. But those each seem to correspond to interrupt handlers for
receiving from other QEMU instances, with no sign of how they are
*sent*.


I need to write a function in the context of the driver that can be
compiled in the same code, meaning editing uio_ivshmem.c and yielding
some function interface like send_interrupt(int index), where index
corresponds to the BAR against which the driver registers irq handlers
anyway.

How can I send interrupts from the kernel land using a particular BAR entry?

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies