From patchwork Thu Mar 30 06:43:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JeeHeng Sia X-Patchwork-Id: 76913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp927044vqo; Thu, 30 Mar 2023 00:01:38 -0700 (PDT) X-Google-Smtp-Source: AKy350ZNBcA1tKAKZreZDH6lBCsUeBaXi36/X9j3Uf/nlCWBufWI9zyDnNkEHqd8ZtQhaWAT5lVs X-Received: by 2002:a17:906:6898:b0:93a:f977:e0fe with SMTP id n24-20020a170906689800b0093af977e0femr22468682ejr.20.1680159697981; Thu, 30 Mar 2023 00:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680159697; cv=none; d=google.com; s=arc-20160816; b=YniYe5HhjyJhRzSwDz+GapfJteFc1zxjKIURdKTEZKm9ekO5Jfp1doihzoe1nlwlwd MzmK/3L+G4Ve/eah74hg/XuOud8GLYbI6xjBJrCdVPwr7KwFucwGyOMFn07GchpZvh7Y tja8idyMxqmm1FBAgyy7QITpcwk5V3hniqIMZnTHwRYIv/fnvcgzhyrJAx9Wectlzcgy uBSyIbs29rRlhWyHv9RdEGZhjWuSTfA1mcbzyLy58fvF7gWuavwmWG/OgFrYSSGDpQps Bd29PrccpCa9g7KTEfz7QRki7XR/HZt7S/TT5ENRiM4Kjyfo1MZdLXdNvO6YDrt8Zjr8 sj4Q== 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=VTwbgFAcw0z+0hMEQ4kWh8JE7r2NVk4O11Zr8jR6dnbg8+AZfN2DWeOVkWjvmJ3ra6 Trvv1L/jCQyNx6WwIUUQQGZrew06OwC4R4qQwF+EQLuKr62rgHZXcJYL8h+CY1D28A9v IRD8he36anFKas3sOJRiUiQ9bKGqL3zftA5XmUB1y8qWwpvpRNGcCbTF4I/G+RUbzaci babEFlU3S2f/y4Cc28w9u1vJwSNiKPObc9Z3ose9AqkFnqL4euCBEDLXoxkTnnuvjyZf eFWT+ass/hxMxnZnZCfch4T4lqn2EDa2HEBoi9SJ4TzfaBUyKfyaA/bS8jYnaU2GFjde duUw== 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 sc16-20020a1709078a1000b009333e2401d0si37915024ejc.48.2023.03.30.00.01.13; Thu, 30 Mar 2023 00:01:37 -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 S230122AbjC3Gnt convert rfc822-to-8bit (ORCPT + 99 others); Thu, 30 Mar 2023 02:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjC3Gnk (ORCPT ); Thu, 30 Mar 2023 02:43:40 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DD040E4 for ; Wed, 29 Mar 2023 23:43:39 -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 2A7B124E289; Thu, 30 Mar 2023 14:43:33 +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, 30 Mar 2023 14:43:33 +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, 30 Mar 2023 14:43:29 +0800 From: Sia Jee Heng To: , , CC: , , , , , Conor Dooley , Andrew Jones Subject: [PATCH v8 1/4] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function Date: Thu, 30 Mar 2023 14:43:18 +0800 Message-ID: <20230330064321.1008373-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330064321.1008373-1-jeeheng.sia@starfivetech.com> References: <20230330064321.1008373-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=RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,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?1761775135745426518?= X-GMAIL-MSGID: =?utf-8?q?1761775135745426518?= 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);