From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1265B2FD699 for ; Tue, 2 Dec 2025 06:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764655287; cv=none; b=K5ZM4hm1zn+gUaetODCuj5q2OW5s+Ak7WENhcTnWZV1xqaZHxmoydAh+vHdphCcjRrOy1UuqmbONnTZIM1NVewR/stwzHz8vazH28nJPomy6Q0+2/quk9rLvpV0bx4v7bKdR6UlrcH7UGEvL/Dr0yD5SIkDsyFD9NxEj9QBxwDQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764655287; c=relaxed/simple; bh=3zvw2vemU5qD4hpQfNKeHdfvLW5q+yv2xXKxILPdQo8=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=OGiw7F13z1cGVjXwRiNmAuyhSOMmEFXn7/QIvRTh0aHrF1zWPisUMJ87vzVlgEGVIU/tHQJDpPzS+kHMDl0aAptzmZPEXx3GbyKqB9xMaR1iS8DwrKuRQFbvMHuQHbxygYCHynSfLi2RygOSjYSFLC3BRJ3//A38wLbKGjXG/6c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=fJ5NQJJz; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="fJ5NQJJz" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-343ee44d89aso7091530a91.2 for ; Mon, 01 Dec 2025 22:01:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1764655282; x=1765260082; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=JUwV8Nhy+uTExeuD3LgiYQa5mdRnDsvQ01V5t8mXAjU=; b=fJ5NQJJzOLxytmMCvOirSKyuGQ/bJCjTY5jnVt+xHNbYEGM/FpDp17n2WHUgvBl40s GSZ+bu+BToY19jQ/HY+s11fViCpqbcNCvFf93CyyeJcIvOB19wqJklvBtzDoL7+O08av PmkUobrPNwL4OREC7Bwzjf2x54p/YXiEyt6vhlh1yfJeUJcvQUhAOjbVsbITlJCdoqtK DiMt1fgEs9dYz68/osGzp08YhrzROvJwzv1gB/eo1epJw03CC9vQAi+Fp2MYb6W8kcVE mgwiMwpWkLp5BoBgWsk1ZpHWCmdeRP4QZthQUrIGRzIqK3Gn91ANLAVIDk7uepZ2NDz0 LmFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764655282; x=1765260082; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JUwV8Nhy+uTExeuD3LgiYQa5mdRnDsvQ01V5t8mXAjU=; b=WMYyQUQrcb2rFpN78PETv6Klon4tjifxWHLK3H2Cjphfb81TQ0B8yhO75UZVB/C5VT UuSXjvYVd+nrfwQIot9SJ3SSNcXHz9ezu2JWYVNTdx0Nn6tPjCuzXpH17qR9GEGkibFz 4IVM+mtFvrY5CWcx8OoQbNBCykaoH/AemQD8k9qrsgHl7iWv2lbKv7lDRejdkZDs2NKO ZEOQRt8b7kyPQVn6UKDFZUaOiQJoeLOfGWDH+rAzj6QBmW6se53Zft1+RlngzKx2+F6F JOPl/ayUd2ajHvBe5ym/I6oEWWAC8cg422kCaGON21jn8gv1NgFS1a4kDVOVXpp8AZ9G HEuA== X-Forwarded-Encrypted: i=1; AJvYcCXtvZRwhcSWcHSNMJmU8engmCW21bYcnwjDtRJ6EPvaANvGKAhdOUy+tQd1l9dEV+ieIB6/58d0KhLYyw0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4uZZFYcAGt3Cm87SW2xRdoLHHtIBrOP2qFzNsgFxbXj6G2Nd1 wFEc09YwHuuu5wC7vXQkKv0GVIKhAm7SVkuEFcdNl+GPL65JFrEEssGZxSCE4oeGPxQ= X-Gm-Gg: ASbGnctISgZ0S0n5C0hP13cWoTqhIsz3Yz8lurfV+WDHoK3VxBjfOsItfLc7KMdFQcx JZ13m+KyxwyTYicuwEdpp5dixG7TonmZsv4bdQL4DlcCpGMisTncr0woKaGTPZ+haYPDoJnpnyT 9p0cOzvxQOiS/swiR/X09VWIbNZV3nL5TTHzv8zt8x7OK5qUTdNBYQ/RPsALx9n2PWqNOGwWa/y yWqwv6ZOT8f94r6GG2JtUb61pThBzA/2ULRZrnp6xl2ZRTmSZ+fVfkE5zvCrYTfTKu7ObDeB8KW 0p6q4CXiBWE6Zi5wRMWY8qEpvFUpon3A1dJXkdJXo2cuDQyeWhKq8j32jtFTbmOrknctkU2Eopn h7np/Jgsi83kUo2DScwasvRUM/zGk2HHwNr3AUyLQ4zCZaTw2RHLGp33lZJ6Yg/0us6kE0zWGTv C/ZQRm1U6v X-Google-Smtp-Source: AGHT+IEDvXe7HwnGwLwjiy+4fuZLsmwRNi3krK2hUgdHdgCuiVGfi6aF8U0D/NavXTDzbNfwytZcWQ== X-Received: by 2002:a17:90b:224e:b0:33e:2d0f:479b with SMTP id 98e67ed59e1d1-34733e4683cmr39441903a91.6.1764655282010; Mon, 01 Dec 2025 22:01:22 -0800 (PST) Received: from [127.0.1.1] ([210.176.154.34]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3476a547483sm19083810a91.4.2025.12.01.22.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 22:01:21 -0800 (PST) From: Nick Hu Subject: [PATCH v3 0/2] riscv-imsic/aplic: Preserve IMSIC and APLIC states during suspend Date: Tue, 02 Dec 2025 14:07:39 +0800 Message-Id: <20251202-preserve-aplic-imsic-v3-0-1844fbf1fe92@sifive.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIACuCLmkC/z2MywrCMBBFf6XM2glJSurgyv8oLtJ0agftg0SLU PrvDi7cXDhwz9mhcBYucKl2yLxJkWVWqE8VpDHOd0bplcFbH5xzhGtmVTbGuD4loUxF13rqui7 0jvoIquppkM8v296Uh7xM+Bozx3/Mkm0s+bNvDFEd0OEs6WHG97XIIBubtExwHF8aG4VUoQAAA A== X-Change-ID: 20251118-preserve-aplic-imsic-028bbb5d18da To: Anup Patel , Thomas Gleixner , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Yong-Xuan Wang , Cyan Yang , Nutty Liu , Nick Hu X-Mailer: b4 0.14.2 Since the APLIC and IMSIC may be reset when the platform enters a deep sleep state, it is necessary to implement save and restore functions to ensure their states are correctly preserved and restored. Chagnes in V3: - Refine the commit messages and comments - Rename "imsic_restore()" to "imsic_hw_states_init()" - Rename "aplic_direct_restore()" to "aplic_direct_restore_states()" - Rename "aplic_add()" to "aplic_pm_add()" - Rename "aplic_remove()" to "aplic_pm_remove()" - Rename "aplic_save()" to "aplic_save_states()" - Rename "aplic_restore()" to "aplic_restore_states()" - Use "struct aplic_saved_regs" and "struct aplic_src_ctrl" to preserve the APLIC states Changes in V2: - Address the compile error from kernel test robot when CONFIG_RISCV_M_MODE is enabled. - Rename "imsic_notifier_block" to "imsic_pm_notifier_block" - Reanme "aplic_notifier" to "aplic_pm_notifier" - Make aplic_add() as static and directly call it from aplic_setup_priv(). - Rename "list" as "head" and make it first variable in "struct aplic_priv" Nick Hu (2): irqchip/riscv-imsic: Restore the IMSIC registers irqchip/riscv-aplic: Save and restore APLIC registers drivers/irqchip/irq-riscv-aplic-direct.c | 11 ++ drivers/irqchip/irq-riscv-aplic-main.c | 158 ++++++++++++++++++++++- drivers/irqchip/irq-riscv-aplic-main.h | 11 ++ drivers/irqchip/irq-riscv-imsic-early.c | 41 ++++-- 4 files changed, 212 insertions(+), 9 deletions(-) -- 2.17.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv --- Nick Hu (2): irqchip/riscv-imsic: Add a CPU pm notifier to restore the IMSIC on exit irqchip/riscv-aplic: Preserve APLIC states across suspend/resume drivers/irqchip/irq-riscv-aplic-direct.c | 10 ++ drivers/irqchip/irq-riscv-aplic-main.c | 166 ++++++++++++++++++++++++++++++- drivers/irqchip/irq-riscv-aplic-main.h | 19 ++++ drivers/irqchip/irq-riscv-imsic-early.c | 39 ++++++-- 4 files changed, 225 insertions(+), 9 deletions(-) --- base-commit: 1b5dd29869b1e63f7e5c37d7552e2dcf22de3c26 change-id: 20251118-preserve-aplic-imsic-028bbb5d18da Best regards, -- Nick Hu