From patchwork Thu Nov 14 05:15:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 11243091 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42A2B6C1 for ; Thu, 14 Nov 2019 05:18:35 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0AABA20659 for ; Thu, 14 Nov 2019 05:18:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Cl2CNyvy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zppns9CQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AABA20659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EZGXS+n83oarWNReJABAOOy+gEVoTDsYcKtTYMitgv0=; b=Cl2CNyvyKLyYE3 WGuL8LKnRKf9Jmm1jpLsA9H7YeXShQ+RSQG3mvtiz6O22+CoBGbSg209kCYgX+cDJDt7moeYQ0n4R b0yxj3IacbNIvs5s62bv/bFzQDmUHJKc1ygl+Q/aTQqy1OTTY66xArKR+Fsrw9eLpSAsZxln4K/Nm rEtW9oApJdcmozK1SNX98JHtUm1IOf0+vtR2chBk2gaLmZNoFI4Meh6DrS1qsCgzOQCuMXoIPXkqy WiKp4eNhLy7k5Vie8CjUpX01+ZTWnSWO4XWTYwaSzPfF8e+J52tE1HlO6i6OeTAbkVUAp9MoUgHok NTv0yBptldfS8L9KdYfw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iV7WZ-0004EA-9C; Thu, 14 Nov 2019 05:18:31 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iV7Sr-0007PQ-RO for linux-arm-kernel@lists.infradead.org; Thu, 14 Nov 2019 05:14:43 +0000 Received: by mail-pg1-x544.google.com with SMTP id 29so2926355pgm.6 for ; Wed, 13 Nov 2019 21:14:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K2wlRR3w/KTNdVqCYnrEwvs7sg2WubrsMP6gUzcCK3w=; b=zppns9CQ9NJAosr/LOsW1qDHdqq9EqFz5ZPBd7ZGpXbY79fJ2UVFUjsC9feu+OeRHH jtupVXzvx24ZZtmezz8rILhUwtykHm72bbXRADz/wG5Xyooq0ab2j+kPJKt4jiwKJl2d FH2/0qcxqyE1pxV4oVsrEIrqwNllLXxa5i0qQnqNr1U07RISfVBVpvjI8JKBOtAyQMtG TPcfcF9CbhRNOJM8m+sCcSigAOWit4iAi+t6k1O8M6SDs42jo6jnMYYpF+IBAn8AYM/g LA6GbbSwny1FrxmFPJ0PUtas1pgDTEqsAhyHs9QWGcgeXZClDrz4iDqFg1KfJvQXdYx3 Qp5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K2wlRR3w/KTNdVqCYnrEwvs7sg2WubrsMP6gUzcCK3w=; b=b0OpthB4ZXdxY9csyR1D1sTmFAAxPgS6TJ7iSKZtyEzyhtrIbUqpww9rciZTqGnRWq h2/eJtGajpHLzD3/0r/+gteP09wOysQ8b/k+MVHW7kVbkxsbsusaF3Nlq8oF04+j+5+e A6RSliNJOjkB5NuBOj13559BKlZOyRFCC+vsWiUBOfzlcepnikwxATnQZ1OcK0VRFyHd B9Lk2q3uga2c6TsrcJFHLXgbXTBLss0JRYgrCumg9mmaCKjVvh8r6qj1ZJf7LhBJW56R uPjscAj2CIvT5v9DBTQ5dJLoxbxmE2L4LqSTfsaSoYFRNlBGunn/XHTl6mKYap4yUZLY ZRbg== X-Gm-Message-State: APjAAAVxs0Eey+VDsbjYR3OgZ+2SP5fBz/MXR4bCSEmBDrJu/vNT1Haj mPmQyiLryftDHLPUNN7O3sdzjQ== X-Google-Smtp-Source: APXvYqwlEusLa94m5U+3WaWntarTbEi19zhc16zy/LNNcM+ekH+5cMHfghn0WaJojuUTkNWrbbbtHA== X-Received: by 2002:a62:5e04:: with SMTP id s4mr8967673pfb.63.1573708481126; Wed, 13 Nov 2019 21:14:41 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id f5sm7329049pjp.1.2019.11.13.21.14.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Nov 2019 21:14:40 -0800 (PST) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, robh+dt@kernel.org, frowand.list@gmail.com Subject: [PATCH v2 1/3] libfdt: define UINT32_MAX in libfdt_env.h Date: Thu, 14 Nov 2019 14:15:08 +0900 Message-Id: <20191114051510.17037-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191114051510.17037-1-takahiro.akashi@linaro.org> References: <20191114051510.17037-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191113_211441_911088_94EAF4AC X-CRM114-Status: UNSURE ( 9.96 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:544 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kexec@lists.infradead.org, james.morse@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, AKASHI Takahiro Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In the implementation of kexec_file_load-based kdump for arm64, fdt_appendprop_addrrange() will be used, but fdt_addresses.c will fail to compile due to missing UINT32_MAX. So just define it in libfdt_env.h. Signed-off-by: AKASHI Takahiro Cc: Rob Herring Cc: Frank Rowand --- include/linux/libfdt_env.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h index edb0f0c30904..9ca00f11d9b1 100644 --- a/include/linux/libfdt_env.h +++ b/include/linux/libfdt_env.h @@ -3,6 +3,7 @@ #define LIBFDT_ENV_H #include /* For INT_MAX */ +#include /* For UINT32_MAX */ #include #include @@ -11,6 +12,8 @@ typedef __be16 fdt16_t; typedef __be32 fdt32_t; typedef __be64 fdt64_t; +#define UINT32_MAX U32_MAX + #define fdt32_to_cpu(x) be32_to_cpu(x) #define cpu_to_fdt32(x) cpu_to_be32(x) #define fdt64_to_cpu(x) be64_to_cpu(x) From patchwork Thu Nov 14 05:15:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 11243093 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F51813B2 for ; Thu, 14 Nov 2019 05:18:49 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E0BB020659 for ; Thu, 14 Nov 2019 05:18:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XbFb8bIR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="s7vJIIec" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0BB020659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N/f1a4pkYUB68RFsV3GER3d7xfcjwG9ei1Yt3aGt8K0=; b=XbFb8bIRYsqw4V 1u2hHBJlFEKNI0UEgg5+fiJoez0pexoRgrNpl4+YRq2njhrOtevmoMEOkDzgJb9CmwX69PGrLD8Xn L3u3E9yAH1tPfJIfPjH9IdS/OmRZ+UMzQSKRzWJpRzso8PWIOKTuu9M560IY/ZpUuqWQCFoKRNeqJ JsPrkz+crgECaBsQ6VA8GI6n4SW0bdf7y9B+BnaRxacGxzPNppNe8u5hR9mdyON1DYpjc3YG0/VNl R8gwqxe1BUhhhcDcWyIQogdOTiJyjB7D1iK5C3FFq1CgFL2MZBCcfpX9s+WmdyRYfPDYDu2MXeD8r tX04qTtj+//1upr6KKiw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iV7Wo-0004UQ-6i; Thu, 14 Nov 2019 05:18:46 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iV7Sv-0007Sm-Mb for linux-arm-kernel@lists.infradead.org; Thu, 14 Nov 2019 05:14:47 +0000 Received: by mail-pl1-x642.google.com with SMTP id e3so2077817plt.7 for ; Wed, 13 Nov 2019 21:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zfaZ7B1OIQM+O5UvJ/wV2ZCp71JUGqq5m81NfGqahU8=; b=s7vJIIecua6jio8GHP1SNLsWbrutJhjvfgoslAJdyNfzmy2b9kqOYLOYM2io59i57Q jHqssXPr1DHovyseaLXmzWBud240mH+UczZjWG9GydYicchKzi4Wla8GgBJHMEh5oRFF jQvFs0JkSiGRkjFe88ooLL/JT+Hcmel4OTYtA2+A/YQTZhpxB2FKtIWwxw0Tx8vuDky2 7NVZHUujA72FiD4PpVq1EJDZEi7D2Vek7s0SsAE0g+DcZjJtNS7cFcPUdPZpqUkJeRoO a+gl4l0qGEmtluToROVonxdeXyD5qmLzG9MHlYvsMuFXNqsAfIOUCp7J05JVm7W5ZCVd Tu7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zfaZ7B1OIQM+O5UvJ/wV2ZCp71JUGqq5m81NfGqahU8=; b=CebaGIxTI6uEYyzJcAMKMAFNhzjAMUiFz+1ffTStPamTLL2XnQe0Eor3hCO5Pqfja+ 1P89Ml0+tyP+ilnJiGEwy5MGAnMtlkj5WA2z5CrCFBPLDhu6WaFfhslSag2VMj6s/Rp1 Or/oWCJZJmLFFEQdvFqjHgAui5rQ4NBRFnQ4+0GS5mOQNZdg6uFcWCKlZwmKv4cGiuTw 1UVeXZSJA0WTo8MP71K8DjJ4EEBtJlBGLU0tzLMV+oZHuN42aN+Lt4pKYvjUFRrp8O6Y sjXJyPiJCOFFb4Bej1rIqJXp9IlM756agN2k+wnDc1+9mp0KoIkNiPstXMOwh6HFSQkL SlQA== X-Gm-Message-State: APjAAAXM5cJV5pBgffmeOFBaNXfK1c5mFWIRUoP/1thYmo8SOLGLCNbk qwewAfSuzsIyB9zasSdXUdWDNw== X-Google-Smtp-Source: APXvYqwvSy/LfRqw2z0v90Wt959y1d3zEAzp3xYzp6pLJgAetEFbCnaPuTr2G6XfYbzFoablMg0SNQ== X-Received: by 2002:a17:902:7892:: with SMTP id q18mr7731002pll.171.1573708484192; Wed, 13 Nov 2019 21:14:44 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id ay16sm9718758pjb.2.2019.11.13.21.14.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Nov 2019 21:14:43 -0800 (PST) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, robh+dt@kernel.org, frowand.list@gmail.com Subject: [PATCH v2 2/3] libfdt: include fdt_addresses.c Date: Thu, 14 Nov 2019 14:15:09 +0900 Message-Id: <20191114051510.17037-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191114051510.17037-1-takahiro.akashi@linaro.org> References: <20191114051510.17037-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191113_211445_790839_78617874 X-CRM114-Status: GOOD ( 11.63 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kexec@lists.infradead.org, james.morse@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, AKASHI Takahiro Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In the implementation of kexec_file_loaded-based kdump for arm64, fdt_appendprop_addrrange() will be needed. So include fdt_addresses.c in making libfdt. Signed-off-by: AKASHI Takahiro Cc: Rob Herring Cc: Frank Rowand --- lib/Makefile | 2 +- lib/fdt_addresses.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 lib/fdt_addresses.c diff --git a/lib/Makefile b/lib/Makefile index c5892807e06f..1587a2de99c6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -220,7 +220,7 @@ KASAN_SANITIZE_stackdepot.o := n KCOV_INSTRUMENT_stackdepot.o := n libfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o \ - fdt_empty_tree.o + fdt_empty_tree.o fdt_addresses.o $(foreach file, $(libfdt_files), \ $(eval CFLAGS_$(file) = -I $(srctree)/scripts/dtc/libfdt)) lib-$(CONFIG_LIBFDT) += $(libfdt_files) diff --git a/lib/fdt_addresses.c b/lib/fdt_addresses.c new file mode 100644 index 000000000000..23610bcf390b --- /dev/null +++ b/lib/fdt_addresses.c @@ -0,0 +1,2 @@ +#include +#include "../scripts/dtc/libfdt/fdt_addresses.c" From patchwork Thu Nov 14 05:15:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 11243095 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 538686C1 for ; Thu, 14 Nov 2019 05:19:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0BD1C20659 for ; Thu, 14 Nov 2019 05:19:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mSWJVJ/n"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tLqR9tyQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0BD1C20659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C9v0IV+C3cVi3F0L1BkSdNdQ+23zH8z3eQGNCudBH5s=; b=mSWJVJ/nEB7tsB 5QyLszOSFasVd+UVxpd/dHzUnmADOIbCnXXyLrOIOFuO0vPg6NSBwjngVO7Y7AC1OBnipRLybUovr TYfh1Q/jQDtBmwemqWwhhYIbwG7QTBHWTwLWfVRI8uvMWW31AX4r9Z+jhLUqEqGtVCqUyiK1QFFL+ oYS+6/w+7nZpjhbLrTyO5aYjVnBibiHhMfSHIZ4UwDPQ6hj2zSoPdJ6Qa9M4wR7kQkRdjzuWUfwqn Nj+7YdNkk8y2bINOotvcq/D8VlDosj3USWF58WNOIlA8W/rDjkGjNEV5+urfeLzT/YMuLPoodRAVV yGpXFGlZYTrVYSPAGC3A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iV7XB-0004qg-KG; Thu, 14 Nov 2019 05:19:09 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iV7Sy-0007VK-Do for linux-arm-kernel@lists.infradead.org; Thu, 14 Nov 2019 05:14:51 +0000 Received: by mail-pf1-x442.google.com with SMTP id z4so3303518pfn.12 for ; Wed, 13 Nov 2019 21:14:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ew9UIe0gxCMPozp8V2Gx3IW4RheVAJmULxjEy8TwDyE=; b=tLqR9tyQatIBtOL6M/Wuy6vaRfIxonQD1cmW2t/veoHJ6l5LSJZQLsSUAYWDywqTMF 5za5lpRGBr51UpLcnolkdRRtlJ3RWjnAqVYhbvJLj76t0sdPSVkPfVB76UBwaiBpqSQ0 Kjt/oPBCWi7TyDoyhcNXgZAvlkO3erpvJyl3nZPgkFyepkFhcyEB4K42bM1VcrqKsbMh AP+5A7tUV7jzr3PMz822HXAnWMi1aSPYwkDVTsHLJnjDKXw/hFYpLJmQhnqMOiLulC3g RSGIWflHR3bbKHhuGKE+JMNFz6Ho3MvExXZInt79DEg2QvV6XDqcftza5lX1L6Masp6N p7Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ew9UIe0gxCMPozp8V2Gx3IW4RheVAJmULxjEy8TwDyE=; b=gEnAAjxPBG+g4afWXiaMCqtXWouEzPmiynxUnxr0ssYPohe139byfvhtEziUknaROX QRKnEILwQh8N9tc/HZMuwHHmOCROP5rqNYtUSIVTDWBdUTRl285HNkAZ7vNX8rURVwYr KyMoYZUqnrfnA2dm1csk3OC86Cj5ZV5hMfMDaoDNg/us0JCLYtFDCEk2f06hN2y3C8bc 1y5HmxpB4sXsjTrQcPXuOeuGW3yKbXL9q78Yhyw+2j2xo+As1WeAiNbdO6OvfnUaCD06 V8J7amCwJFxRCNyNIFAygrRTIrDXFW+xAEV41PYQWxrpeYA0LmjyLOzpsbqjxZ7KGpMg 8s0w== X-Gm-Message-State: APjAAAW9xCF4QctPlweI+XeCqO8h3jFrgbziRVHH+GhEsHMNysvMrRf6 xgLO3SZVZSLk2JqD5DcZDBoPgg== X-Google-Smtp-Source: APXvYqzP2I1o6IKsZGyHSge5h9cwtFclY+VdIbuXsYJj2sQt/71XoyquRIVcSzK6hv+f0F3k2ieRXA== X-Received: by 2002:a65:6098:: with SMTP id t24mr7364361pgu.95.1573708487415; Wed, 13 Nov 2019 21:14:47 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id fz12sm4093285pjb.15.2019.11.13.21.14.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Nov 2019 21:14:46 -0800 (PST) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, robh+dt@kernel.org, frowand.list@gmail.com Subject: [PATCH v2 3/3] arm64: kexec_file: add crash dump support Date: Thu, 14 Nov 2019 14:15:10 +0900 Message-Id: <20191114051510.17037-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191114051510.17037-1-takahiro.akashi@linaro.org> References: <20191114051510.17037-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191113_211448_567261_83C6EC20 X-CRM114-Status: GOOD ( 20.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kexec@lists.infradead.org, james.morse@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, AKASHI Takahiro Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Enabling crash dump (kdump) includes * prepare contents of ELF header of a core dump file, /proc/vmcore, using crash_prepare_elf64_headers(), and * add two device tree properties, "linux,usable-memory-range" and "linux,elfcorehdr", which represent respectively a memory range to be used by crash dump kernel and the header's location Signed-off-by: AKASHI Takahiro Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: James Morse --- arch/arm64/include/asm/kexec.h | 4 + arch/arm64/kernel/kexec_image.c | 4 - arch/arm64/kernel/machine_kexec_file.c | 106 ++++++++++++++++++++++++- 3 files changed, 106 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index 12a561a54128..d24b527e8c00 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -96,6 +96,10 @@ static inline void crash_post_resume(void) {} struct kimage_arch { void *dtb; unsigned long dtb_mem; + /* Core ELF header buffer */ + void *elf_headers; + unsigned long elf_headers_mem; + unsigned long elf_headers_sz; }; extern const struct kexec_file_ops kexec_image_ops; diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c index 29a9428486a5..af9987c154ca 100644 --- a/arch/arm64/kernel/kexec_image.c +++ b/arch/arm64/kernel/kexec_image.c @@ -47,10 +47,6 @@ static void *image_load(struct kimage *image, struct kexec_segment *kernel_segment; int ret; - /* We don't support crash kernels yet. */ - if (image->type == KEXEC_TYPE_CRASH) - return ERR_PTR(-EOPNOTSUPP); - /* * We require a kernel with an unambiguous Image header. Per * Documentation/arm64/booting.rst, this is the case when image_size diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index 7b08bf9499b6..f1d1bb895fd2 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c @@ -17,12 +17,15 @@ #include #include #include +#include #include #include #include #include /* relevant device tree properties */ +#define FDT_PROP_KEXEC_ELFHDR "linux,elfcorehdr" +#define FDT_PROP_MEM_RANGE "linux,usable-memory-range" #define FDT_PROP_INITRD_START "linux,initrd-start" #define FDT_PROP_INITRD_END "linux,initrd-end" #define FDT_PROP_BOOTARGS "bootargs" @@ -40,6 +43,10 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image) vfree(image->arch.dtb); image->arch.dtb = NULL; + vfree(image->arch.elf_headers); + image->arch.elf_headers = NULL; + image->arch.elf_headers_sz = 0; + return kexec_image_post_load_cleanup_default(image); } @@ -55,6 +62,31 @@ static int setup_dtb(struct kimage *image, off = ret; + ret = fdt_delprop(dtb, off, FDT_PROP_KEXEC_ELFHDR); + if (ret && ret != -FDT_ERR_NOTFOUND) + goto out; + ret = fdt_delprop(dtb, off, FDT_PROP_MEM_RANGE); + if (ret && ret != -FDT_ERR_NOTFOUND) + goto out; + + if (image->type == KEXEC_TYPE_CRASH) { + /* add linux,elfcorehdr */ + ret = fdt_appendprop_addrrange(dtb, 0, off, + FDT_PROP_KEXEC_ELFHDR, + image->arch.elf_headers_mem, + image->arch.elf_headers_sz); + if (ret) + return (ret == -FDT_ERR_NOSPACE ? -ENOMEM : -EINVAL); + + /* add linux,usable-memory-range */ + ret = fdt_appendprop_addrrange(dtb, 0, off, + FDT_PROP_MEM_RANGE, + crashk_res.start, + crashk_res.end - crashk_res.start + 1); + if (ret) + return (ret == -FDT_ERR_NOSPACE ? -ENOMEM : -EINVAL); + } + /* add bootargs */ if (cmdline) { ret = fdt_setprop_string(dtb, off, FDT_PROP_BOOTARGS, cmdline); @@ -125,8 +157,8 @@ static int setup_dtb(struct kimage *image, } /* - * More space needed so that we can add initrd, bootargs, kaslr-seed, and - * rng-seed. + * More space needed so that we can add initrd, bootargs, kaslr-seed, + * rng-seed, userable-memory-range and elfcorehdr. */ #define DTB_EXTRA_SPACE 0x1000 @@ -174,6 +206,43 @@ static int create_dtb(struct kimage *image, } } +static int prepare_elf_headers(void **addr, unsigned long *sz) +{ + struct crash_mem *cmem; + unsigned int nr_ranges; + int ret; + u64 i; + phys_addr_t start, end; + + nr_ranges = 1; /* for exclusion of crashkernel region */ + for_each_mem_range(i, &memblock.memory, NULL, NUMA_NO_NODE, + MEMBLOCK_NONE, &start, &end, NULL) + nr_ranges++; + + cmem = kmalloc(sizeof(struct crash_mem) + + sizeof(struct crash_mem_range) * nr_ranges, GFP_KERNEL); + if (!cmem) + return -ENOMEM; + + cmem->max_nr_ranges = nr_ranges; + cmem->nr_ranges = 0; + for_each_mem_range(i, &memblock.memory, NULL, NUMA_NO_NODE, + MEMBLOCK_NONE, &start, &end, NULL) { + cmem->ranges[cmem->nr_ranges].start = start; + cmem->ranges[cmem->nr_ranges].end = end - 1; + cmem->nr_ranges++; + } + + /* Exclude crashkernel region */ + ret = crash_exclude_mem_range(cmem, crashk_res.start, crashk_res.end); + + if (!ret) + ret = crash_prepare_elf64_headers(cmem, true, addr, sz); + + kfree(cmem); + return ret; +} + int load_other_segments(struct kimage *image, unsigned long kernel_load_addr, unsigned long kernel_size, @@ -181,14 +250,43 @@ int load_other_segments(struct kimage *image, char *cmdline) { struct kexec_buf kbuf; - void *dtb = NULL; - unsigned long initrd_load_addr = 0, dtb_len; + void *headers, *dtb = NULL; + unsigned long headers_sz, initrd_load_addr = 0, dtb_len; int ret = 0; kbuf.image = image; /* not allocate anything below the kernel */ kbuf.buf_min = kernel_load_addr + kernel_size; + /* load elf core header */ + if (image->type == KEXEC_TYPE_CRASH) { + ret = prepare_elf_headers(&headers, &headers_sz); + if (ret) { + pr_err("Preparing elf core header failed\n"); + goto out_err; + } + + kbuf.buffer = headers; + kbuf.bufsz = headers_sz; + kbuf.mem = 0; + kbuf.memsz = headers_sz; + kbuf.buf_align = SZ_64K; /* largest supported page size */ + kbuf.buf_max = ULONG_MAX; + kbuf.top_down = true; + + ret = kexec_add_buffer(&kbuf); + if (ret) { + vfree(headers); + goto out_err; + } + image->arch.elf_headers = headers; + image->arch.elf_headers_mem = kbuf.mem; + image->arch.elf_headers_sz = headers_sz; + + pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + image->arch.elf_headers_mem, headers_sz, headers_sz); + } + /* load initrd */ if (initrd) { kbuf.buffer = initrd;