From patchwork Thu Mar 23 04:56:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JeeHeng Sia X-Patchwork-Id: 73800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2722566wrt; Wed, 22 Mar 2023 21:57:48 -0700 (PDT) X-Google-Smtp-Source: AK7set+IH7MY6krMunXh0r6xD/4gUt9/QEOdTqQtd+f6XhqdDrzuUektNWmmF80eeCAMJrsI6gzo X-Received: by 2002:a05:6402:896:b0:4fe:3374:7081 with SMTP id e22-20020a056402089600b004fe33747081mr9091583edy.8.1679547468217; Wed, 22 Mar 2023 21:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679547468; cv=none; d=google.com; s=arc-20160816; b=k3OINfR3mNe/DU20WrBtBaCYqwqy1L2bJhlegvrTXWeuxKIy32tS2RiG7bnMwO5+cy ruEiFVBruLVoyhmNOs0im/UbdwfKcYaaTs/eY9uZpsftylpHP+U5GiFd2f2tfI2hQuP+ RlA17HpVZNe8n2ZvtSfOnhWqwaWQki/de4FmWIKQQ6Pg2wfEqLauthRa5ugnr3QEEI7d Eu+suqEOWpfXGvoPwsf7Ver/6eKpno8fANDf9ePDtlSJiyqvmN9gMi8pJlfk/pGREcOr RRxG2ciTorZE0fLMPoMniFS12ZVwKJ5kFN/t2zs2GeJ28JSjXh74E3Md3sQQpKmMFrhs pCfw== 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=Ls3+7mdMzIuHs4QnubGKLmVUSNpQZirLb1Tt6HPQ/K0zpnb8CbUA9axnve8EyFbkIl 7KJvmh0w/n6+KeswXhDJWBxpYyG7PoKyuGVXZGJw2PCxSfGc/C5n4tL6DXLb18yywMIQ r2TIw6NglAQ9KH6ncGVTgggfPlEl8i4VopEZfLwmYq8JInHOiqli9RD1lgHQUg9NIGqL Xn3Sas2RXngZhp8Y80eLF9FDRt6hnS7ADnuaIrAX42VcDlLUdSShtvv/uNDKCkLdLKzg YcNC9F8YSoWPXsKHj+Dav+8caF8wwZgPoO4TgjeuzqJs4uGxrWGmnQyR867VxQ34xU1o kULg== 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 t1-20020aa7d701000000b00501dcf278b0si7003091edq.271.2023.03.22.21.57.25; Wed, 22 Mar 2023 21:57:48 -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 S229842AbjCWE4Y convert rfc822-to-8bit (ORCPT + 99 others); Thu, 23 Mar 2023 00:56:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjCWE4W (ORCPT ); Thu, 23 Mar 2023 00:56:22 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02D172A162 for ; Wed, 22 Mar 2023 21:56:18 -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 ex01.ufhost.com (Postfix) with ESMTP id B573D24E1DB; Thu, 23 Mar 2023 12:56: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; Thu, 23 Mar 2023 12:56:16 +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; Thu, 23 Mar 2023 12:56:13 +0800 From: Sia Jee Heng To: , , CC: , , , , , Conor Dooley , Andrew Jones Subject: [PATCH v7 1/4] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function Date: Thu, 23 Mar 2023 12:56:01 +0800 Message-ID: <20230323045604.536099-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230323045604.536099-1-jeeheng.sia@starfivetech.com> References: <20230323045604.536099-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=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1761133165654184522?= X-GMAIL-MSGID: =?utf-8?q?1761133165654184522?= 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);