Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3625451rdb; Wed, 13 Sep 2023 19:11:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHn6/L0PuWIKbQQlGnpT49Fn7py3OdtILGPAKozto5YJTMlJlF8IIReZMvZh2ZXml1lnTEs X-Received: by 2002:a05:6a00:1504:b0:68f:b5a1:12bf with SMTP id q4-20020a056a00150400b0068fb5a112bfmr5756650pfu.29.1694657506100; Wed, 13 Sep 2023 19:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694657506; cv=none; d=google.com; s=arc-20160816; b=xig4GdziL3XVWotQUO0GbjjECw6wSRDRBe7gzN98UJhrzlKgGHhRTc7yHmIi94wRxo AtENkMsisx+Dt6i4GYNUHWD3vmyV6o1/5ArpkEx4ILzGmn5zF1ibHt81/csauGL8UHQy Q9o+7Pvi1UyaeI/R5Vo90DNcdZrCTdDP6QbLsSP1YooxMHmBAKEHNDtbgb+h7wpT8xlx OoD0SC/gYxW/jSAvAIsitQbxdYoPYFoF5gUU1aVkGxR8Om0C+sa4ZuHkBK+ISYsRytVE w/C1v9rWmffg9SEgJC5iQN4hC1+u9jpSrg8UVtrchqBAur+hdCYc98iBGPHLWHKCQ4MS 1S4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=ZpuTpdj1y1JqXxAy0zjGia6i+5pzXZMspoEYnVvzRcY=; fh=Kf2IcSxXu2lOC/ZqDfeaqJthEyoCZ+xmLKFwierCxZk=; b=KkOzKDMxiW9Yv08jQqWfIgrYPkfYOJ3EF2EgCC9qmgE0oMEm6WSmfPHhWW8qija1Ut Uh0YeLbeFsde8HNVGO5an12u+A9TxGdwFq9V0KDGWVMmBoVOG6nQN54UPsK368JjeW4e InEPa1qKYVzVJaWSn+ftOxmAbzUTybxaO3rZBf/3y9yMQQ2ooL2BnypbW3q7DyiQIxHj 0hi14GCvj7eKx1qxxx7SXzqbL4fF/pQ6IZtm695v8hZ8AYPuOvEcg83pZNRQyc9kFCu0 89kR4uHQniZ0I1kvwSvmZ9xKLSJWJdO3IIoqagx8PaT074ezIsojur7jklsZ8w2twKpy 3QMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id cv7-20020a056a0044c700b0068bc08d8a3dsi542453pfb.262.2023.09.13.19.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 19:11:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 121E280239AD; Wed, 13 Sep 2023 19:07:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233335AbjINCHo (ORCPT + 99 others); Wed, 13 Sep 2023 22:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233160AbjINCH1 (ORCPT ); Wed, 13 Sep 2023 22:07:27 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 163904EE7 for ; Wed, 13 Sep 2023 19:02:51 -0700 (PDT) X-QQ-mid: bizesmtp69t1694656877tkm2a5m8 Received: from localhost.localdomain ( [221.226.144.218]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 14 Sep 2023 10:01:14 +0800 (CST) X-QQ-SSF: 01200000000000B0B000000A0000000 X-QQ-FEAT: bGXn9C6ahgSFte9kYhPmrslHZ6ZrQ+TnZx/ZE2jZlE4PHgLAwcln8WNX1+A1c C1vyx8Oc6uEVovocZqkT/MoY5qndYu4a3nXAuvHwIkpMYiG9X0AAbsoREF3pkmuVmZrqd8L uNTQf8tW/tMk0GWnAXrtgwUQYTJt95HkP+Xa3Gg0h8/htQEIs+TVLjB/lsHmh60DgcS4vVZ jdVdz1AVhprtauD5HgZbMWMhSm3yhlXzeX6QutZRtSojm2nZx9CFyRcTrPjERlyXUhTmLxa hUSuj4w9Nhsmm6+gsKn/evcMHtsgh7wqkNQKHuCmDBwb9Twfk0VMqUDF10BgCRGj7IvClFT oMPLmf1R2iasSXKV8QMAzN6zznWKw== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 930282796024689414 From: Song Shuai To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, lihuafei1@huawei.com, conor.dooley@microchip.com, liaochang1@huawei.com, guoren@kernel.org, ajones@ventanamicro.com, alexghiti@rivosinc.com, evan@rivosinc.com, sunilvl@ventanamicro.com, xianting.tian@linux.alibaba.com, samitolvanen@google.com, masahiroy@kernel.org, apatel@ventanamicro.com, jszhang@kernel.org, duwe@suse.de, eric.devolder@oracle.com Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Song Shuai Subject: [PATCH 0/2] riscv: kexec_file: Support loading Image binary file Date: Thu, 14 Sep 2023 10:00:42 +0800 Message-Id: <20230914020044.1397356-1-songshuaishuai@tinylab.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz4a-0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Sep 2023 19:07:50 -0700 (PDT) X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Hi, This series makes the kexec_file_load() syscall support to load Image binary file. At the same time, corresponding support for kexec-tools had been pushed to my repo[1]. Now, we can leverage that kexec-tools and this series to use the kexec_load() or kexec_file_load() syscall to boot both vmlinux and Image file, as seen in these combo tests: ``` 1. kexec -l vmlinux [other options] // or boot paniced kernel with -p 2. kexec -l Image 3. kexec -s -l vmlinux 4. kexec -s -l Image ``` Though all of the aforementioned tests had been passed in my RV64 Qemu-virt, it should be noted that tests 3 and 4 should be the emphasis for the current series. [1]: https://github.com/sugarfillet/kexec-tools/commits/rv-Image Song Shuai (2): riscv: kexec_file: Split the loading of kernel and others riscv: kexec_file: Support loading Image binary file arch/riscv/include/asm/image.h | 2 + arch/riscv/include/asm/kexec.h | 6 + arch/riscv/kernel/Makefile | 2 +- arch/riscv/kernel/elf_kexec.c | 469 ------------------------- arch/riscv/kernel/kexec_elf.c | 147 ++++++++ arch/riscv/kernel/kexec_image.c | 97 +++++ arch/riscv/kernel/machine_kexec_file.c | 8 + 7 files changed, 261 insertions(+), 470 deletions(-) delete mode 100644 arch/riscv/kernel/elf_kexec.c create mode 100644 arch/riscv/kernel/kexec_elf.c create mode 100644 arch/riscv/kernel/kexec_image.c -- 2.20.1