From patchwork Tue Mar 14 05:03:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JeeHeng Sia X-Patchwork-Id: 69297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1576974wrd; Mon, 13 Mar 2023 22:32:14 -0700 (PDT) X-Google-Smtp-Source: AK7set+cIrTQF31ZawGf/YIuW0InBaean3Ip73l9VkHyvfvujaZPq9l5e7iB4MzayjPaT1SvkdxV X-Received: by 2002:a05:6a20:6982:b0:d4:7457:3918 with SMTP id t2-20020a056a20698200b000d474573918mr7554474pzk.43.1678771934461; Mon, 13 Mar 2023 22:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678771934; cv=none; d=google.com; s=arc-20160816; b=dvICUzMWt8ND4sUpn+RP1iZf3/gRoyD67lXCKp18ME8Qv5A2nstddnlZvEFUxlZvVU ZxuY26eRaP0bQVjNeGz5C+pQrJwLZRCPEGfhZX4Vft0sUACBkz/infNI+Q+h3pY86k3u KaG7xdoHBYFRr9S1gwQWfCSbINm40PxA9I7jWAqBRdXGH92fLZTfzpV6Pc3z7q9NMedm N72w3zYvMAhHemeFmeIyQV5jdYwauyfBBzaxZBv1P3/uuMKbqu7nPqGl2X+MNXBefqOc 7+pbZnTFHUaSyn7QG+NOIz97op5dP5bfXF5CeV26/+Nj8zalmO5XKTrhe2jAHIJBMF1P HIag== 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=UmMFmIPEDH2twk+QSDZIaZkTR5ymfv1QfaAf1LRYAKcLhCuawgmuM5cIKt14ZacmNd Lj1Yf+Yp4Qo3hF1T8w/i+kKvu0HjfkWTm3rxTBFovq11+615wQM4BOXyhy5UQWeq5f3e ++O6WEi4NvMU58PyKHaP3pymN4jlKWi/Wl/cIkEWRZVBv6HuEQinIzY2sd72sGOWRqWM fGFW3XgrlAaPAfrCa9H2s/53HBG7jyZnrqXI/KjdGj/T5xGqs7K/g9JBHe4bvchE7/V3 3IdvLgBn+vimzFlPaO4av4iyN1HyQ7aF6JvMbiwGKGpZ2omi8A+LIojD5K0OLjl84eUh rbBw== 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 t142-20020a635f94000000b00502e28a848esi1410609pgb.353.2023.03.13.22.32.00; Mon, 13 Mar 2023 22:32:14 -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 S229723AbjCNFDe convert rfc822-to-8bit (ORCPT + 99 others); Tue, 14 Mar 2023 01:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjCNFDb (ORCPT ); Tue, 14 Mar 2023 01:03:31 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C11B026BF for ; Mon, 13 Mar 2023 22:03:29 -0700 (PDT) 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 64B7B24E36E; Tue, 14 Mar 2023 13:03:28 +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; Tue, 14 Mar 2023 13:03:28 +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; Tue, 14 Mar 2023 13:03:24 +0800 From: Sia Jee Heng To: , , CC: , , , , , Conor Dooley , Andrew Jones Subject: [PATCH v6 1/4] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function Date: Tue, 14 Mar 2023 13:03:13 +0800 Message-ID: <20230314050316.31701-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230314050316.31701-1-jeeheng.sia@starfivetech.com> References: <20230314050316.31701-1-jeeheng.sia@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [202.188.176.82] 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?1760319959740411791?= X-GMAIL-MSGID: =?utf-8?q?1760319959740411791?= 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);