Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D415CC433F5 for ; Mon, 11 Apr 2022 13:13:55 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1ndtrb-0003AD-JQ; Mon, 11 Apr 2022 09:13:51 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.94.2) (envelope-from ) id 1ndtrY-0003A3-DM for kernelnewbies@kernelnewbies.org; Mon, 11 Apr 2022 09:13:49 -0400 Received: from unknown (HELO send002-relay.gov-dooray.com) (211.180.235.153) by 129.254.9.16 with ESMTP; 11 Apr 2022 22:13:44 +0900 X-Original-SENDERIP: 211.180.235.153 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.112] (HELO smtp002-imp.gov-dooray.com) ([10.162.225.112]) by send002-relay.gov-dooray.com with SMTP id cd6d1bb962542988; Mon, 11 Apr 2022 22:13:44 +0900 DKIM-Signature: a=rsa-sha256; b=RupQqxOGHkIhtanp2iRRhHZS0VTJUsffIZdcgUN8dvPjynJCitQarjThein74qGwHXQMblxQj7 KD6aZDyoHBwpAJE7PoleC/i52mJwHXw64y7FgTeAtKFjyLrxqrt8JhDMk0mLMYua4cbc2KH5N9St /flXVLNL9GLfUUecBeoTudNm3tIjA+sLF3XaC/RFA46hHVr7ke76HN0uK//StfU709Aa497INIfn cz46sn/ymPu3Bbz4a30661Vj/YaQbFyNdKB/6OmKmKzA0LJxVde0lV4sMjrxKKPQkeHVRuZIwtsf sRSB5IW4L3SYlmV0ECwhpz2QLmOo3SIhravJM94g==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=Z1fK/+LCiHYAommjK5tq+uGnB3b2D71zbElejROKI0o=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp002-imp.gov-dooray.com with SMTP id bde2ed7d62542987; Mon, 11 Apr 2022 22:13:44 +0900 From: "Chan Kim" To: "'Greg KH'" References: <049201d84b04$951cbab0$bf563010$@etri.re.kr> <06c401d84da0$bc1a5ca0$344f15e0$@etri.re.kr> In-Reply-To: Subject: RE: Can't understand /proc/interrupts output for GICv3 case Date: Mon, 11 Apr 2022 22:13:42 +0900 Message-ID: <06cf01d84da5$f7a1fa80$e6e5ef80$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: AQKunJY+kgmmewJd0lkF9aO9YfiVjAIaT1gqAvLDBPirFaW5IA== Cc: kernelnewbies@kernelnewbies.org, 'qemu-discuss' X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org 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 _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies