On Mon, Apr 11, 2022 at 10:13:42PM +0900, Chan Kim wrote: > Hi, Greg K-H, > Thanks for replyaing. > > > > You ask the system for it. It depends on the bus type your driver is > > written for for how to do this. > > > > For example, if you have a platform driver, you would call > > platform_get_irq(). If you are a pci driver, the irq for your device is > > already stored in the pci device structure passed into your probe > function. > > > > 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"? > This is the qemu code making fdt. > > static void create_ab21q_axpu_device(const Ab21qMachineState *vms) > { > char *nodename; > printf("create_ab21q_axpu_device called!\n"); > hwaddr base = vms->memmap[AB21Q_AXPU].base; > hwaddr size = vms->memmap[AB21Q_AXPU].size; > int irq = vms->irqmap[AB21Q_AXPU]; > const char compat[] = "ab21q-axpu"; > > sysbus_create_simple("ab21q-axpu", base, qdev_get_gpio_in(vms->gic, > irq)); > > nodename = g_strdup_printf("/ab21q_axpu@%" PRIx64, base); > qemu_fdt_add_subnode(vms->fdt, nodename); > qemu_fdt_setprop(vms->fdt, nodename, "compatible", compat, > sizeof(compat)); > qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", 2, base, 2, > size); > qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts", > GIC_FDT_IRQ_TYPE_SPI, irq, > GIC_FDT_IRQ_FLAGS_LEVEL_HI); > qemu_fdt_setprop_cell(vms->fdt, nodename, "interrupt-parent", > vms->gic_phandle); > > g_free(nodename); This is qemu code, not kernel code. > } > > I understand it creates the device axpu and connects its irq output to a > gpio input connected to gic interrupt controller. Again, this is qemu code, not kernel code. > But this driver is not in the form of platform device/driver. (a char > device). What function should I use to get the irq number in this case? > I couldn't find a function with a likely name in the tags file for linux > source.(5.4.188) Where is your kernel code? confused, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies