* UIO driver test
@ 2016-04-15 8:29 Gadre Nayan
2016-04-15 8:45 ` anish singh
2016-04-15 13:59 ` Greg KH
0 siblings, 2 replies; 12+ messages in thread
From: Gadre Nayan @ 2016-04-15 8:29 UTC (permalink / raw)
To: kernelnewbies
Dear all,
I am trying to test a dummy UIO driver to get timer interrupt events
in Userspace.
I register the UIO driver as a platform driver:
static struct platform_device *uio_dummy_device;
static struct device_driver uio_dummy_driver = {
.name = "uio_dummy",
.bus = &platform_bus_type,
.probe = uio_dummy_probe,
.remove = uio_dummy_remove,
.shutdown = uio_dummy_shutdown,
};
/*
* Main initialization/remove routines
*/
static int __init uio_dummy_init(void)
{
printk("uio_dummy_init( )\n" );
uio_dummy_device = platform_device_register_simple("uio_dummy", -1,
NULL, 0);
if (IS_ERR(uio_dummy_device))
return PTR_ERR(uio_dummy_device);
return driver_register(&uio_dummy_driver);
}
So after the driver_register() My probe should be called but it isn't.
Why is this happening.
Thanks
Nayan
^ permalink raw reply [flat|nested] 12+ messages in thread* UIO driver test
2016-04-15 8:29 UIO driver test Gadre Nayan
@ 2016-04-15 8:45 ` anish singh
2016-04-15 10:01 ` Gadre Nayan
2016-04-15 13:59 ` Greg KH
1 sibling, 1 reply; 12+ messages in thread
From: anish singh @ 2016-04-15 8:45 UTC (permalink / raw)
To: kernelnewbies
On Fri, Apr 15, 2016 at 1:29 AM, Gadre Nayan <gadrenayan@gmail.com> wrote:
> Dear all,
>
> I am trying to test a dummy UIO driver to get timer interrupt events
> in Userspace.
>
> I register the UIO driver as a platform driver:
>
> static struct platform_device *uio_dummy_device;
>
> static struct device_driver uio_dummy_driver = {
> .name = "uio_dummy",
> .bus = &platform_bus_type,
> .probe = uio_dummy_probe,
> .remove = uio_dummy_remove,
> .shutdown = uio_dummy_shutdown,
> };
>
> /*
> * Main initialization/remove routines
> */
> static int __init uio_dummy_init(void)
> {
> printk("uio_dummy_init( )\n" );
> uio_dummy_device = platform_device_register_simple("uio_dummy", -1,
> NULL, 0);
> if (IS_ERR(uio_dummy_device))
> return PTR_ERR(uio_dummy_device);
>
> return driver_register(&uio_dummy_driver);
> }
>
> So after the driver_register() My probe should be called but it isn't.
>
yes but did you register the device in your device tree or your boot file?
>
> Why is this happening.
>
> Thanks
> Nayan
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160415/b8772d29/attachment.html
^ permalink raw reply [flat|nested] 12+ messages in thread* UIO driver test
2016-04-15 8:45 ` anish singh
@ 2016-04-15 10:01 ` Gadre Nayan
0 siblings, 0 replies; 12+ messages in thread
From: Gadre Nayan @ 2016-04-15 10:01 UTC (permalink / raw)
To: kernelnewbies
Hi,
I am using this on x86 machine..so no device tree...where do I have to
register elsewhere here.?
On 15 Apr 2016 2:15 p.m., "anish singh" <anish198519851985@gmail.com> wrote:
>
>
> On Fri, Apr 15, 2016 at 1:29 AM, Gadre Nayan <gadrenayan@gmail.com> wrote:
>
>> Dear all,
>>
>> I am trying to test a dummy UIO driver to get timer interrupt events
>> in Userspace.
>>
>> I register the UIO driver as a platform driver:
>>
>> static struct platform_device *uio_dummy_device;
>>
>> static struct device_driver uio_dummy_driver = {
>> .name = "uio_dummy",
>> .bus = &platform_bus_type,
>> .probe = uio_dummy_probe,
>> .remove = uio_dummy_remove,
>> .shutdown = uio_dummy_shutdown,
>> };
>>
>> /*
>> * Main initialization/remove routines
>> */
>> static int __init uio_dummy_init(void)
>> {
>> printk("uio_dummy_init( )\n" );
>> uio_dummy_device = platform_device_register_simple("uio_dummy",
>> -1,
>> NULL, 0);
>> if (IS_ERR(uio_dummy_device))
>> return PTR_ERR(uio_dummy_device);
>>
>> return driver_register(&uio_dummy_driver);
>> }
>>
>> So after the driver_register() My probe should be called but it isn't.
>>
>
> yes but did you register the device in your device tree or your boot file?
>
>>
>> Why is this happening.
>>
>> Thanks
>> Nayan
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160415/654096c3/attachment.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* UIO driver test
2016-04-15 8:29 UIO driver test Gadre Nayan
2016-04-15 8:45 ` anish singh
@ 2016-04-15 13:59 ` Greg KH
2016-04-15 14:13 ` Gadre Nayan
2016-04-15 17:36 ` Mandeep Sandhu
1 sibling, 2 replies; 12+ messages in thread
From: Greg KH @ 2016-04-15 13:59 UTC (permalink / raw)
To: kernelnewbies
On Fri, Apr 15, 2016 at 01:59:12PM +0530, Gadre Nayan wrote:
> Dear all,
>
> I am trying to test a dummy UIO driver to get timer interrupt events
> in Userspace.
>
> I register the UIO driver as a platform driver:
>
> static struct platform_device *uio_dummy_device;
>
> static struct device_driver uio_dummy_driver = {
> .name = "uio_dummy",
> .bus = &platform_bus_type,
> .probe = uio_dummy_probe,
> .remove = uio_dummy_remove,
> .shutdown = uio_dummy_shutdown,
> };
>
> /*
> * Main initialization/remove routines
> */
> static int __init uio_dummy_init(void)
> {
> printk("uio_dummy_init( )\n" );
> uio_dummy_device = platform_device_register_simple("uio_dummy", -1,
> NULL, 0);
Why are you using a platform driver and device on x86? That's not going
to work at all, as your device doesn't have an irq. Please use this on
a "real" device that has an interrupt assigned to it.
hope this helps,
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread* UIO driver test
2016-04-15 13:59 ` Greg KH
@ 2016-04-15 14:13 ` Gadre Nayan
2016-04-15 14:15 ` Gadre Nayan
2016-04-15 14:20 ` Greg KH
2016-04-15 17:36 ` Mandeep Sandhu
1 sibling, 2 replies; 12+ messages in thread
From: Gadre Nayan @ 2016-04-15 14:13 UTC (permalink / raw)
To: kernelnewbies
Oh offcourse, I forgot.
So then should a char driver interface suffice.
On 15 Apr 2016 7:29 p.m., "Greg KH" <greg@kroah.com> wrote:
> On Fri, Apr 15, 2016 at 01:59:12PM +0530, Gadre Nayan wrote:
> > Dear all,
> >
> > I am trying to test a dummy UIO driver to get timer interrupt events
> > in Userspace.
> >
> > I register the UIO driver as a platform driver:
> >
> > static struct platform_device *uio_dummy_device;
> >
> > static struct device_driver uio_dummy_driver = {
> > .name = "uio_dummy",
> > .bus = &platform_bus_type,
> > .probe = uio_dummy_probe,
> > .remove = uio_dummy_remove,
> > .shutdown = uio_dummy_shutdown,
> > };
> >
> > /*
> > * Main initialization/remove routines
> > */
> > static int __init uio_dummy_init(void)
> > {
> > printk("uio_dummy_init( )\n" );
> > uio_dummy_device = platform_device_register_simple("uio_dummy",
> -1,
> > NULL, 0);
>
> Why are you using a platform driver and device on x86? That's not going
> to work at all, as your device doesn't have an irq. Please use this on
> a "real" device that has an interrupt assigned to it.
>
> hope this helps,
>
> greg k-h
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160415/8687587c/attachment.html
^ permalink raw reply [flat|nested] 12+ messages in thread* UIO driver test
2016-04-15 14:13 ` Gadre Nayan
@ 2016-04-15 14:15 ` Gadre Nayan
2016-04-15 14:21 ` Greg KH
2016-04-15 14:20 ` Greg KH
1 sibling, 1 reply; 12+ messages in thread
From: Gadre Nayan @ 2016-04-15 14:15 UTC (permalink / raw)
To: kernelnewbies
Sorry I am completely out of sort here,
should I register it on a PCI bus without any ID table?
On 15 Apr 2016 7:43 p.m., "Gadre Nayan" <gadrenayan@gmail.com> wrote:
> Oh offcourse, I forgot.
>
> So then should a char driver interface suffice.
> On 15 Apr 2016 7:29 p.m., "Greg KH" <greg@kroah.com> wrote:
>
>> On Fri, Apr 15, 2016 at 01:59:12PM +0530, Gadre Nayan wrote:
>> > Dear all,
>> >
>> > I am trying to test a dummy UIO driver to get timer interrupt events
>> > in Userspace.
>> >
>> > I register the UIO driver as a platform driver:
>> >
>> > static struct platform_device *uio_dummy_device;
>> >
>> > static struct device_driver uio_dummy_driver = {
>> > .name = "uio_dummy",
>> > .bus = &platform_bus_type,
>> > .probe = uio_dummy_probe,
>> > .remove = uio_dummy_remove,
>> > .shutdown = uio_dummy_shutdown,
>> > };
>> >
>> > /*
>> > * Main initialization/remove routines
>> > */
>> > static int __init uio_dummy_init(void)
>> > {
>> > printk("uio_dummy_init( )\n" );
>> > uio_dummy_device = platform_device_register_simple("uio_dummy",
>> -1,
>> > NULL, 0);
>>
>> Why are you using a platform driver and device on x86? That's not going
>> to work at all, as your device doesn't have an irq. Please use this on
>> a "real" device that has an interrupt assigned to it.
>>
>> hope this helps,
>>
>> greg k-h
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160415/527041f9/attachment-0001.html
^ permalink raw reply [flat|nested] 12+ messages in thread* UIO driver test
2016-04-15 14:15 ` Gadre Nayan
@ 2016-04-15 14:21 ` Greg KH
2016-04-16 1:33 ` Gadre Nayan
0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2016-04-15 14:21 UTC (permalink / raw)
To: kernelnewbies
On Fri, Apr 15, 2016 at 07:45:16PM +0530, Gadre Nayan wrote:
> Sorry I am completely out of sort here,
>
> should I register it on a PCI bus without any ID table?
What exactly will that do? You have to have a ID of a PCI device in
order to properly bind to it, correct?
Do you have a device you want to write a UIO driver for? If not, you
aren't going to get very far :)
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* UIO driver test
2016-04-15 14:21 ` Greg KH
@ 2016-04-16 1:33 ` Gadre Nayan
2016-04-16 1:37 ` Greg KH
0 siblings, 1 reply; 12+ messages in thread
From: Gadre Nayan @ 2016-04-16 1:33 UTC (permalink / raw)
To: kernelnewbies
I am trying to replicate the igb_uio for realtek card on my system. I saw
the igb_uio source and it uses no ID table.
Struct pci_driver igb_pci_driver = {
.id_table = NULL;
};
So I wanted to understand the mechanism by which the igb_uio binds to a igb
network card driver.
On 15 Apr 2016 7:51 p.m., "Greg KH" <greg@kroah.com> wrote:
> On Fri, Apr 15, 2016 at 07:45:16PM +0530, Gadre Nayan wrote:
> > Sorry I am completely out of sort here,
> >
> > should I register it on a PCI bus without any ID table?
>
> What exactly will that do? You have to have a ID of a PCI device in
> order to properly bind to it, correct?
>
> Do you have a device you want to write a UIO driver for? If not, you
> aren't going to get very far :)
>
> greg k-h
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160416/a6688fb5/attachment.html
^ permalink raw reply [flat|nested] 12+ messages in thread* UIO driver test
2016-04-16 1:33 ` Gadre Nayan
@ 2016-04-16 1:37 ` Greg KH
0 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2016-04-16 1:37 UTC (permalink / raw)
To: kernelnewbies
On Sat, Apr 16, 2016 at 07:03:37AM +0530, Gadre Nayan wrote:
> I am trying to replicate the igb_uio for realtek card on my system. I saw the
> igb_uio source and it uses no ID table.
>
> Struct pci_driver igb_pci_driver = {
> ??? .id_table = NULL;
> };
>
> So I wanted to understand the mechanism by which the igb_uio binds to a igb
> network card driver.
That does so in a very odd, and strange way and none that I would ever
recommend anyone else doing. It's through userspace only, using the
bind/unbind sysfs files because their tool knows exactly when it is safe
to do it.
But this is not a UIO issue, it's just a PCI driver issue, very far away
from a platform device.
Also, don't try to bind UIO to a device that you don't know exactly how
it works, you will end up with "raw" memory access to the card, which
can cause bad things to happen if you aren't careful.
good luck!
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* UIO driver test
2016-04-15 14:13 ` Gadre Nayan
2016-04-15 14:15 ` Gadre Nayan
@ 2016-04-15 14:20 ` Greg KH
1 sibling, 0 replies; 12+ messages in thread
From: Greg KH @ 2016-04-15 14:20 UTC (permalink / raw)
To: kernelnewbies
On Fri, Apr 15, 2016 at 07:43:41PM +0530, Gadre Nayan wrote:
> Oh offcourse, I forgot.
>
> So then should a char driver interface suffice.
What exactly are you trying to do? What does the char interface have to
do with UIO?
confused,
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* UIO driver test
2016-04-15 13:59 ` Greg KH
2016-04-15 14:13 ` Gadre Nayan
@ 2016-04-15 17:36 ` Mandeep Sandhu
2016-04-16 5:13 ` Gadre Nayan
1 sibling, 1 reply; 12+ messages in thread
From: Mandeep Sandhu @ 2016-04-15 17:36 UTC (permalink / raw)
To: kernelnewbies
>> * Main initialization/remove routines
>> */
>> static int __init uio_dummy_init(void)
>> {
>> printk("uio_dummy_init( )\n" );
>> uio_dummy_device = platform_device_register_simple("uio_dummy", -1,
>> NULL, 0);
You also need to register the UIO driver by calling
uio_register_device() after populating your "struct uio_info"
appropriately.
>
> Why are you using a platform driver and device on x86? That's not going
> to work at all, as your device doesn't have an irq. Please use this on
> a "real" device that has an interrupt assigned to it.
If it's only for learning purpose, I guess one can skip registering a
IRQ handler and use UIO_IRQ_CUSTOM, right?
I did something similar for testing a UIO hotplug bug once. I used to
fake an IRQ event from a timer by using uio_event_notify().
https://github.com/mandeepsandhu/uio-hotplug-test/blob/master/uio_fake_hotplug.c
Although, I'm not sure if the OP wants to do something similar
HTH,
-mandeep
>
> hope this helps,
>
> greg k-h
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 12+ messages in thread* UIO driver test
2016-04-15 17:36 ` Mandeep Sandhu
@ 2016-04-16 5:13 ` Gadre Nayan
0 siblings, 0 replies; 12+ messages in thread
From: Gadre Nayan @ 2016-04-16 5:13 UTC (permalink / raw)
To: kernelnewbies
Hi mandeep,
THanks for sharing the test code. Its a good starting point without
having a physical device or emulating a physical device with Kmalloc
and a fake interrupt.
Thanks.
Nayan
On Fri, Apr 15, 2016 at 11:06 PM, Mandeep Sandhu
<mandeepsandhu.chd@gmail.com> wrote:
>>> * Main initialization/remove routines
>>> */
>>> static int __init uio_dummy_init(void)
>>> {
>>> printk("uio_dummy_init( )\n" );
>>> uio_dummy_device = platform_device_register_simple("uio_dummy", -1,
>>> NULL, 0);
>
> You also need to register the UIO driver by calling
> uio_register_device() after populating your "struct uio_info"
> appropriately.
>
>>
>> Why are you using a platform driver and device on x86? That's not going
>> to work at all, as your device doesn't have an irq. Please use this on
>> a "real" device that has an interrupt assigned to it.
>
> If it's only for learning purpose, I guess one can skip registering a
> IRQ handler and use UIO_IRQ_CUSTOM, right?
>
> I did something similar for testing a UIO hotplug bug once. I used to
> fake an IRQ event from a timer by using uio_event_notify().
> https://github.com/mandeepsandhu/uio-hotplug-test/blob/master/uio_fake_hotplug.c
>
> Although, I'm not sure if the OP wants to do something similar
>
> HTH,
> -mandeep
>
>
>>
>> hope this helps,
>>
>> greg k-h
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-04-16 5:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15 8:29 UIO driver test Gadre Nayan
2016-04-15 8:45 ` anish singh
2016-04-15 10:01 ` Gadre Nayan
2016-04-15 13:59 ` Greg KH
2016-04-15 14:13 ` Gadre Nayan
2016-04-15 14:15 ` Gadre Nayan
2016-04-15 14:21 ` Greg KH
2016-04-16 1:33 ` Gadre Nayan
2016-04-16 1:37 ` Greg KH
2016-04-15 14:20 ` Greg KH
2016-04-15 17:36 ` Mandeep Sandhu
2016-04-16 5:13 ` Gadre Nayan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.