From: "Chan Kim" <ckim@etri.re.kr>
To: "'Greg KH'" <greg@kroah.com>
Cc: kernelnewbies@kernelnewbies.org,
'qemu-discuss' <qemu-discuss@nongnu.org>
Subject: RE: Can't understand /proc/interrupts output for GICv3 case
Date: Mon, 11 Apr 2022 23:15:57 +0900 [thread overview]
Message-ID: <06fc01d84dae$a9e4ebf0$fdaec3d0$@etri.re.kr> (raw)
In-Reply-To: <YlQuSq3cKAYZYVDA@kroah.com>
> > > What bus type is your driver written for?
> > >
> > That sounds very logical. In my case I added it to system bus.
>
> What exactly do you mean by "system bus"?
>
I meant 'sysbus' in qemu code that I showed in the qemu code.
And I think it's the CPU bus.
>
> Where is your kernel code?
>
This is the init function of my char driver. I thought if the struct cdev
contains struct device, maybe I could use the struct device's of_node to
call of_irq_get but it doesn't.
And I remember I've seen the cdev in usually contained in the driver data of
platform driver(?). Can I implement platform driver in kernel module form?
Below is the char driver init code. Currently it's request_irq(6, ... ) but
I want to know out the number 6 using program. If you have any advice,
please tell me.
static int __init chr_driver_init(void)
{
int ret;
/* Allocating Major number */
if ((alloc_chrdev_region(&dev, 0, 1, "axpu_Dev")) < 0) {
printk(KERN_INFO"Cannot allocate the major number..\n");
return -1;
}
printk(KERN_INFO"Major = %d Minor = %d..\n",MAJOR(dev),MINOR(dev));
/* creating cdev structure */
cdev_init(&axpu_cdev, &fops);
axpu_cdev.owner = THIS_MODULE;
/* Adding character device to the system */
if ((cdev_add(&axpu_cdev,dev,1)) < 0) {
printk(KERN_INFO "Cannot add the device to the
system...\n");
goto r_class;
}
/* creating struct class */
if ((dev_class = class_create(THIS_MODULE, "axpu_class")) == NULL) {
printk(KERN_INFO "cannot create the struct class...\n");
goto r_class;
}
/* for interrupt test !! */
/* for vanilla work-around.. already made by mkdev */
if ((device_create(dev_class, NULL, dev, NULL, "axpu_device")) ==
NULL) {
printk(KERN_INFO "cannot create the device ..\n");
goto r_device;
}
else { printk(KERN_INFO "axpu_device created..\n"); }
/**/
vaddr = ioremap(AXPU_BASE, 0x80000);
if(!vaddr)
{
printk(KERN_INFO"Failed to map the address.\n");
release_mem_region(AXPU_BASE,AXPU_SIZE);
return 1;
}
printk("----- AXPU_BASE mapped at vaddr = %px\n", vaddr);
ret = request_irq(6, axpu_irq_handler, IRQF_SHARED, "axpu_irq",
&axpu_cdev);
printk("request_irq returned %d\n", ret); // -EINVAL
printk(KERN_INFO "Device driver inserted ..done properly..\n");
return 0;
r_device :
class_destroy(dev_class);
r_class :
unregister_chrdev_region(dev,1);
return -1;
}
Thank you.
Chan Kim
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2022-04-11 14:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 4:53 Can't understand /proc/interrupts output for GICv3 case Chan Kim
2022-04-11 12:36 ` Chan Kim
2022-04-11 12:49 ` Greg KH
2022-04-11 13:13 ` Chan Kim
2022-04-11 13:34 ` 'Greg KH'
2022-04-11 14:15 ` Chan Kim [this message]
2022-04-11 14:26 ` 'Greg KH'
2022-04-12 2:18 ` Chan Kim
2022-04-12 4:50 ` 'Greg KH'
2022-04-12 4:54 ` Chan Kim
2022-04-12 6:51 ` Chan Kim
2022-04-12 10:14 ` 'Greg KH'
2022-04-11 14:32 ` Peter Maydell
2022-04-11 14:49 ` Greg KH
2022-04-11 14:58 ` Peter Maydell
2022-04-11 14:59 ` Ozgur Karatas
2022-04-11 14:53 ` Ozgur Karatas
2022-04-12 2:43 ` Chan Kim
2022-04-12 7:14 ` Ozgur Karatas
2022-04-12 7:22 ` Chan Kim
2022-04-12 7:29 ` Ozgur Karatas
2022-04-11 13:09 ` Ozgur Kara
2022-04-11 13:16 ` Chan Kim
2022-04-11 13:28 ` Ozgur Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='06fc01d84dae$a9e4ebf0$fdaec3d0$@etri.re.kr' \
--to=ckim@etri.re.kr \
--cc=greg@kroah.com \
--cc=kernelnewbies@kernelnewbies.org \
--cc=qemu-discuss@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.