[v4,1/4] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function
Message ID | 20230221023523.1498500-2-jeeheng.sia@starfivetech.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1633525wrn; Mon, 20 Feb 2023 18:38:13 -0800 (PST) X-Google-Smtp-Source: AK7set+C1gnhYRm6ZNN10lfCcFZf/OSnUeY4EKE1L8j4dRaojuB/7bcpaaMwKV4wqq2GpaGL0hIP X-Received: by 2002:aa7:de13:0:b0:4ae:eb0f:4258 with SMTP id h19-20020aa7de13000000b004aeeb0f4258mr3773636edv.30.1676947093533; Mon, 20 Feb 2023 18:38:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676947093; cv=none; d=google.com; s=arc-20160816; b=Oxtta4wFfojByU1DMWGTaFNZAnQcb8N6lgpta+cRA91SOTjBfen+Xuck9K4nR+058m gPM5UD9uewyYGQa4uzP6U4adONAWnOx7iXmavth9HxwyVdGgv6vSZxt7jHjm7y9DWYVF v2C7SPZwdAGuwRUIjHNpPdEZt9WnGnbvWMd1RfvIvgCVWddMcRVClWdVJMetQsfTKh+o HcdoRiPjgrzzOB8ZIa5uLGc/ht/GEf1Xtu78fcZ2yCBmK1nTaqnn5yiTn9ahtWnndzLC fD4mlUqnBWvoXRtFV/qDrPZXlkimpRZFypReLckluT8fKwHMm4o4HDC5ycCBgvDbQ4Iz GwuQ== 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=tYjq01kHU6fQk8J6z5HmR4PimsEYYTyGgYH3E9K52vY=; b=igopsIfO/ROVocmMpoht8lszT5K5MFwAzGjWql1W1i0krwIsXY5f+8vhF2F9j3OG0q NzDoFovUDAN1tn/wJ2zZHGEAPGEdtGloexOVNW2Z3QXGSl+tRcbDbCWFjvyGX6rSWYCL KNn//SEG8tG+c5Nlu0ntmuBSYk/QQYw05UMNN6rf15HiR9dsfFlXgNAy5iMnh3Qjzn6q LjwEYRm4NBhlH6NGjoLOR3Hr7l8ECTV63EPAXtf44vsBWN7q/M6dW3YO9HYr1Zph+iRi 8KcdQr5CrWP7n3HwQUbhS6ZC/UwnctND350B9+XcKf8lXgt5e03Ymm/ALR8CDF303VH2 QN4Q== 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 x20-20020aa7dad4000000b004acbd7134d5si17152963eds.632.2023.02.20.18.37.50; Mon, 20 Feb 2023 18:38: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 S232955AbjBUCgN convert rfc822-to-8bit (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Mon, 20 Feb 2023 21:36:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232659AbjBUCgK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Feb 2023 21:36:10 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55CE4234EC for <linux-kernel@vger.kernel.org>; Mon, 20 Feb 2023 18:35:36 -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 fd01.gateway.ufhost.com (Postfix) with ESMTP id 730D324E332; Tue, 21 Feb 2023 10:35:34 +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; Tue, 21 Feb 2023 10:35:34 +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, 21 Feb 2023 10:35:31 +0800 From: Sia Jee Heng <jeeheng.sia@starfivetech.com> To: <paul.walmsley@sifive.com>, <palmer@dabbelt.com>, <aou@eecs.berkeley.edu> CC: <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <jeeheng.sia@starfivetech.com>, <leyfoon.tan@starfivetech.com>, <mason.huo@starfivetech.com>, Conor Dooley <conor.dooley@microchip.com> Subject: [PATCH v4 1/4] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function Date: Tue, 21 Feb 2023 10:35:20 +0800 Message-ID: <20230221023523.1498500-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230221023523.1498500-1-jeeheng.sia@starfivetech.com> References: <20230221023523.1498500-1-jeeheng.sia@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain 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 Content-Transfer-Encoding: 8BIT 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758406475907526339?= X-GMAIL-MSGID: =?utf-8?q?1758406475907526339?= |
Series |
RISC-V Hibernation Support
|
|
Commit Message
JeeHeng Sia
Feb. 21, 2023, 2:35 a.m. UTC
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 <jeeheng.sia@starfivetech.com> Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com> Reviewed-by: Mason Huo <mason.huo@starfivetech.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> --- arch/riscv/include/asm/suspend.h | 3 +++ arch/riscv/kernel/suspend.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)
Comments
On Tue, Feb 21, 2023 at 10:35:20AM +0800, Sia Jee Heng wrote: > 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 <jeeheng.sia@starfivetech.com> > Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com> > Reviewed-by: Mason Huo <mason.huo@starfivetech.com> > Reviewed-by: Conor Dooley <conor.dooley@microchip.com> > --- > 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 */ s/the csr/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 <asm/csr.h> > #include <asm/suspend.h> > > -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); > -- > 2.34.1 > Otherwise, Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Thanks, drew
> -----Original Message----- > From: Andrew Jones <ajones@ventanamicro.com> > Sent: Thursday, 23 February, 2023 2:40 PM > To: JeeHeng Sia <jeeheng.sia@starfivetech.com> > Cc: paul.walmsley@sifive.com; palmer@dabbelt.com; aou@eecs.berkeley.edu; linux-riscv@lists.infradead.org; linux- > kernel@vger.kernel.org; Leyfoon Tan <leyfoon.tan@starfivetech.com>; Mason Huo <mason.huo@starfivetech.com>; Conor Dooley > <conor.dooley@microchip.com> > Subject: Re: [PATCH v4 1/4] RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public function > > On Tue, Feb 21, 2023 at 10:35:20AM +0800, Sia Jee Heng wrote: > > 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 <jeeheng.sia@starfivetech.com> > > Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com> > > Reviewed-by: Mason Huo <mason.huo@starfivetech.com> > > Reviewed-by: Conor Dooley <conor.dooley@microchip.com> > > --- > > 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 */ > > s/the csr/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 <asm/csr.h> > > #include <asm/suspend.h> > > > > -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); > > -- > > 2.34.1 > > > > Otherwise, > > Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Noted with thanks > > Thanks, > drew
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 <asm/csr.h> #include <asm/suspend.h> -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);