Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp467267rwi; Thu, 20 Oct 2022 00:43:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xmOhRQz+7hEzIziubMBygmMMiwqiZM7LCYWS2+n58w9XS0LwT1WP1p0igCgvSThBvMk/h X-Received: by 2002:a65:6bcb:0:b0:44c:3e11:a7ac with SMTP id e11-20020a656bcb000000b0044c3e11a7acmr10989515pgw.274.1666251808992; Thu, 20 Oct 2022 00:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666251808; cv=none; d=google.com; s=arc-20160816; b=XCpFZ9QYkOoxJlZeak149qdAFRkkzNvFEVO/XhdEaWg084H5pW/PN6AGUz8wm9DNjD Rs5TSueWrA6NdZrLKLuMJ1hnYMugyn2XhdM2tV2OsjMgcB9nyG6tBLjlrqnAiN7MF3nt Tf01eNSwOAyKHNqauM4gwSLa+B/r3PsTu9wmIjtWiXfFgitz+VoVB1I41e7pPYuS6KBN UkpwgIeGrGjLMQUksFfV8lTo1l8SJRncc3yKL/fZI3dFJ9slgUa3/9b+VqLWUDjDVh+g OVlLovFB5qj7Vloz7LjEW24fpqG6D6XBWKAvbuV6ClcZDhP1YARLPMHpvrDu84ol62F5 UtDg== 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=Ip4zOCNr5BPBIVtRhOQUvSxHGrSXUqEw16dJm2BRt00=; b=b+rvFihrZaDbOfDf+/mbpQ1oqkfjpIXUEc0eFt0aw5cKXmroi8PtRxXTmiVTbB7y3m 2zd/0r1lyi/7rnum7X5h0fmJtUmq1RKUIVTJZVfUZ8/Olxw2gioYV4t0ek3o0QVffVj1 OrQzdxz74t32wpU53ee3EMRdUfF9QsNliC/So/JdfVhMmz6O+WJg0tn9kPwWzazIU5Xs lVLGetLQyUKcRQYgR3foSCc5V3EeqRU7K9t7pdfdSF/HBAH3re7QUEKk+sGu65jdR7oV fLfvPgQ86B1GWXGzvAsDiiz6nTQt1moVZy8Uy1vqAg91ynWp750ahNcegifNQbQxBkY3 qH/Q== 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 p2-20020a170902e74200b00174665bbc29si24591749plf.161.2022.10.20.00.43.17; Thu, 20 Oct 2022 00:43:28 -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 S230340AbiJTHi2 (ORCPT + 99 others); Thu, 20 Oct 2022 03:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbiJTHiX (ORCPT ); Thu, 20 Oct 2022 03:38:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 334DC16EA09 for ; Thu, 20 Oct 2022 00:38:21 -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 ams.source.kernel.org (Postfix) with ESMTPS id E5F73B8265D for ; Thu, 20 Oct 2022 07:38:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE588C433D6; Thu, 20 Oct 2022 07:38:16 +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 2/4] irqchip/loongson-eiointc: Add suspend/resume support Date: Thu, 20 Oct 2022 15:35:25 +0800 Message-Id: <20221020073527.541845-3-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221020073527.541845-1-chenhuacai@loongson.cn> References: <20221020073527.541845-1-chenhuacai@loongson.cn> 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 Add suspend/resume support for EIOINTC irqchip, which is needed for upcoming suspend/hibernation. Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongson-eiointc.c | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c index efead0bfb1ca..fa2f99d30c08 100644 --- a/drivers/irqchip/irq-loongson-eiointc.c +++ b/drivers/irqchip/irq-loongson-eiointc.c @@ -17,6 +17,7 @@ #include #include #include +#include #define EIOINTC_REG_NODEMAP 0x14a0 #define EIOINTC_REG_IPMAP 0x14c0 @@ -301,6 +302,37 @@ static struct irq_domain *acpi_get_vec_parent(int node, struct acpi_vector_group return NULL; } +static int eiointc_suspend(void) +{ + return 0; +} + +static void eiointc_resume(void) +{ + int i, j; + struct irq_desc *desc; + struct irq_data *irq_data; + + eiointc_router_init(0); + + for (i = 0; i < nr_pics; i++) { + for (j = 0; j < VEC_COUNT; j++) { + desc = irq_resolve_mapping(eiointc_priv[i]->eiointc_domain, j); + if (desc && desc->handle_irq && desc->handle_irq != handle_bad_irq) { + raw_spin_lock(&desc->lock); + irq_data = &desc->irq_data; + eiointc_set_irq_affinity(irq_data, irq_data->common->affinity, 0); + raw_spin_unlock(&desc->lock); + } + } + } +} + +static struct syscore_ops eiointc_syscore_ops = { + .suspend = eiointc_suspend, + .resume = eiointc_resume, +}; + static int __init pch_pic_parse_madt(union acpi_subtable_headers *header, const unsigned long end) { @@ -375,6 +407,7 @@ int __init eiointc_acpi_init(struct irq_domain *parent, parent_irq = irq_create_mapping(parent, acpi_eiointc->cascade); irq_set_chained_handler_and_data(parent_irq, eiointc_irq_dispatch, priv); + register_syscore_ops(&eiointc_syscore_ops); cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_LOONGARCH_STARTING, "irqchip/loongarch/intc:starting", eiointc_router_init, NULL); -- 2.31.1