Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7203514rwl; Mon, 9 Jan 2023 20:03:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXsq6D8q05rXxfRfeFja3i6SpqsOV6SooqO/f+GwqZdcFwTDc5WmoHykexGR1AmRx7GAFpSp X-Received: by 2002:a05:6402:4141:b0:469:ee22:d97a with SMTP id x1-20020a056402414100b00469ee22d97amr61108285eda.32.1673323392473; Mon, 09 Jan 2023 20:03:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673323392; cv=none; d=google.com; s=arc-20160816; b=nvH9eUovmT6QtXvhv0v6PJRk0DkXwC0Ru9eHqntb1ZI3qtPY5Vp+CuTPgwkMqmmKEP p76NeTXpNAa5qb6AZeY/gEBRnGymuarfavkCn4BCWMjYJ3+vAr3b7cAItAiXlMEiJ4JR RBIC8o1aoImhbbIrWVsUiaOMQ30X5Csce74H+6w8tvp+6VRG7VIu0jnDHKt7DLjW6OsV qS62tz0faJG6+V0rp5prQ3F4ZZrBEfFiCQYx08PmgQt4Yyvdk0ZlqRQ5afS/qlyi5ajJ FIjp94uCeKDm2Oz5c9sAvi1flQuwMFA4oE/lrTwv+oFoU4T5WDOQybBSILxXuV/QQbxL LSvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=xnq/stY97OIYAkXh+h8ao6zGqLv8fSjzYQf+sfpaoyo=; b=GJsecOhjZmH447WnV0td5EeIX9oHDltXvxCif6OaDYNLfdHBSVmsO4G2R5SyJKlvcO C6iNCvhQHtgJc9KVgqJpZgRYDX+ykqDFLaSScq/rz1oCY0MzWifnDJJfacdm3bcDlQqu 8v4XoIE7jqgYDlPnBdkUGEOSHFsX45JfBhj/GdLiv+sp/q3o4fX1DELfHyRp9X6sGY4Z 2meFqVQ0qKkikXnNFmvgq3+4Qv5DrEw7jnNrMZWZEebV7zuAkCcfmNb48PldT+5nmdWM WEcFPEGyRJ+v90pLp/1J3uGqJfT3zE/Lhlxx0SFlLUUH9bWruxGeWEmy6BXtfbKzd1MN yhRA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020aa7c58a000000b0046fe2f565e0si9981314edq.315.2023.01.09.20.02.59; Mon, 09 Jan 2023 20:03:12 -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 S229540AbjAJDQu convert rfc822-to-8bit (ORCPT + 55 others); 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 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 [...] > > > +{ > > + 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