Can't understand /proc/interrupts output for GICv3 case
Chan Kim
ckim at etri.re.kr
Mon Apr 11 09:13:42 EDT 2022
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.
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);
}
I understand it creates the device axpu and connects its irq output to a
gpio input connected to gic interrupt controller.
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)
Thanks a lot!
Chan Kim
More information about the Kernelnewbies
mailing list