From patchwork Mon Jan 9 06:24:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JeeHeng Sia X-Patchwork-Id: 40676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2002521wrt; Sun, 8 Jan 2023 22:27:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXs6JX3CsBtV/FpQHJBwy/UBUup/HJ3niltnnHB0+vh/MKuHBtO1wliG2pvQFOSglp/XOmYM X-Received: by 2002:aa7:c04f:0:b0:499:376e:6b31 with SMTP id k15-20020aa7c04f000000b00499376e6b31mr4058509edo.29.1673245634009; Sun, 08 Jan 2023 22:27:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673245633; cv=none; d=google.com; s=arc-20160816; b=hx6E9yeZay1BVpYqGWniBugWEQNjL8RbM6EFI0yRFOWNiZUFzWxsL5RqiYBQKnGy90 toPBgsTbTkmB102aP+BEoK38Wy+9/GjOba/lXZ+Ww392AJw4lBYYaoLjghCC4OlCydpX n5nJklwoHMhEcZ6pFcG75y/bDq009X5SC/KwXPCdlNt7hBoMWeuCnaP3beQLjFsTZLsJ BuujUIxNS41cevHJWPcDYlJBRWb+Os0POqgPxBiFkbGeYrb0LHCRkA241rE9ga7qo987 ibfus6RP1WtinU/I6Sd1k/U1xFQolEDHcV06SEtV0VrlCZ0Bs+jSeeKz82sM2zQvYFQy DU2Q== 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=n/xJeu+DhfTWKGvEpFu/pW8nzA6c2qXXKQ9zQBjiAS82veZeUtz6EpMpOTFFvHjh4v lD18fWLV+HDebXR8eVy5vJL2ph9+cw5fO8q2sHxfxEYIUN8CN2pCGjP5shTp1wF/BwKB fB5T/FFGDZAeSRTygYXYoOOjHw4/mgdbjBMpLeY+f1M/mbKo7pK4f2WgvYRcD1LJvUXT 8IEYoczkeyx1WPqza0G8NS+o5aU0FKD5ENe1txzbUsb6+/xeKogk7OnGij499d7fdSbW 3ggdIT/o1GkZ613beMmQsogGXApT+nIRtlnOxRO+yBOMIWowm5L6PN74p2OwcqGrXHZL 6s+A== 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 du3-20020a17090772c300b0084d1ed9b688si8085451ejc.405.2023.01.08.22.26.50; Sun, 08 Jan 2023 22:27:13 -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 S234023AbjAIGYw convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Jan 2023 01:24:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbjAIGYY (ORCPT ); Mon, 9 Jan 2023 01:24:24 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86077BE14 for ; Sun, 8 Jan 2023 22:24:23 -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 048C724E1E8; Mon, 9 Jan 2023 14:24:21 +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; Mon, 9 Jan 2023 14:24:21 +0800 Received: from jsia-virtual-machine.localdomain (60.49.128.133) by EXMBX066.cuchost.com (172.16.6.66) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 9 Jan 2023 14:24:17 +0800 From: Sia Jee Heng To: , , CC: , , , , Subject: [PATCH v2 1/3] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function Date: Mon, 9 Jan 2023 14:24:05 +0800 Message-ID: <20230109062407.3235-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109062407.3235-1-jeeheng.sia@starfivetech.com> References: <20230109062407.3235-1-jeeheng.sia@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [60.49.128.133] 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,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?1754525213568044476?= X-GMAIL-MSGID: =?utf-8?q?1754525213568044476?= 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);