From patchwork Thu Oct 20 08:22:02 2022 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: 6045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp136205wrs; Thu, 20 Oct 2022 01:34:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DUb5/lXt0qsz0ScKfj/+ofA0B+bUL+sUeBp7zQIRyRco1hDPEWOkhWbamc3Dvm19nkyDR X-Received: by 2002:a17:906:5dda:b0:78d:e7d2:7499 with SMTP id p26-20020a1709065dda00b0078de7d27499mr10108720ejv.588.1666254889452; Thu, 20 Oct 2022 01:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666254889; cv=none; d=google.com; s=arc-20160816; b=eAJRuijph+y+AmDjPt6IYQxcpn7J+cgX0NXcqf8ZRKv/l9sivlu6IPQSco7JrxmVCI 5iOSZ22Z961jflzPCk2bjPr0jz7ILylBh9M0+Wu78M8n1vu+qAkWFuY2/45LpFBbkBwg FQcjrQpVnY/9aYB7lstv3D/gmNcNt96HERdiKmOehx15h0g76OvpXGtlUr9mud4jH/Qs zCJgXq3965REZCXUGx2qMCzI81x5qdSpYi4QzB+GfxcaayASqoskxqN4LEkD4pp3Kn9O 3I7+Id7LXbQww743RILQIq50uY8HJMCSjHoFncqTUhL5AvbASNNazkuq63TJPpsnEZMN vdHw== 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=kSuFB1QWIffB/NcM+KOoJZWOVxC0FRjVYnrK+9hs5ts=; b=RKN8eQ8HiW7QyzfblEjVo4Aax+PQSrv6w4ig9XH6XjrjGwEaDFhVGWM0cadCYtIMZ4 YAApKHDx1p8CI4aQwfqUfmVlmqaF65NItDvRy2VoZD1R4KwFN9t3uoYGGm7Gm0I2CdKm H6kIux2i19pRTDMO0Lo48a6qEqqCwRHmTo/Mszs0LlAbLXjO1s1nA2DTjx3sFIDNTefp z1No/kC03oG4j2vlEGSuhEpp1rDzSh5svSpg6fKcWw6dh49YuZ39TbbXMeuHnBs5Pi9T gNrXKhi1oyw1WCIjYYpEfa8mmQz6Dj/uTzjDwaAlZtoX+ZFPp/OmlQDWxbRqLWmLrpol VRkQ== 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 k5-20020a1709062a4500b0079195ddab1bsi5995270eje.221.2022.10.20.01.34.22; Thu, 20 Oct 2022 01:34:49 -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 S230441AbiJTIWa (ORCPT + 99 others); Thu, 20 Oct 2022 04:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbiJTIWK (ORCPT ); Thu, 20 Oct 2022 04:22:10 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FB6215B110; Thu, 20 Oct 2022 01:22:07 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.32]) by gateway (Coremail) with SMTP id _____8BxLtsuBVFjJvwAAA--.5004S3; Thu, 20 Oct 2022 16:22:06 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.32]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxLuItBVFjxM4BAA--.7555S3; Thu, 20 Oct 2022 16:22:05 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Jiaxun Yang , Huacai Chen , Bjorn Helgaas , Len Brown , rafael@kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH V4 1/4] ACPI / PCI: fix LPIC IRQ model default PCI IRQ polarity Date: Thu, 20 Oct 2022 16:22:02 +0800 Message-Id: <20221020082205.20505-2-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221020082205.20505-1-lvjianmin@loongson.cn> References: <20221020082205.20505-1-lvjianmin@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxLuItBVFjxM4BAA--.7555S3 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxJrW3XFW3ZFWfZFyktFWxXrb_yoW8ArWxpF ZF93Wayr48tFs8XwsFk3WxZry5J3Z3Cryjkrs5Cw4Uua1Dur4IqFyxWFW3Jr98WFZrZa1U ZryYyw48Way7uFJanT9S1TB71UUUUj7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bS8YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JF0_JFyl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAa w2AFwI0_JF0_Jw1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44 I27wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2 jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262 kKe7AKxVWUAVWUtwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km 07C267AKxVWUAVWUtwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r 1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWU CVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r 1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1U YxBIdaVFxhVjvjDU0xZFpf9x07jr6p9UUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747194886558016070?= X-GMAIL-MSGID: =?utf-8?q?1747194886558016070?= On LoongArch ACPI based systems, the PCI devices (e.g. sata controlers and PCI-to-to PCI bridge controlers) existed in Loongson chipsets output high-level interrupt signal to the interrupt controller they connected to, while the IRQs are active low from the perspective of PCI(in 2.2.6. Interrupt Pins, "Interrupts on PCI are optional and defined as level sensitive, asserted low), which means that the interrupt output of PCI devices plugged into PCI-to-to PCI bridges of Loongson chipset will be also converted to high-level. So high level triggered type is required to be passed to acpi_register_gsi() when creating mappings for PCI devices. Signed-off-by: Jianmin Lv --- drivers/acpi/pci_irq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 08e15774fb9f..ff30ceca2203 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -387,13 +387,15 @@ int acpi_pci_irq_enable(struct pci_dev *dev) u8 pin; int triggering = ACPI_LEVEL_SENSITIVE; /* - * On ARM systems with the GIC interrupt model, level interrupts + * On ARM systems with the GIC interrupt model, or LoongArch + * systems with the LPIC interrupt model, level interrupts * are always polarity high by specification; PCI legacy * IRQs lines are inverted before reaching the interrupt * controller and must therefore be considered active high * as default. */ - int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC ? + int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC || + acpi_irq_model == ACPI_IRQ_MODEL_LPIC ? ACPI_ACTIVE_HIGH : ACPI_ACTIVE_LOW; char *link = NULL; char link_desc[16]; From patchwork Thu Oct 20 08:22:03 2022 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: 6043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp136033wrs; Thu, 20 Oct 2022 01:34:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FjK1AKIyJA+CqAJtd7Ua5vrVq1uywZvph87lfvtsl4iyQl/A4R7fPDdcpx4U177H2JacO X-Received: by 2002:a17:907:d07:b0:72e:ec79:ad0f with SMTP id gn7-20020a1709070d0700b0072eec79ad0fmr10263525ejc.296.1666254861574; Thu, 20 Oct 2022 01:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666254861; cv=none; d=google.com; s=arc-20160816; b=UljRfJBeILn1hcqtYIg7ZqZoXy1aG1yvVVbErNYZvdhVPbqXPCf2q08nVWarkjbWV6 nXw4MIY7tUVGVUphHv3E+dy0Fjve5YQgtjiPfkTDg/2hHuCZn/DHlU5eFwqZcW3YHnpG J5gN15/b9eOxYWQGDUY9089LFJhaqr2S7i3KDGVj4UmPDOItNrlGBJ95upY8cx9EwI0L ImRsK2NDl1ZmtpvCzxlDMilCiPMhZlKcpGsxnOVGnyaMMwEAiV+Xc0ta51V5W+/vFXyW 70W6BZK+02QSkHLOmBF/BKPnUoULhtZxngSJwmoxV1hfyCG6lszwGUj5D0g6hMbOGz9p mHQQ== 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=zgOd34BXqS87z+6TAGzoILQvVlwJSiusbLJmO87vHak=; b=GCodfUjJNOesYtzjXLRGcYczTehZx3YowxOMsG+7Uq1RIybtATEhtta64WI8YwXfGk NhfYZ0fMNn3ub1+OTN+Dkp7jmYAsDBg9+HIU36nEswZ4Dj+piCDa1V2Q8xdkvNkO1U2V oCgrBbslamRjNL0izcD4f5kCt49gYxPgiPmrvCl/MoQM8llELzOgUEbms855rdIoSA72 /UGZSLVvPNCo73NHWb3PGUbP7iORdkG8ZbTGOU1+exjRB8T0XDFwnbzCpNaHNSL9O1V0 1rmtcEXuFS0mEMbNXM5WQSes1eJJ51tKXDVpSBIjmn9QZLmjonhyoIPctuRA5tHb+74S MZ4w== 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 i23-20020a170906251700b007827639faffsi14420523ejb.760.2022.10.20.01.33.56; Thu, 20 Oct 2022 01:34:21 -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 S230162AbiJTIWQ (ORCPT + 99 others); Thu, 20 Oct 2022 04:22:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbiJTIWK (ORCPT ); Thu, 20 Oct 2022 04:22:10 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FC1815CB1B; Thu, 20 Oct 2022 01:22:07 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.32]) by gateway (Coremail) with SMTP id _____8CxKdguBVFjMPwAAA--.3053S3; Thu, 20 Oct 2022 16:22:06 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.32]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxLuItBVFjxM4BAA--.7555S4; Thu, 20 Oct 2022 16:22:06 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Jiaxun Yang , Huacai Chen , Bjorn Helgaas , Len Brown , rafael@kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH V4 2/4] irqchip/loongson-pch-pic: fix translate callback for DT path Date: Thu, 20 Oct 2022 16:22:03 +0800 Message-Id: <20221020082205.20505-3-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221020082205.20505-1-lvjianmin@loongson.cn> References: <20221020082205.20505-1-lvjian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ryUMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr 0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUv cSsGvfC2KfnxnUUI43ZEXa7IU14v3UUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747194857786629322?= X-GMAIL-MSGID: =?utf-8?q?1747194857786629322?= In DT path of translate callback, if fwspec->param_count==1 and of_node is non-null, fwspec->param[1] will be accessed, which is introduced from previous commit bcdd75c596c8 (irqchip/loongson-pch-pic: Add ACPI init support). Before the patch, for non-null of_node, translate callback (use irq_domain_translate_twocell()) will return -EINVAL if fwspec->param_count < 2, so the check in the patch is added. Fixes: bcdd75c596c8 ("irqchip/loongson-pch-pic: Add ACPI init support") Signed-off-by: Jianmin Lv --- drivers/irqchip/irq-loongson-pch-pic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c index c01b9c257005..03493cda65a3 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -159,6 +159,9 @@ static int pch_pic_domain_translate(struct irq_domain *d, return -EINVAL; if (of_node) { + if (fwspec->param_count < 2) + return -EINVAL; + *hwirq = fwspec->param[0] + priv->ht_vec_base; *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; } else { From patchwork Thu Oct 20 08:22:04 2022 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: 6044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp136172wrs; Thu, 20 Oct 2022 01:34:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LsDi4MhmBr9mD2Cffbn6Da1yyP8yyKTinTlcyeSIqUGwadvaDpef2DRCKh7XfwtFY8rR5 X-Received: by 2002:a17:906:9750:b0:798:9ccc:845d with SMTP id o16-20020a170906975000b007989ccc845dmr659828ejy.760.1666254884038; Thu, 20 Oct 2022 01:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666254884; cv=none; d=google.com; s=arc-20160816; b=MYSUQne/VW6DZ8vPx4jYFok8hjOmNIqUU9dDeS05WppVUpSFK2Y696mrgBt35DFF3A yMYue0ZI7HuFcwZrNLG3zT7w2NefpwGfR23c3S3wzw9u4IeXcsVWYfKnVPEa+oAwcV1u WJmcOi5mG2N1h9EBR/LdtuCUB46GVD4pHjclRVJZgJnOAUmVKME9ejYslMsc71X5RU/g 8Gk5av+0HheMEKq0FKl8r9Ji9LgRp1EWCOeTpNHEMqHvG/GQqdspvKepGpSBSaWCw3m2 ujOMKfK4HbO4NvAlveC6OKcgBjH6ywokR/pLWbTrkeAsWHwNavm230LR3+rkWSh+6+3A /TDw== 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=3rt7h29pHhj8gnoFE5mk1YvjH3+fMwFTQoIDOsGZthg=; b=hneqVivp6hyISml4Md8OPKQ3XXZoH1/+UhSckOCIZcsvMfDyJs1ahP7rY1Vhxm1miI U/fqOVQXaaTGDIMv9zz7zDWtHLmA/iSMKs7k9bdDEW5uabGHku2wE/vYzYW1Ma91VBS9 TCRQ+A/9OUdJAEB+ZCe9O7We7tLXiGDTPDe8AeZtLyf2DmfCcffzUSgfFE1uz9NA+3Vi gk8KKf8uJoEJQX/jKVt6Izf7ymD9t97NAYboPmV5XDf9y8V1NyNHrhmwrF8HHTsrXCHQ OBwgLgXApPkL2Y9tNYPHJkKA1y+HAsuPXAyjHeifYrTZTzFdybe6/ew2uKu7SDYbz13M OpuA== 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 he18-20020a1709073d9200b0078ca7bbf616si18143126ejc.746.2022.10.20.01.34.19; Thu, 20 Oct 2022 01:34:44 -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 S231273AbiJTIWV (ORCPT + 99 others); Thu, 20 Oct 2022 04:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbiJTIWK (ORCPT ); Thu, 20 Oct 2022 04:22:10 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7B3EE15CB1C; Thu, 20 Oct 2022 01:22:07 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.32]) by gateway (Coremail) with SMTP id _____8CxKdguBVFjM_wAAA--.3054S3; Thu, 20 Oct 2022 16:22:06 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.32]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxLuItBVFjxM4BAA--.7555S5; Thu, 20 Oct 2022 16:22:06 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Jiaxun Yang , Huacai Chen , Bjorn Helgaas , Len Brown , rafael@kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH V4 3/4] irqchip/loongson-pch-pic: Support to set IRQ type for ACPI path Date: Thu, 20 Oct 2022 16:22:04 +0800 Message-Id: <20221020082205.20505-4-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221020082205.20505-1-lvjianmin@loongson.cn> References: <20221020082205.20505-1-lvjianmin@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxLuItBVFjxM4BAA--.7555S5 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Ar47tr4UJrWfGw48KryxuFg_yoW8GF4UpF W5Cr4avwsrJry7Cw1Fkw4kG343A3s7tFW7KF4UtFnaqrn7G3s5AF1UuFWv9rn5ZFWfAF12 qanYqFW5ua43AFDanT9S1TB71UUUUj7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bSxYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JF0_JFyl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1l84 ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVWxJr0_GcWl n4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6x ACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E 87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxV Aaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxY O2xFxVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGV WUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_ Xr0_Ar1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rV WUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4U JbIYCTnIWIevJa73UjIFyTuYvjxU4eMKDUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747194881422824648?= X-GMAIL-MSGID: =?utf-8?q?1747194881422824648?= For ACPI path, the translate callback used IRQ_TYPE_NONE and ignored the IRQ type in fwspec->param[1]. For supporting to set type for IRQs of the irqdomain, fwspec->param[1] should be used to get IRQ type. Signed-off-by: Jianmin Lv --- drivers/irqchip/irq-loongson-pch-pic.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c index 03493cda65a3..a26a3f59d4a5 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -155,9 +155,6 @@ static int pch_pic_domain_translate(struct irq_domain *d, struct pch_pic *priv = d->host_data; struct device_node *of_node = to_of_node(fwspec->fwnode); - if (fwspec->param_count < 1) - return -EINVAL; - if (of_node) { if (fwspec->param_count < 2) return -EINVAL; @@ -165,8 +162,14 @@ static int pch_pic_domain_translate(struct irq_domain *d, *hwirq = fwspec->param[0] + priv->ht_vec_base; *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; } else { + if (fwspec->param_count < 1) + return -EINVAL; + *hwirq = fwspec->param[0] - priv->gsi_base; - *type = IRQ_TYPE_NONE; + if (fwspec->param_count > 1) + *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; + else + *type = IRQ_TYPE_NONE; } return 0; From patchwork Thu Oct 20 08:22:05 2022 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: 6046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp136831wrs; Thu, 20 Oct 2022 01:36:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ufJnMHGT8bJGguH066wKPpcczR+TBEB4fKutKU9+hVqQafiXC0nVJ3wC7cI+PAglEwcS4 X-Received: by 2002:a17:907:7f25:b0:78d:e85e:fe12 with SMTP id qf37-20020a1709077f2500b0078de85efe12mr10036898ejc.553.1666255009562; Thu, 20 Oct 2022 01:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666255009; cv=none; d=google.com; s=arc-20160816; b=cDmdrzl29sHG/hmLRXcvE99UyJsgaw79a59uzRGbXYi5hZQCIYdPHrmPrOMRXi8kNz +JrtC0NygALEkrJQwBVIqKsEbmzkbI7zScvQxqsOTxvivbYiBn8OLwDEFuCF/gBKSmy0 sJK1j3GKDzSAQ2xVQuhNdLeYm0cu6A+JPVIcRpYLCaItutMBcmvaGy+Z/2Z8LIdbdfyt rO4uVceFCn7RQft/k5dAapcn0DbZGJ3v+EcG2G21OZLP6eCAIHFod/UuF3bug++L9EnQ Pk23GPZ0ZynBm9RcMJyKfAq+rwCHkLuWKDDuOWR0nALZ0O9JK1z/C9MoI+jdUoI4CC7F PYdA== 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=NvBM4Q7lvcsq90N0nsp8WRhih8UGBEzZPYn3ZIequKE=; b=UVzYSE/Qog3LWpFdaOy4zaHq6Mkun0thPu5HJe7SyItsLkqyeJCV1LdXlNyXHq7geY GngIajegCIN7UC5Ojdzj4r/Y4b9nIYnwdz8zOXQr4Va5nKnYzcitFRqCjOeqXbjNXQVA RBnmJ29KbJZreP95inEfptE3JsmOo4XFAUyEOTCTfrnMncT0TznpU+3gPK7extaVBivL Ac6FZ72s3Gs/YIt0HBRzKHrY2D5cH0Jx3i+M/RwgrYARsIc3SywE7+ZNzOweyrS1bA0n GeqMEV5PMZJseVLXoaBKAXhabMqF/8E2j7kolGQza5s6bAYUdcVDkpGVyeLt/9SGprd8 5m0g== 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 ho10-20020a1709070e8a00b0077f92be81adsi17479732ejc.212.2022.10.20.01.36.24; Thu, 20 Oct 2022 01:36:49 -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 S231284AbiJTIW1 (ORCPT + 99 others); Thu, 20 Oct 2022 04:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230230AbiJTIWK (ORCPT ); Thu, 20 Oct 2022 04:22:10 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CA00115D097; Thu, 20 Oct 2022 01:22:07 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.32]) by gateway (Coremail) with SMTP id _____8Bx3NguBVFjOfwAAA--.4993S3; Thu, 20 Oct 2022 16:22:06 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.32]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxLuItBVFjxM4BAA--.7555S6; Thu, 20 Oct 2022 16:22:06 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Jiaxun Yang , Huacai Chen , Bjorn Helgaas , Len Brown , rafael@kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH V4 4/4] irqchip/loongson-liointc: Support to set IRQ type for ACPI path Date: Thu, 20 Oct 2022 16:22:05 +0800 Message-Id: <20221020082205.20505-5-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221020082205.20505-1-lvjianmin@loongson.cn> References: <20221020082205.20505-1-lvjianmin@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxLuItBVFjxM4BAA--.7555S6 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvdXoW7XF4D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IdaVFxhVjvjDU0xZFpf9x07jz5lbUUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747195012728014574?= X-GMAIL-MSGID: =?utf-8?q?1747195012728014574?= For ACPI path, the xlate callback used IRQ_TYPE_NONE and ignored the IRQ type in intspec[1]. For supporting to set type for IRQs of the irqdomain, intspec[1] should be used to get IRQ type. Signed-off-by: Jianmin Lv --- drivers/irqchip/irq-loongson-liointc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c index 0da8716f8f24..838c8fa2d868 100644 --- a/drivers/irqchip/irq-loongson-liointc.c +++ b/drivers/irqchip/irq-loongson-liointc.c @@ -167,7 +167,12 @@ static int liointc_domain_xlate(struct irq_domain *d, struct device_node *ctrlr, if (WARN_ON(intsize < 1)) return -EINVAL; *out_hwirq = intspec[0] - GSI_MIN_CPU_IRQ; - *out_type = IRQ_TYPE_NONE; + + if (intsize > 1) + *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; + else + *out_type = IRQ_TYPE_NONE; + return 0; }