Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp885398rwb; Tue, 27 Sep 2022 06:01:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54LzPzNrCA5ek5KjQzFSbSa3Bi4HhAaVcvXrqD16u7/v+2c0pkEqIMA8Rzcl6MaMK9k/yl X-Received: by 2002:a17:906:eec7:b0:733:189f:b07a with SMTP id wu7-20020a170906eec700b00733189fb07amr23447843ejb.230.1664283695837; Tue, 27 Sep 2022 06:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664283695; cv=none; d=google.com; s=arc-20160816; b=jq7pPEykMHNNYgMNue8KChqYCveR5TvEBWaiLoX5pZJERyqgdpd9lc1f8BwnbBiyE4 5lOcU2Lub8NMO5bJkKe6T79rxRHgd9NiwnjTOBYLYwN1qlgYOU3iOqRRd7KgKePIjyVs fcNLtjvBoXliro/HRiU8feqGNFqTApXo7E6Ee0pVLFmN2GtHX60RGb5JVqZ8ZjJFr/8m GZgL23UjQRtDaJUnBi6kO31RUJUGrQvOVh4XoEhpYejcNmRZ/fIcSppU6UlQnAPC9nMy VVkzmRYZ2TBt7ZYlNdd9T0BP2bOkNHIlhQQmBtHhNWxc+gdUWtev/BuJQKIU/N8hb+9F vITQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=r0DCtOWQ7Zibxz4lXHsqdCIY8wfegerKOJJibws7Xbk=; b=qUYAoKcG7B3haC1PKa/NgFT6+hxtmqrTewtE2CdhAa9Mv7ULD4wtSL6mQGKFqrhLYm 5An5VXdvPCYIzC2fKNuj/1UqqbPVFeq+72wqm3aPwvgOGx11vjlD2qGE30ABnVRtDEdX whOBbxyddMhR/SGlFWqgHB5NFdmSSNmWX5ajwH/ujpAzUrjGlPYtSSpqbzuz1FGZReJY +pEJUxOsJj+R2Y9Sm3EJI4RkvrsaqBQhwE05a2Qjbem2URpFAMFwlTVYBr0FxEk3Cx+W wcpEVOMAMjybhRTHs3YLhWejPveGvw4H2zSpsh5yvOmmRZQdV2p2StpAx04ekJuLmMkS w4iA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a170906211100b007833cbbb747si1079085ejt.578.2022.09.27.06.01.07; Tue, 27 Sep 2022 06:01:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231196AbiI0MrQ (ORCPT + 99 others); Tue, 27 Sep 2022 08:47:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbiI0MrO (ORCPT ); Tue, 27 Sep 2022 08:47:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7293146F9A for ; Tue, 27 Sep 2022 05:47:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4288B6179B for ; Tue, 27 Sep 2022 12:47:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E222C433D6; Tue, 27 Sep 2022 12:47:10 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner , Marc Zyngier Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V2] irqchip: Make irqchip_init() usable on pure ACPI systems Date: Tue, 27 Sep 2022 20:45:57 +0800 Message-Id: <20220927124557.3246737-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pure ACPI system (e.g., LoongArch) doesn't select OF and OF_IRQ, but it still need a non-empty irqchip_init(). So, change the IRQCHIP dependency from OF_IRQ to (OF_IRQ || ACPI_GENERIC_GSI), and then define an empty inline of_irq_init() in the !CONFIG_OF_IRQ case, so as to make the non- empty irqchip_init() be usable on pure ACPI systems. Without this patch we get such errors: [ 0.000000] NR_IRQS: 576, nr_irqs: 576, preallocated irqs: 16 [ 0.000000] Kernel panic - not syncing: IPI IRQ mapping failed [ 0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.0.0-rc6+ #2189 [ 0.000000] Hardware name: Loongson Loongson-3A5000-7A1000-1w-CRB/Loongson-LS3A5000-7A1000-1w-CRB, BIOS vUDK2018-LoongArch-V2.0.pre-beta8 08/18/2022 [ 0.000000] Stack : 0000000000000000 9000000000fa4388 900000000140c000 900000000140fb70 [ 0.000000] 0000000000000000 900000000140fb70 90000000012f4aa0 900000000140fa98 [ 0.000000] 900000000140fa0c 900000008140f9ff 0000000000000030 0000000000000005 [ 0.000000] 900000000578f708 0000000004750000 0000000000000000 00000000ffffdfff [ 0.000000] 0000000000000000 0000000000000000 0000000000000030 000000000000002f [ 0.000000] 900000000141f000 0000000004750000 9000000001427348 00000000000000b0 [ 0.000000] 90000000012f4aa0 0000000000000004 0000000000000000 9000000001020000 [ 0.000000] 9000000005781b80 9000000005781ba9 0000000000000000 9000000001315e30 [ 0.000000] 900000000129a3b0 9000000000222b64 0000000000000000 00000000000000b0 [ 0.000000] 0000000000000004 0000000000000000 0000000000070000 0000000000000800 [ 0.000000] ... [ 0.000000] Call Trace: [ 0.000000] [<9000000000222b64>] show_stack+0x24/0x124 [ 0.000000] [<9000000000fa4388>] dump_stack_lvl+0x60/0x88 [ 0.000000] [<9000000000f9965c>] panic+0x130/0x2f8 [ 0.000000] [<9000000000fd4324>] init_IRQ+0xa8/0x240 [ 0.000000] [<9000000000fd0b38>] start_kernel+0x488/0x5f0 [ 0.000000] [<9000000000fb10c4>] kernel_entry+0xc4/0xc8 [ 0.000000] [ 0.000000] ---[ end Kernel panic - not syncing: IPI IRQ mapping failed ]--- Signed-off-by: Huacai Chen --- drivers/irqchip/Kconfig | 2 +- include/linux/of_irq.h | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 66b9fa408bf2..93ad04d58f17 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -3,7 +3,7 @@ menu "IRQ chip support" config IRQCHIP def_bool y - depends on OF_IRQ + depends on (OF_IRQ || ACPI_GENERIC_GSI) config ARM_GIC bool diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index 83fccd0c9bba..d6d3eae2f145 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -37,9 +37,8 @@ extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data); extern int of_irq_to_resource(struct device_node *dev, int index, struct resource *r); -extern void of_irq_init(const struct of_device_id *matches); - #ifdef CONFIG_OF_IRQ +extern void of_irq_init(const struct of_device_id *matches); extern int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq); extern int of_irq_count(struct device_node *dev); @@ -57,6 +56,9 @@ extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev, extern void of_msi_configure(struct device *dev, struct device_node *np); u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in); #else +static inline void of_irq_init(const struct of_device_id *matches) +{ +} static inline int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq) { -- 2.31.1