From patchwork Wed Mar 8 08:06:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JeeHeng Sia X-Patchwork-Id: 66072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp205799wrd; Wed, 8 Mar 2023 00:21:26 -0800 (PST) X-Google-Smtp-Source: AK7set+hD+8NZMZFVO0NCqLusRZXnccNRxWFZlaDTAtdruz5j1IYlbDibMUy6X99O5myFHOwN2Ae X-Received: by 2002:a17:90b:2241:b0:237:29b1:1893 with SMTP id hk1-20020a17090b224100b0023729b11893mr17292062pjb.46.1678263686069; Wed, 08 Mar 2023 00:21:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678263686; cv=none; d=google.com; s=arc-20160816; b=PLSZofp5o44BxYoe4WZRl+HpmthfIAWC4zdyAeUW1pslOxkaWi7wjtKG17zi6vJcLD Gvjmgtvp0Mnp4cSXY6lirptNfbooJCro3HLoApqEQ46gK/EyO2gUpMrJcZtx3OOScPtw 0ZObGDvg5OIxqsavA8VhgehSMIc9DNw6kph5Akz8HJvAt5RSQVl0Z5mpTVQhZ3+risl5 ZM3bSKetQVaObeCh2lf30LRo3Kc6TRajOnZWkjHV/9Bow+O2uxMZz8Ft83U0bIWLENqi 0tjld/k0v49w8PivO7slDhR3mk6PEeYTQXL0RzL5E/wSNU/26qXOXmIb9uzbgOtYpq0w Tsdg== 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=LIPynq+UD7yHVtIBIKyHq3JZd0fLe2fsIGuBVVeQuuo=; b=hQzaQU9PexLLuhJ9IONEFu5NUmUWo2Ajhdi4wWftQLKISLxmNF7KmnF3IbZI1C1T3R Bm3csNZBasSg3UfPmHuAw10Yn6vKaFevNUj/edn7tIDBAnlwvCFe1QEBehRHM5kLl45Z 5KTQUMgWmgi5mfYmt4b75I1U42vx41Vb9KPR/FnQnYIe4YVaXDz+MtrOTJxKtKmd1a0i jccLkO9tFVyjDttRJVVwohDfXuajhOTZSArVLyzHGXOnLoMwd56oLaxcxvExUPJyqnfX oHu4LUCR20FVCcbIvEnUumTRI/G+vvzUuIYexN4D5anldioCBihG/zdk4qQRn9esh81R r9+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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ob7-20020a17090b390700b002340f617c58si15918304pjb.125.2023.03.08.00.21.13; Wed, 08 Mar 2023 00:21:26 -0800 (PST) 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 S229965AbjCHIGe convert rfc822-to-8bit (ORCPT + 99 others); Wed, 8 Mar 2023 03:06:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjCHIG3 (ORCPT ); Wed, 8 Mar 2023 03:06:29 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB10D5550A for ; Wed, 8 Mar 2023 00:06:27 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 9F14D24E0D8; Wed, 8 Mar 2023 16:06:26 +0800 (CST) Received: from EXMBX066.cuchost.com (172.16.7.66) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 8 Mar 2023 16:06:26 +0800 Received: from jsia-virtual-machine.localdomain (202.188.176.82) by EXMBX066.cuchost.com (172.16.6.66) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 8 Mar 2023 16:06:23 +0800 From: Sia Jee Heng To: , , CC: , , , , , Conor Dooley , Andrew Jones Subject: [PATCH v5 1/4] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function Date: Wed, 8 Mar 2023 16:06:09 +0800 Message-ID: <20230308080612.122398-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308080612.122398-1-jeeheng.sia@starfivetech.com> References: <20230308080612.122398-1-jeeheng.sia@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [202.188.176.82] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX066.cuchost.com (172.16.6.66) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759787022757867835?= X-GMAIL-MSGID: =?utf-8?q?1759787022757867835?= Currently suspend_save_csrs() and suspend_restore_csrs() functions are statically defined in the suspend.c. Change the function's attribute to public so that the functions can be used by hibernation as well. Signed-off-by: Sia Jee Heng Reviewed-by: Ley Foon Tan Reviewed-by: Mason Huo Reviewed-by: Conor Dooley Reviewed-by: Andrew Jones --- arch/riscv/include/asm/suspend.h | 3 +++ arch/riscv/kernel/suspend.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/riscv/include/asm/suspend.h b/arch/riscv/include/asm/suspend.h index 8be391c2aecb..67e047445662 100644 --- a/arch/riscv/include/asm/suspend.h +++ b/arch/riscv/include/asm/suspend.h @@ -33,4 +33,7 @@ int cpu_suspend(unsigned long arg, /* Low-level CPU resume entry function */ int __cpu_resume_enter(unsigned long hartid, unsigned long context); +/* Used to save and restore the CSRs */ +void suspend_save_csrs(struct suspend_context *context); +void suspend_restore_csrs(struct suspend_context *context); #endif diff --git a/arch/riscv/kernel/suspend.c b/arch/riscv/kernel/suspend.c index 9ba24fb8cc93..3c89b8ec69c4 100644 --- a/arch/riscv/kernel/suspend.c +++ b/arch/riscv/kernel/suspend.c @@ -8,7 +8,7 @@ #include #include -static void suspend_save_csrs(struct suspend_context *context) +void suspend_save_csrs(struct suspend_context *context) { context->scratch = csr_read(CSR_SCRATCH); context->tvec = csr_read(CSR_TVEC); @@ -29,7 +29,7 @@ static void suspend_save_csrs(struct suspend_context *context) #endif } -static void suspend_restore_csrs(struct suspend_context *context) +void suspend_restore_csrs(struct suspend_context *context) { csr_write(CSR_SCRATCH, context->scratch); csr_write(CSR_TVEC, context->tvec);