From patchwork Fri Aug 11 10:41:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Shuai X-Patchwork-Id: 13350552 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8222DC001B0 for ; Fri, 11 Aug 2023 10:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=sySKMHWiYIeXFK1/AA/KA8uq2gWKQL1VJUIU8CbfAqo=; b=cvpDbpa7l2ItjI w1f5S46+Mn2zyPiXFm0P3KVegDfbW+/jxa9KYkmINjz02yMHDiBAhmGLU6fzB/lmpMHlh+HHPJDB6 FFAxT5J1ETC+rbR8Vd6pDSzljqRAuG2+tjq06nibUdEpschomptLBGkL4GqLRVxw4FjHSneqAt9QD ZHUAeFlOfVqAbnQay+IE9g1IPJ9fEVKPI4jfDnXJAjhYIQALKPzzEBoR7MAIV2sffMERmYASFwS32 fa/VJ5oNzUnDQiaVLk7tewt8XhnTos0W7no9Gv0fFTBy9UPTlCA+HvzJYu3M2cFArGjBRTUhUPMRE uvflBNiyw86xbg6JmXdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUPd9-00AJS3-19; Fri, 11 Aug 2023 10:44:31 +0000 Received: from bg4.exmail.qq.com ([43.155.67.158]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUPd4-00AJPF-0H; Fri, 11 Aug 2023 10:44:28 +0000 X-QQ-mid: bizesmtp74t1691750628twnppqc9 Received: from localhost.localdomain ( [221.226.144.218]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 11 Aug 2023 18:43:47 +0800 (CST) X-QQ-SSF: 01200000000000B0B000000A0000000 X-QQ-FEAT: KvvwR/hcPA3wDrxxoGx7Hw85J4fbnAHT/H6ppnRFPhsFCSqdab+/VWSV20sET 2xTPGfF6DrfqK+G/9RdWT5MQe9YPAnRe22ySVL5ii6heLXHTiRtulaER7hAO20H/4XkFaAs xbaIFkoka/Z/i7T1yyro55Gg36dNsCvC9+vVaUqtrewO47s1w0m+Kj9wELTU94or9xZ1uB7 BPpS2YO1+ilDno1p3uy6VDS+QDVuydK//5LDKWBMXeWXoE+cPAivKsS2sdZbXAN6t0nFPfB TBUalr/SY822ZptygsBHhrL71qm1kvMZYBqhBL7+prbeyZ7BPJvcyqFV8oxtrviO5hGfVyX fO7+6CYYu0RR8Wheh5v/lXw0IAMGkfSSg9PxzDx X-QQ-GoodBg: 0 X-BIZMAIL-ID: 3284283975334745037 From: Song Shuai To: xianting.tian@linux.alibaba.com, guoren@kernel.org, horms@kernel.org, huanyi.xj@alibaba-inc.com, mick@ics.forth.gr, yixun.lan@gmail.com Cc: kexec@lists.infradead.org, linux-riscv@lists.infradead.org, Song Shuai Subject: [PATCH 1/2] RISC-V: Use linux,usable-memory-range for crash kernel Date: Fri, 11 Aug 2023 18:41:16 +0800 Message-Id: <20230811104117.91406-1-songshuaishuai@tinylab.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz4a-0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_034426_469300_774EFA5C X-CRM114-Status: GOOD ( 10.17 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Now we use "memeory::linux,usable-memory" to indicate the available memory for the crash kernel. While booting with UEFI, the crash kernel would use efi.memmap to re-populate memblock and then first kernel's memory would be corrputed. Consequently, the /proc/vmcore file failed to create in my local test. And according to "chosen" dtschema [1], the available memory for the crash kernel should be held via "chosen::linux,usable-memory-range" property which will re-cap memblock even after UEFI's re-population. [1]: https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/chosen.yaml Signed-off-by: Song Shuai --- kexec/arch/riscv/kexec-riscv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kexec/arch/riscv/kexec-riscv.c b/kexec/arch/riscv/kexec-riscv.c index fe5dd2d..5aea035 100644 --- a/kexec/arch/riscv/kexec-riscv.c +++ b/kexec/arch/riscv/kexec-riscv.c @@ -79,20 +79,20 @@ int load_extra_segments(struct kexec_info *info, uint64_t kernel_base, } ret = dtb_add_range_property(&fdt->buf, &fdt->size, start, end, - "memory", "linux,usable-memory"); + "chosen", "linux,usable-memory-range"); if (ret) { - fprintf(stderr, "Couldn't add usable-memory to fdt\n"); + fprintf(stderr, "Couldn't add usable-memory-range to fdt\n"); return ret; } max_usable = end; } else { /* - * Make sure we remove elfcorehdr and usable-memory + * Make sure we remove elfcorehdr and usable-memory-range * when switching from crash kernel to a normal one. */ dtb_delete_property(fdt->buf, "chosen", "linux,elfcorehdr"); - dtb_delete_property(fdt->buf, "memory", "linux,usable-memory"); + dtb_delete_property(fdt->buf, "chosen", "linux,usable-memory-range"); } /* Do we need to include an initrd image ? */ From patchwork Fri Aug 11 10:41:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Song Shuai X-Patchwork-Id: 13350553 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B40EFC001B0 for ; Fri, 11 Aug 2023 10:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n5cN4yS1dtxbKfkv4y3XyMjXyG/IDmTPbpprjqEXz/0=; b=O8DVufxiAAZ5Dj IOCiDe0E8U0aAwgap494bpeLmTT3mN4flRXV3Dkt0spmReWYHCv1I6dojVJcWAjj/OeXkHUDHfFeA TyfxYthjWjkcTLtTh6ZNAHlJOkot6nFda6E7jGHWXa/nZvMi3H0/lx0wIu+wireb0egym8yQtnUTn bjHckBHcTSjl+nSZ2B4YBjpKwogquF1vZLR62qsybEdDh4SF+MIwRKFOfcC9JzFfL69Rl0j1oDP5b LyOKNEDQOiGLvE8Zfpr96lqqvguzk745PB1S/W6niTJBzXun1DKsZHMojWpBWyQ3eWFCo5mUkEtLu 0IYgbdBQfnSIw8MKO10Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUPd7-00AJRk-2r; Fri, 11 Aug 2023 10:44:29 +0000 Received: from bg4.exmail.qq.com ([43.155.67.158]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUPd4-00AJPG-0R; Fri, 11 Aug 2023 10:44:28 +0000 X-QQ-mid: bizesmtp74t1691750632tj1s51gj Received: from localhost.localdomain ( [221.226.144.218]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 11 Aug 2023 18:43:51 +0800 (CST) X-QQ-SSF: 00200000000000B0B000000A0000000 X-QQ-FEAT: 0vfWcIgh24yN4kva2q777pdMblrZ+8/WLjSLXSE7czoqc0NbuDDWP7zp6EktE F88acLlLVUp4nZXjnjPHKu/KP7fTMKVgtkZ6R3wkL5nFyb9XsxWfNLWbboeOuYltbFvaFK6 Ox5yJl4yhMxpW+PUYUtuovvv6YB5jvRj183wXxfiSYXilIHt+SeODEa4s1IHmz/ePqim2CY DwAQ8h0/wnn1iJH3OhbzAo4MqGuMx4OgOmrotxQ6g2mplqo0RoN100+V0e4xp5+fzKitvds z3RJhTIK69KIFjBFdF3abKdqEEpz7fMYKMva5SB7UaxosW2o9psyQSG8lfk81RTvm1z7P0b LfjSvOqast4FMGCtbgHucai+BEDSpCJeSf3sy7x036CXcyDJuqMAtoOD3crZg== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 5156323152166706898 From: Song Shuai To: xianting.tian@linux.alibaba.com, guoren@kernel.org, horms@kernel.org, huanyi.xj@alibaba-inc.com, mick@ics.forth.gr, yixun.lan@gmail.com Cc: kexec@lists.infradead.org, linux-riscv@lists.infradead.org, Song Shuai Subject: [PATCH 2/2] =?utf-8?q?RISC-V=3A_Fix_the_undeclared_=E2=80=98EM=5FRI?= =?utf-8?q?SCV=E2=80=99_build_failure?= Date: Fri, 11 Aug 2023 18:41:17 +0800 Message-Id: <20230811104117.91406-2-songshuaishuai@tinylab.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230811104117.91406-1-songshuaishuai@tinylab.org> References: <20230811104117.91406-1-songshuaishuai@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz4a-0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_034426_513391_AAB4F55C X-CRM114-Status: UNSURE ( 9.23 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Use local `elf.h` instead of `linux/elf.h` to fix this build error: ``` kexec/arch/riscv/crashdump-riscv.c:17:13: error: ‘EM_RISCV’ undeclared here (not in a function); did you mean ‘EM_CRIS’? .machine = EM_RISCV, ^~~~~~~~ EM_CRIS ``` Signed-off-by: Song Shuai --- kexec/arch/riscv/crashdump-riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kexec/arch/riscv/crashdump-riscv.c b/kexec/arch/riscv/crashdump-riscv.c index 3ed4fe3..336d7a7 100644 --- a/kexec/arch/riscv/crashdump-riscv.c +++ b/kexec/arch/riscv/crashdump-riscv.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include "kexec.h"