Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2323954rwl; Sun, 26 Mar 2023 21:02:57 -0700 (PDT) X-Google-Smtp-Source: AKy350bLJ5PaV7nXhJgQiA62axA55H6IBYVNVoHoaAzFnf5+WmH/wx0gdV5XKksXya+2wqCxPYYV X-Received: by 2002:a17:903:52:b0:19d:1c6e:d31e with SMTP id l18-20020a170903005200b0019d1c6ed31emr9023172pla.60.1679889776938; Sun, 26 Mar 2023 21:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679889776; cv=none; d=google.com; s=arc-20160816; b=R253wEpjniS1G+eRNzwJc9+ObotddMpjRDfKqr/RMi/g85uoNqyQ6eMBniBMZq/czT ROfTyB+zc+8/bys7e9Oy6XhTKBV63PSdhGMa0W34QIMHlOmKm2CWwbxSFYMhGGL4HJzX 0b8/i90khFXCebivXLI5DgDztiF0gJBdz+P4DN2zJ6OsqXUtIRfOvNgRIvLJApvbQEcL 71DLtTVzwQzmAnNS5ExgfxRW2hqE/82U3MuSjcJ6QiyQcbyfVcZ9gQvChfSucs8/6c99 MqzslIaFRIA2D5INO/L1d09s10SIXQXFvgZRqQr7m2JeX/9lcmjrg2wCn1sWcqBhb3mk H6CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=CwrpiwAJdt4SlGMbElSdEUwQX9nnYd5eVfyfUutD+FM=; b=MM0QHHQU/YXAN77B41ZpVaIykqwflWhjyQjoA4Frn9ZPkl2OCxglZ4CHD+x2dxlHxn 7hhmQxijLNn+GYvaAjlymd+0nZoIz1+uKM4eDlBdFgYlOWM+JnHDRx30dXxFDwZHD7xb pAkbT6FzbcCRq2VpJUaJqiXPLmBw2SfBVmhrqpGfht3wT2Ka9hxv0oGxvbe1IvL9OPor gCwOb6vuLJ1wr+ohqYYIh3h711F1V2gJ1vJ90MYsnwTrpEkSwLcW5kx7O13L+6/2xQe3 PqO8oVxafsOGc/UkDVwf0BszoMYQUYdCloevDmF1fzU3sgTBctEnZ2rlTUO6bpgkEwvt vZkg== 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 ky6-20020a170902f98600b0019f5311982csi3277957plb.215.2023.03.26.21.02.26; Sun, 26 Mar 2023 21:02:56 -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 S229899AbjC0D7F (ORCPT + 99 others); Sun, 26 Mar 2023 23:59:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbjC0D7C (ORCPT ); Sun, 26 Mar 2023 23:59:02 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 26E792688 for ; Sun, 26 Mar 2023 20:58:59 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.153]) by gateway (Coremail) with SMTP id _____8BxMI+CFCFkdxoSAA--.27863S3; Mon, 27 Mar 2023 11:58:58 +0800 (CST) Received: from [10.20.42.153] (unknown [10.20.42.153]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dxib2BFCFkf8wNAA--.6983S3; Mon, 27 Mar 2023 11:58:58 +0800 (CST) Subject: Re: [PATCH V1 1/5] irqchip/loongson-eiointc: Fix returned value on parsing MADT To: loongson-kernel@lists.loongnix.cn Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen References: <20230324060854.29375-1-lvjianmin@loongson.cn> <20230324060854.29375-2-lvjianmin@loongson.cn> <87h6uagnzo.wl-maz@kernel.org> From: Jianmin Lv Message-ID: Date: Mon, 27 Mar 2023 11:58:57 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <87h6uagnzo.wl-maz@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Dxib2BFCFkf8wNAA--.6983S3 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxZFWUGFyxWF4xur4UJw15CFg_yoW5ZFW3pa y2qFZ8tr4rt34xCr92yr1UXr1rZwn3uayxtrWrGayFvr4DCry3JF42ya1jvryIkr4UGF42 vF4Yqa15uw45A3DanT9S1TB71UUUUjUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bfAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l n4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6x ACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E 87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0V AS07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km 07C267AKxVWUXVWUAwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r 1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWU JVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r 1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUv cSsGvfC2KfnxnUUI43ZEXa7IU8q2NtUUUUU== X-Spam-Status: No, score=-0.0 required=5.0 tests=NICE_REPLY_A,SPF_HELO_PASS, SPF_PASS autolearn=unavailable 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 On 2023/3/24 下午11:36, Marc Zyngier wrote: > On Fri, 24 Mar 2023 06:08:50 +0000, > Jianmin Lv wrote: >> >> In pch_pic_parse_madt(), a NULL parent pointer will be >> returned from acpi_get_vec_parent() for second pch-pic domain >> related to second bridge while calling eiointc_acpi_init() at >> first time, where the parent of it has not been initialized >> yet, and will be initialized during second time calling >> eiointc_acpi_init(). So, it's reasonable to return zero so >> that failure of acpi_table_parse_madt() will be avoided, or else >> acpi_cascade_irqdomain_init() will return and initialization of >> followed pch_msi domain will be skipped. >> >> Although it does not matter when pch_msi_parse_madt() returns >> -EINVAL if no invalid parent is found, it's also reasonable to >> return zero for that. >> >> Change-Id: I4d278534999ec3e5c8db6d40155ba2665d9de86f >> Signed-off-by: Jianmin Lv >> --- >> drivers/irqchip/irq-loongson-eiointc.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c >> index d15fd38c1756..62a632d73991 100644 >> --- a/drivers/irqchip/irq-loongson-eiointc.c >> +++ b/drivers/irqchip/irq-loongson-eiointc.c >> @@ -343,7 +343,7 @@ static int __init pch_pic_parse_madt(union acpi_subtable_headers *header, >> if (parent) >> return pch_pic_acpi_init(parent, pchpic_entry); >> >> - return -EINVAL; >> + return 0; > > Why can't you detect this particular case instead of blindly > suppressing the error? > For dual-bridges scenario, parent handle for pch_pic IRQ domain will be set by acpi_set_vec_parent() during each eiointc initialization. And the parent handle for one pch_pic will be set during *first* eiointc entry parsing, and the parent handle for another pch_pic will be set during *second* eiointc entry parsing. But two pch_pic entries will be parsed during each eiointc entry parsing, so a NULL parent pointer must be returned druing first eiointc initialization, which is reasonable and should not be treated as an error. The calling stack of pch_pic_parse_madt (where acpi_get_vec_parent is called to get parent handle) is like this: cpuintc_acpi_init acpi_cascade_irqdomain_init(in cpuintc driver) acpi_table_parse_madt eiointc_parse_madt eiointc_acpi_init /* this will be called two times corresponding to parsing two eiointc entries in MADT under dual-bridges scenario*/ acpi_set_vec_parent /* set parent handle for one pch_pic during first eiointc entry parsing, and set parent handle for another pch_pic during second eiointc entry parsing*/ acpi_cascade_irqdomain_init(in eiointc driver) acpi_table_parse_madt pch_pic_parse_madt /* this will be called twice because of two pchpic entries, and only one valid parent handle will be returned from acpi_get_vec_parent() during first eiointc entry parsing (another parent handle is not set yet), so a NULL parent pointer must be returned during first eiointc entry parsing, which is reasonable and should not be treated as an error.*/ Thanks! > M. >