From patchwork Fri Jan 27 09:10:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JeeHeng Sia X-Patchwork-Id: 49119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp734305wrn; Fri, 27 Jan 2023 01:18:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXsUgVPL4vLOQcHG9zCoNCSoYv2GqLJd39+2Rw1+ZJMxwOQmnDqgVcJdpgUlwxlPQEaqYv8y X-Received: by 2002:aa7:c845:0:b0:497:b6bc:b811 with SMTP id g5-20020aa7c845000000b00497b6bcb811mr38968854edt.33.1674811095079; Fri, 27 Jan 2023 01:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674811095; cv=none; d=google.com; s=arc-20160816; b=nkVvuqvJY0oxJhw+6HgV0SahPw2q/LV4y0rV3zE6fSwYGtPD/vKSnzTCa3KQ7EobeI BIwRa0udMVIhCWgsWtj0yODwcclxU7t5PZ+/UzUfij0QzusrrwGuJUFs34D457Wllnr2 Gi1Y4Rf01pEfnj9eaLjmmvsE66kVdw7G4G6ajDi8gejQ6vZz72monvocxogFPQppT4rB MA69iY9eOdceApEm84zhsHT2v2+KFXHhFNdGiIp+xUNEkqa761I9t2y1KMqDiXWPUItk 5xJl7ew5d4jhlJ1SxH1lOiFCAZEc3q40I9Bv+2SpA+Rwqs37LO4ooaRTSNp4i5F4uwcQ G1BA== 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=c/OAHucgFFZManiDk4Ak2Yz1bco/BAtUGFWRru8KNx06hLKo+vwNuaT4AzNEUDTutw pbjBzqyDFoG9rvGYa/uwXh+nJ50EItV8ETQwIUiD4VAsTrSBMohHUT1bWq45viNK9rWc 1RCbTGHXoRRBxVaWsFcKg5Aka+XFmZmxvWV0eO4gg9IZHFwY7qNjLKfthOHL9rugcKKH 6LAlhC3L1ToyJsGN8Mbnb0kMdQgF8SlDOme/NARx27bxBCxP+0FhiN3LxeU/82TQChvw I2GYQGaS1VFkB4s+n7KEylRB7usqqStQVbAAieLLcmgwF7z9ButTZq2D63Zh3Jal5Aul Mbhg== 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 s12-20020aa7c54c000000b0049e28b8b54fsi4255091edr.213.2023.01.27.01.17.50; Fri, 27 Jan 2023 01:18:15 -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 S232728AbjA0JL1 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 27 Jan 2023 04:11:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232823AbjA0JLZ (ORCPT ); Fri, 27 Jan 2023 04:11:25 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8726B761DB for ; Fri, 27 Jan 2023 01:11:18 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 0AD4624DBD3; Fri, 27 Jan 2023 17:11:16 +0800 (CST) Received: from EXMBX066.cuchost.com (172.16.7.66) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 27 Jan 2023 17:11:16 +0800 Received: from jsia-virtual-machine.localdomain (60.50.196.81) by EXMBX066.cuchost.com (172.16.6.66) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 27 Jan 2023 17:11:10 +0800 From: Sia Jee Heng To: , , CC: , , , , Subject: [PATCH v3 1/4] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function Date: Fri, 27 Jan 2023 17:10:48 +0800 Message-ID: <20230127091051.1465278-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230127091051.1465278-1-jeeheng.sia@starfivetech.com> References: <20230127091051.1465278-1-jeeheng.sia@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [60.50.196.81] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) 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?1756166719290885257?= X-GMAIL-MSGID: =?utf-8?q?1756166719290885257?= 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 --- 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);