Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2112241rwl; Fri, 6 Jan 2023 01:59:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXuwYJWCEPuCZsvoxn9tXS7cX8iH6YOlHqfJPQwFUZmBH+Tc0VoUStfYXUEjC/B4tA5ITLiT X-Received: by 2002:a17:902:a3cd:b0:193:bec:497c with SMTP id q13-20020a170902a3cd00b001930bec497cmr2013118plb.68.1672999175098; Fri, 06 Jan 2023 01:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672999175; cv=none; d=google.com; s=arc-20160816; b=nLq2MK6bELT0HfxUi4/5UBfnHk/DusopvLjiSCwrMYZkbbj0rIjraP21FYzaOo60TU hekrZVTc6zIogOps7/KUO4Tf1/FyelRwPJirriJqHjQ+ljTRRJiWWidBC9ajME0ozqLr Kwf4zLmukbDZ5/iiq0HLoVbmD2DOe7d0fvq2ZlOnTLmYieGsOTgXoA1Y/YZI6aywbYMD dznnyFM3/9mt8gA/Hc0vsZ1/3DXayakRczK4DwGikh3rrJ4kUkbknKZkMdYZM20VLAhz Wz8JG7SsEWQnuLLzKjS6HP1YbcjdJFWZh0uPJb5nrns5ggOnqiDUFDCjJCwheTSbp1SE c3Hw== 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 :message-id:references:in-reply-to:user-agent:subject:cc:to:from :date:dkim-signature; bh=j+n4hnqSudEicfcuqEj+UO0bHfk1MP6Sza2wrlCFYFg=; b=ANBx4qfUcODf4TiSULoSUJqIF32/tUtiL3pKxCDVzRBraF4m4COB7nYsS5cLgJ9eUK Xvj5hOtZL1uucl0WVSdLvg21BJV47CbrgkZXf7GyyjGpWeUjjkoaAYYpzubpvYy0C0nh Hy9O8Xqrmrmn6BFMyiIZ7qvrF/0odcYvrJE+LbnT7gSPWSIcyKXvEoO2NJhyzpXN9UAP nfIpnYIIFD41lYUsHtGnrSCAd1kI00gnzMXoQRU36XzTvHOgzJicR7B4sjomv+dn+zyX 1hdBU33ZQrJfxNRMgx9D5m3O5WvJx7IfTRNmK6TiTvC3x51CDQJxdFapGLc1ZBbLzDPq /Adg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JF2wYRrh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020a17090301c100b00192c2683e4asi779122plh.3.2023.01.06.01.59.27; Fri, 06 Jan 2023 01:59:35 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JF2wYRrh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232662AbjAFJmh (ORCPT + 56 others); Fri, 6 Jan 2023 04:42:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232821AbjAFJmD (ORCPT ); Fri, 6 Jan 2023 04:42:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69110736F9 for ; Fri, 6 Jan 2023 01:37:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02EB461D72 for ; Fri, 6 Jan 2023 09:37:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D407EC433D2; Fri, 6 Jan 2023 09:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672997872; bh=4Yg7nKp5VKlgMLRQicguVZYUf8Mfxt+W8biYKtmLKNw=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=JF2wYRrhOQHlEyYkwne41oBdqiJTi+svDSB5DxIHYLfPVyPbLD/DiSD4HuCsyglXr lxEV+eBQBIUyUf2FfwBbhzvix4xBW4tH763tpGyAIyVZRIsKGKXV+Ajf4+fPIJnbiB F9nlDDkR/OOZ17Jlwev/YQcus3Qhv7eHUm3WqxvfGvHY4/o1TEw08UX/jXYWDus+Ud nrGmh+rbKQF3a4uJIZspp8JrMyPhblxW8WX53R1o5JtnFfz4bxQNPJLJdf40g0BkMP s4I3WyaVpifMXmZ/5xX4lDMA5oMVJB5cQ8xHaBNqoH/Vl178mqEcGk4zUtGaDNVQFu XiW4ONMRj1n7Q== Date: Fri, 06 Jan 2023 09:37:48 +0000 From: Conor Dooley To: Sia Jee Heng , 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 Subject: Re: [PATCH 0/3] RISC-V Hibernation Support User-Agent: K-9 Mail for Android In-Reply-To: <20230106060535.104321-1-jeeheng.sia@starfivetech.com> References: <20230106060535.104321-1-jeeheng.sia@starfivetech.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Hey folks, Just passing on some issues that automation picked up=2E On 6 January 2023 06:05:32 GMT, Sia Jee Heng wrote: >This series adds RISC-V Hibernation/suspend to disk support=2E >Low level Arch functions were created to support hibernation=2E >swsusp_arch_suspend() relies code from __cpu_suspend_enter() to write >cpu state onto the stack, then calling swsusp_save() to save the memory >image=2E > >arch_hibernation_header_restore() and arch_hibernation_header_save() >functions are implemented to prevent kernel crash when resume, >the kernel built version is saved into the hibernation image header >to making sure only the same kernel is restore when resume=2E > >swsusp_arch_resume() creates a temporary page table that covering only >the linear map, copies the restore code to a 'safe' page, then start to >restore the memory image=2E Once completed, it restores the original >kernel's page table=2E It then calls into __hibernate_cpu_resume() >to restore the CPU context=2E Finally, it follows the normal hibernation >path back to the hibernation core=2E > >To enable hibernation/suspend to disk into RISCV, the below config >need to be enabled: >- CONFIG_ARCH_HIBERNATION_HEADER >- CONFIG_ARCH_HIBERNATION_POSSIBLE > > >At high-level, this series includes the following changes: >1) Change suspend_save_csrs() and suspend_restore_csrs() > to public function as these functions are common to > suspend/hibernation=2E (patch 1) >2) Enhance kernel_page_present() function to support huge page=2E (patch = 2) >3) Add arch/riscv low level functions to support > hibernation/suspend to disk=2E (patch 3) > >The above patches are based on kernel v6=2E2-rc2 and are tested on >Starfive VF2 SBC board=2E > >Sia Jee Heng (3): > RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public > function > RISC-V: mm: Enable huge page support to kernel_page_present() function Unfortunately this breaks rv32_defconfig https://patchwork=2Ekernel=2Eorg/project/linux-riscv/patch/20230106060535= =2E104321-3-jeeheng=2Esia@starfivetech=2Ecom/ > RISC-V: Add arch functions to support hibernation/suspend-to-disk This one then breaks rv64 allmodconfig too :/ https://patchwork=2Ekernel=2Eorg/project/linux-riscv/patch/20230106060535= =2E104321-4-jeeheng=2Esia@starfivetech=2Ecom/ Thanks, Conor=2E > > arch/riscv/Kconfig | 7 + > arch/riscv/include/asm/suspend=2Eh | 23 ++ > arch/riscv/kernel/Makefile | 2 +- > arch/riscv/kernel/asm-offsets=2Ec | 5 + > arch/riscv/kernel/hibernate-asm=2ES | 123 +++++++++++ > arch/riscv/kernel/hibernate=2Ec | 353 ++++++++++++++++++++++++++++++ > arch/riscv/kernel/suspend=2Ec | 4 +- > arch/riscv/mm/pageattr=2Ec | 6 + > 8 files changed, 520 insertions(+), 3 deletions(-) > create mode 100644 arch/riscv/kernel/hibernate-asm=2ES > create mode 100644 arch/riscv/kernel/hibernate=2Ec > > >base-commit: 1f5abbd77e2c1787e74b7c2caffac97def78ba52