From patchwork Sat May 20 06:38:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5ZCV5bu65rCR?= X-Patchwork-Id: 96732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp183360vqo; Fri, 19 May 2023 23:39:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4HrXb0+p7LL4E7VAidZDWdMqabY1yvutAXPBJFgs2iCNoye5s/DwFisTad6ko2vWU5r4qY X-Received: by 2002:a17:902:d4c5:b0:1ac:6b92:70c8 with SMTP id o5-20020a170902d4c500b001ac6b9270c8mr6006625plg.48.1684564748096; Fri, 19 May 2023 23:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684564748; cv=none; d=google.com; s=arc-20160816; b=t9yzdkqvr1ADrGOECVMOBm5nO9ePnVhym0IRBG60UOtQfWfhhZ2y0K8p5IONFgcdaG iQV1adpxfi8EsdA9W2IL68TuW2l+Un6UW/XlO+8F7FeW0GKjS9Oap0Usha3xeoq/X6ud eOOMiaQTEIImksWfXIQLTuYWHTZCFfa40hAFZVzVaUDDoJxTHf9ahj1L8IbghjKmbxvf pP9qg/kzNvn3CFevokeTIz7UgL1YR7Ggdwgc0NjDX7EQoGveuzhMQWl1c1zPXbZYjePD gL7ivyj6hLiPKyYB8IUAvz+Tx0lp+rjbOytMy+yHsI5VUpLMjhk5Gn17zyh2kn6XAK9j C6LA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cKTyBDzdqlpOVQU4bno15c7kSsRJ86GiBx3v4w5fLdk=; b=noRDf7XNTVf5VUODdSi1bWbCmSzcd1bOjTHIDrh8CyqchUrUwJWG6dKxQvalo8vkV5 WpNcXU92ySYoD5omsOSrdkpfZ58GsxuXITQGhs8aWn2P++0Ju01Ry/3CbMPP1UItUtE6 icXcaNpnz5Ky+PrgGg8aqEnV9UvWQaGT246Snjz6xt8b8KZAQE2IuPLtUkBWPSPRF7xM 3sbenDxIh7ZFbK+aHfopSY/VVuxmqjhR7e/OGSLmoVlwD7Qvk1g0OdFxmMJro5Yi/sbV 3YHg9qMRkoZeXyktiLYFPD0XqRcVumqm/Lle1VR+lnZZppU6n7DpFZS91aAlOTkyc4yB CdtQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz11-20020a170902ef8b00b001a980a2b405si841813plb.471.2023.05.19.23.38.54; Fri, 19 May 2023 23:39:08 -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 S229950AbjETGi2 (ORCPT + 99 others); Sat, 20 May 2023 02:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjETGi0 (ORCPT ); Sat, 20 May 2023 02:38:26 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 42ABC1A8; Fri, 19 May 2023 23:38:24 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.176]) by gateway (Coremail) with SMTP id _____8CxuOnfamhk5V4KAA--.18097S3; Sat, 20 May 2023 14:38:23 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.176]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxFLXaamhkd1JrAA--.51105S3; Sat, 20 May 2023 14:38:22 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen , loongson-kernel@lists.loongnix.cn, stable@vger.kernel.org Subject: [PATCH V1 1/4] irqchip/loongson-pch-pic: Fix initialization of HT vector register Date: Sat, 20 May 2023 14:38:15 +0800 Message-Id: <20230520063818.27208-2-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230520063818.27208-1-lvjianmin@loongson.cn> References: <20230520063818.27208-1-lvjianmin@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxFLXaamhkd1JrAA--.51105S3 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7AF17uFyrZr48urWftw1kXwb_yoW8uw13pa yaqa1avr4UJr4UKFy8Ga1rXFy3Ja9xC39rKa1Yyrn3Xws8Ca4DKrsrA3W0vFWxCrWUZ3W3 ZrWSvF1rC3W5AF7anT9S1TB71UUUUjDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bSxYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l n4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6x ACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E 87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxV Aaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxY O2xFxVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGV WUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_ Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rV WUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4U JbIYCTnIWIevJa73UjIFyTuYvjxU4Xo7DUUUU X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,RCVD_IN_SBL_CSS, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766394165388886189?= X-GMAIL-MSGID: =?utf-8?q?1766394165388886189?= In a dual-bridge system based ACPI, the IRQ on PCH PIC of each bridge sent to CPU is always a zero-based number, which means that the IRQ on PCH PIC of each bridge is mapped into vector range from 0 to 63 of upstream irqchip(e.g. EIOINTC). EIOINTC N: [0 ... 63 | 64 ... 255] -------- ---------- ^ ^ | | PCH PIC N | PCH MSI N For example, the IRQ vector number of sata controller on PCH PIC of each bridge is 16, which is sent to upstream irqchip of EIOINTC when an interrupt occurs, which will set bit 16 of EIOINTC. Since hwirq of 16 on EIOINTC has been mapped to a irq_desc for sata controller during hierarchy irq allocation, the related mapped IRQ will be found through irq_resolve_mapping() in the IRQ domain of EIOINTC. So, the IRQ number set in HT vector register should be fixed to be a zero-based number. Cc: stable@vger.kernel.org Signed-off-by: Jianmin Lv Signed-off-by: liuyun Signed-off-by: liuyun Signed-off-by: Jianmin Lv --- drivers/irqchip/irq-loongson-pch-pic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c index e5fe4d50be05..921c5c0190d1 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -401,14 +401,12 @@ static int __init acpi_cascade_irqdomain_init(void) int __init pch_pic_acpi_init(struct irq_domain *parent, struct acpi_madt_bio_pic *acpi_pchpic) { - int ret, vec_base; + int ret; struct fwnode_handle *domain_handle; if (find_pch_pic(acpi_pchpic->gsi_base) >= 0) return 0; - vec_base = acpi_pchpic->gsi_base - GSI_MIN_PCH_IRQ; - domain_handle = irq_domain_alloc_fwnode(&acpi_pchpic->address); if (!domain_handle) { pr_err("Unable to allocate domain handle\n"); @@ -416,7 +414,7 @@ int __init pch_pic_acpi_init(struct irq_domain *parent, } ret = pch_pic_init(acpi_pchpic->address, acpi_pchpic->size, - vec_base, parent, domain_handle, acpi_pchpic->gsi_base); + 0, parent, domain_handle, acpi_pchpic->gsi_base); if (ret < 0) { irq_domain_free_fwnode(domain_handle);