From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E85BC46467 for ; Tue, 10 Jan 2023 03:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbjAJDQu convert rfc822-to-8bit (ORCPT ); Mon, 9 Jan 2023 22:16:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbjAJDQr (ORCPT ); Mon, 9 Jan 2023 22:16:47 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E0311159 for ; Mon, 9 Jan 2023 19:16:45 -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 BED8424DCA6; Tue, 10 Jan 2023 11:16:37 +0800 (CST) Received: from EXMBX063.cuchost.com (172.16.7.63) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 10 Jan 2023 11:16:37 +0800 Received: from EXMBX161.cuchost.com (172.16.6.71) by EXMBX063.cuchost.com (172.16.6.63) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 10 Jan 2023 11:16:37 +0800 Received: from EXMBX161.cuchost.com ([fe80::f152:b9a3:2243:db3c]) by EXMBX161.cuchost.com ([fe80::f152:b9a3:2243:db3c%15]) with mapi id 15.00.1497.044; Tue, 10 Jan 2023 11:16:37 +0800 From: Leyfoon Tan To: Andrew Jones , JeeHeng Sia CC: "paul.walmsley@sifive.com" , "palmer@dabbelt.com" , "aou@eecs.berkeley.edu" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Mason Huo Subject: RE: [PATCH v2 3/3] RISC-V: Add arch functions to support hibernation/suspend-to-disk Thread-Topic: [PATCH v2 3/3] RISC-V: Add arch functions to support hibernation/suspend-to-disk Thread-Index: AQHZI/MH55+1R+tLE0CpUrjhzVBfuq6V9U4AgAEFXdA= Date: Tue, 10 Jan 2023 03:16:37 +0000 Message-ID: <964def29d1e146fc8ac17ab2fe813425@EXMBX161.cuchost.com> References: <20230109062407.3235-1-jeeheng.sia@starfivetech.com> <20230109062407.3235-4-jeeheng.sia@starfivetech.com> <20230109193624.iiuguwgimpn7zbyw@orel> In-Reply-To: <20230109193624.iiuguwgimpn7zbyw@orel> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [60.49.44.179] x-yovoleruleagent: yovoleflag Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [...] > > > +{ > > + hibernate_cpu_context = kcalloc(1, sizeof(struct suspend_context), > GFP_KERNEL); > > + > > + if (WARN_ON(!hibernate_cpu_context)) > > + return -ENOMEM; > > + > > + return 0; > > +} > > + > > +early_initcall(riscv_hibernate__init); > > -- > > 2.34.1 > > > > > > Besides some nits and a couple questions, this looks to me. I'll try to > find some time to experiment with it as well. FYI, you need use the latest OpenSBI tree. We also submitted these 2 patches below to fix the boot hartid. Resume from hibernation needs to be same hartid. https://github.com/riscv-software-src/opensbi/commit/cb7e7c3325e68a9b4d5ea210b97cac693cf5814f https://github.com/riscv-software-src/opensbi/commit/8020df8733b060f01e35b0b2bcb2b41e6b992e9b