From patchwork Fri Jan 6 06:05:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JeeHeng Sia X-Patchwork-Id: 39951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp668738wrt; Thu, 5 Jan 2023 22:16:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXsJ1jCdb0/Li50wOgpX9VRdpigvKHOyxq76stX3Rux0nbK6fzKx5QS45Xt3XffobkRndsKe X-Received: by 2002:a17:907:8c86:b0:7c1:1adc:46fd with SMTP id td6-20020a1709078c8600b007c11adc46fdmr50259615ejc.34.1672985786192; Thu, 05 Jan 2023 22:16:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672985786; cv=none; d=google.com; s=arc-20160816; b=S0rrfpuYk1O5D4Qp4rJYxv/4Pz0BrIqgc8VTIvg9K7aE1CwwihNuHjHVwTdTN8Qep6 ApSGTTdP6pIAvMCgn2S5HMiLBQRMwlYVZ1vepxx3fdxF+6fl735Ym9xKb1GhBnsFx3/C 8y6wwQ0crb6fKTYEZ/H9xcoyS4m3CX0jwpmhvjRh4RaBl18qeR56OQzSI06y+wj8Mf0g VzrTyXCdFt3BTq0bIhogfpSvTDS/vxI9DFel7J7MWM030x0njatt646OurUVe6y6uLMP +m94bYjY7BGvENSkfuq7ScD6JL7iBmO+lRbXGoFLqtNkSwFgwxGH87RTC59TZ/6KUFCB 3IbA== 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=8tD6XVBYIrdB1rXsVbv3PFTqO12NGsVNAj1/vrSNP78=; b=eKY1xYMEjzrcKSP5ozBEgA7+2UxcBDU3CHmz5/6EZrJHvEGsTma718MgJroy00Ykf9 PjsHOmP4jH8cCvTzg9XHVVx2/W1a8XaZDzPmdC8M6OD+73fXKRe9PapMuH+BSFl2s1Wu tomhBXZfbuq7twQ+8kfVn1b0xzhutdcgLQbHAXyXJYQdpzjY/BU8JVg6TN/B6sQwIrLd om+8eLjY+B3RJNBMme4JWQpbMiVMi4qIOkWzrvoPElnHudQLAkzrfo2IzPE8B3McESRt DmznZZ69h70CrCr3NUk9HRablHM4Cl6B75DzcJySA/WB5R+UT3dZITliE/8bS9F+9D1G e7gw== 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 ga38-20020a1709070c2600b0073d9f16e5b3si456330ejc.258.2023.01.05.22.16.01; Thu, 05 Jan 2023 22:16: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 S231315AbjAFGGA convert rfc822-to-8bit (ORCPT + 99 others); Fri, 6 Jan 2023 01:06:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbjAFGF4 (ORCPT ); Fri, 6 Jan 2023 01:05:56 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83C6B6147A for ; Thu, 5 Jan 2023 22:05:52 -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 fd01.gateway.ufhost.com (Postfix) with ESMTP id 301AB24E02F; Fri, 6 Jan 2023 14:05:50 +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; Fri, 6 Jan 2023 14:05:50 +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; Fri, 6 Jan 2023 14:05:46 +0800 From: Sia Jee Heng To: , , CC: , , , , Subject: [PATCH 1/3] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function Date: Fri, 6 Jan 2023 14:05:33 +0800 Message-ID: <20230106060535.104321-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106060535.104321-1-jeeheng.sia@starfivetech.com> References: <20230106060535.104321-1-jeeheng.sia@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [202.188.176.82] X-ClientProxiedBy: EXCAS061.cuchost.com (172.16.6.21) To EXMBX066.cuchost.com (172.16.6.66) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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?1754252743849220635?= X-GMAIL-MSGID: =?utf-8?q?1754252743849220635?= 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 --- 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..75419c5ca272 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 csr */ +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);