From patchwork Thu Sep 12 06:01:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 11142307 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 407AA912 for ; Thu, 12 Sep 2019 05:59:55 +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 1CE662075C for ; Thu, 12 Sep 2019 05:59:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HUXUo4eB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="a1izBfJN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CE662075C 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=HUXUo4eBomnNi9 WzNkuxPmHcx6yARHIFWLV0wNRuk3nv2FgcH87uU8cioy/Gd0MwCKLp4VdFRawivlPjI9M0c0r6L71 T5e3nVgjBcf6pAp6C/VXpCoVVIiY1BGf3iU9+Cz/6zt5WEgmcnNvkkB7EXo0wrq2ftuKF4J+Na47y AIDe42YqxtQ6SEs8AkF+y7Gb6k2dX1LFJMTPFm0Q1vMCH2PROBd91XPT4MZUds1Uoy85VqOzEPK1/ 7Z9anKOxmgo07Siocr99rKX2c/wtpRzbLBy2gt+Ii4KwGlM5Lytd818LPFWZQQKquv1z9qDaZDZhH 0tE6/+HAUDw41ysX2GHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8I8t-0001Rt-Oj; Thu, 12 Sep 2019 05:59:43 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8I8q-0001Qq-J4 for linux-arm-kernel@lists.infradead.org; Thu, 12 Sep 2019 05:59:41 +0000 Received: by mail-pf1-x443.google.com with SMTP id q21so15232661pfn.11 for ; Wed, 11 Sep 2019 22:59:40 -0700 (PDT) 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=a1izBfJNPh0xpl62rBUom1TVz4AD5siG6EraiJHLvL4gUGp0cW8alx2ORZ9jzKbGFX xWVqVXev/nHzAR9H/cEc2LKR9JLK9zWH6tIwAT1lb2tISj+ZgqjofZOR/0iNeBECZ+BS ISy/kii4aozfEQv4ehzP1Rh7lrkusxFuiyJiIHyoj0SKN/QmGlgCB2U1T/hLXT+RwfrE OjtbsEXNz20nDjM751kbB4MqoXEIxqUq9mykMCgRPGxRnkJkL0PwVvQIHk1sCR/Sg/iX 26r3FUpGtVGk0UXhPg5W9g5oLCXS8RwCvpYAKtspZr+l8KYQFGoiKt+yEy4nJVAuVrfd UMLw== 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=qHUJ8mTMGftbUWdVuTIoCkNLgZmDbrJxo/tvlv1XKLNTJK0f/TivvWa/s1Iq0LtlmK BaftjGZXsV6i6Zzf55ZPQ7vUHS2BRo67rYUGSVDx3y9q7hiHuvyezKpUBTPyKCO98t2W 7+6yhApGqp2ef4ehHk4aOMEO1DrQB0hCUvJxGUQMsUhe3lU8lHYZKQBhuTx4JB0S4vmJ e6ozvrr43WCP+fYQkqFNAvhwxvQOEt28ONPKulrfLRFVchAO3wdGyqiZa5e2w5Fu0f/R vI96YG/mfxOsEoxpSgkb3YgZDorBshvJAp8yAKtNV+BF4YjZDl5LL/sDY1Zs4t8gp6k9 M+jg== X-Gm-Message-State: APjAAAW8NQ1uBPxqO91aRnSfwjizu1xDZRPvI5hixXNXS2yoTdOOKP8o Rz0OUhn87HXvG8s8XHQQKPP9hw== X-Google-Smtp-Source: APXvYqxhrvEMXCYdoVnQe8x2WLbfUA2cbM+KZMZ+EXo6BWAKSNzbpi4c8Q5F6ZhyyyGKEBV5ult3JQ== X-Received: by 2002:aa7:9a48:: with SMTP id x8mr45589514pfj.201.1568267980014; Wed, 11 Sep 2019 22:59:40 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id x9sm11590512pje.27.2019.09.11.22.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Sep 2019 22:59:39 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, robh+dt@kernel.org, frowand.list@gmail.com Subject: [PATCH 1/3] libfdt: define UINT32_MAX in libfdt_env.h Date: Thu, 12 Sep 2019 15:01:48 +0900 Message-Id: <20190912060150.10818-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190912060150.10818-1-takahiro.akashi@linaro.org> References: <20190912060150.10818-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-20190911_225940_625672_4CCC3251 X-CRM114-Status: UNSURE ( 9.70 ) 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:443 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_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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 Sep 12 06:01:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 11142309 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 EDAF0112B for ; Thu, 12 Sep 2019 06:00:00 +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 CB8782075C for ; Thu, 12 Sep 2019 06:00:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="T1DlSIPg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FRbBT6xd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB8782075C 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=GDX0Q8bazDS1l1k+eMaXFhXPp/ISCbScmlpkViVrfgc=; b=T1DlSIPgmUg0j5 qTpKzY0YI/YjAXuCa44DDT+nT2lYx9SHjeLzP2y1WwRH/3N9XxlnRurHr9xadLQgtEJXzviTellHn G4wwHRLWbtNnL7vXgdLi5CsK8CgeLyjzj7tCjwrGk4ZrX0xTlqtIEA/0G7j+2fzjTut2K4CzptLid v2w4fvhozHhp9IZ0QvOyF8BG1Jf7qKye9saLjjZ4HnVOt1+xRw42Rpjn1IGjqrL0I5tJhGodabBTa bdu5+X8I8niYX5plMwcdNk5XLSd7VLPAeBk5e+cryLT1MhDg9vSH8z16ULdWpA0YO69CNKEp/A31x egz+Fn/xECxzHBsuaqsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8I98-0001gZ-MI; Thu, 12 Sep 2019 05:59:58 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8I8t-0001RQ-3d for linux-arm-kernel@lists.infradead.org; Thu, 12 Sep 2019 05:59:44 +0000 Received: by mail-pf1-x443.google.com with SMTP id b13so15228482pfo.8 for ; Wed, 11 Sep 2019 22:59:43 -0700 (PDT) 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=9duNwvJ16wl6i9JK0JxmwLCbqMy/YOSDsatt/Ugxhh0=; b=FRbBT6xdaywYm1Eq4QN4D3bijixSYoPo3VEn4SC9G8XRTVtx2IkVj9TcOA0JSqYwGl TZhqsDfWYc/B6ydJEVo85YRRqO0oBLCkTVGABfLCd3Yw0QbYOivmnkXkchJlRi5w05QU cf7Mr1+lci9lrE1CT9JzMyKmO2hXvEAZt1d9KCFMO1vEiq7HQs8wF8P1cWcwyLkFkizJ kcvzVym1tbRJ2YW7GPmoOmaaomsJZDqyMOere0qiKofATuSvBD2jm092/SbxUyDChRrl p7niPQNlxz8L7+QJv/3dbYqXZSh1Rb6TpIuA6UdXL2JcyE4kjkMZ8RLIJAG85VMQm1tC 6NlQ== 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=9duNwvJ16wl6i9JK0JxmwLCbqMy/YOSDsatt/Ugxhh0=; b=K34rV1S4fHuwV7R5KLpvbW/xEnBpH8F7Tp9S6uVNDL1D8k61zKKwap8aDXs6FvVwZ7 LhN0OJUlBZxLNcvF1/f1VeupEAL/aQ2fYYrX4UKbvf9euBtxhxV7UwMJNhmBn6LTnO2Z ELvFKGF9scNLJN7X3FSPfOmsP2wM3DQoL9sfQEYIkbvCHtVoPA36V82VRQPw9MFOKyoz j9YFX85DEVEICMfFC+VZkpjDN9nrSuMRLMQsQ/X8O0y4nuCPmY7an5PqCZIQEZgBZO9h rcoTMSC82Qn++866wzVq575Q2vFOQ1rn72OhkHx4OB7HvCsVcu4VrlMUbkpIPydPBnuZ JQ0g== X-Gm-Message-State: APjAAAU3noV7mPQT9i6iIaf1cQmr8bt+1UeETMlZI7+SJ9mm0J8kcuES hh2nicR4kQ+2Z7KWkFjw0nZyvOt1etk= X-Google-Smtp-Source: APXvYqwRT/QyokAzKYSkNXb9bPY58QTKW/gzk7wHl7wSKXMyR2OixJVa29yltPDRmZGoDv813RK/bA== X-Received: by 2002:a62:e10a:: with SMTP id q10mr47211817pfh.236.1568267982763; Wed, 11 Sep 2019 22:59:42 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id z12sm4461135pjp.11.2019.09.11.22.59.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Sep 2019 22:59:42 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, robh+dt@kernel.org, frowand.list@gmail.com Subject: [PATCH 2/3] libfdt: include fdt_addresses.c Date: Thu, 12 Sep 2019 15:01:49 +0900 Message-Id: <20190912060150.10818-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190912060150.10818-1-takahiro.akashi@linaro.org> References: <20190912060150.10818-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-20190911_225943_147992_061CFE53 X-CRM114-Status: GOOD ( 11.25 ) 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:443 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_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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 29c02a924973..59f082727503 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -224,7 +224,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 Sep 12 06:01:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 11142311 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 A405176 for ; Thu, 12 Sep 2019 06:00:22 +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 818882075C for ; Thu, 12 Sep 2019 06:00:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="huSjBLiK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eBDesVj3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 818882075C 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=Jo4vhvNY399Ks95jZ+efb7ojs+40KXa+RgMnCgBUS2A=; b=huSjBLiKrVmMXT 54SeSsLkM7xXF4yCXktKThe5g8Gp5Bj3ndotHyQVnhUdG4CW7dX56xxD5J7+Z61jXm4kXRVM57hV4 whSEzDq4jWwI7y9WK0dx41rmccDeUzZGhmMxKaOR38Tc+WAC7NiLerBjet1KVsz1FTESRvsqNsTOJ l2TIPzV4jLJy36/+P/6qUcvwCB/FZPeX4A1/pB6LUa7Mi76n0e3jJGkXTgLti1uBKrGuxRspALSg1 u2Tf28Kb/7RzAVyNfkasItFMMvfod76KuCA4awmTEDlJEigHkVoo0Nzhb7cF5IdHvH4MF97RAetJ7 LfC0PM1JLMKznmA51PbA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8I9V-0003CD-TT; Thu, 12 Sep 2019 06:00:22 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8I8v-0001UI-Ss for linux-arm-kernel@lists.infradead.org; Thu, 12 Sep 2019 05:59:47 +0000 Received: by mail-pf1-x441.google.com with SMTP id q21so15232823pfn.11 for ; Wed, 11 Sep 2019 22:59:45 -0700 (PDT) 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=FxFE8kRj/EbRgKoWP35uNVOjcf/RHJrS7TO4gPoF1aw=; b=eBDesVj3g+SbqAKG8q2xV8P2B/mupoEtGicY3Is/+aV/JLmtliD/CQj1oHz5AbTGzT ibeR+rVsYLMo2C6oEn3s7NCJLs8Z9tToLUbJZBP6WvV+0QBx2hcmhfNM/7LYDc5n2RmY cZoj8I/SJrol5TJQR3Bn4K+0e/5hXi1dkfiGlwNWQQIP3trO1v3hQFjlOqxjRmFIaPJO No8MV7FL7eXNx7wBqMopi0DAxFyySodWwynsSEFmtDXTBQJNuktqXOa/pKR6L6BZcxk/ ZGxt5OVSHPNSl1ybKJhTalSIwduOPKikGWAF6yPVoK/teypHOhztCG1Bxg8gYA8rDw/J jceQ== 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=FxFE8kRj/EbRgKoWP35uNVOjcf/RHJrS7TO4gPoF1aw=; b=FihDSw8yWImGRFS9IWeWfY1liQtSsuQ6dcePQIlOBYFjgHAQk9qlJiinMbTT1DHHKY jP5JbOjPpiIwZAGkndENgPT07Em+v8tXDkyuUCvMi/bspeSphz3xO3j29H6qOiFS6bWf /bAQBT7QMmuEtp7V+jgfcrwwkI0g7oFfFhMnzSL8XtxuXCpRaKN48/KHzw6uARFM2dcE uGr4qEaRaGXFsrscWe9ENLE7t6k8Lt8fF20Ysl6eQydC1++NdafpdOVHbioxnhe/W6ex SXjPv0UZyIS6i0+GIcFIeVNPHNRWPffXUoJHpeFxfl4Mnfzb6b3Ivx7OouK77YOR2hos GSYA== X-Gm-Message-State: APjAAAWiLjtk201y6PlDYuHyYVRP69GCQo/RBESSeQG3MfzkQBjiZrOw +Rw6MmQ10zsVlRLihJaCbllELg== X-Google-Smtp-Source: APXvYqzrUMHEJKlllEkbtSJF1fAnGNVZUDuEsmrY+s0nLn1qDSccMEfHsDcRj8CGFkCxHj7Q65zOwQ== X-Received: by 2002:a62:5c82:: with SMTP id q124mr47525159pfb.177.1568267985462; Wed, 11 Sep 2019 22:59:45 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id l62sm36827139pfl.167.2019.09.11.22.59.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Sep 2019 22:59:45 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, robh+dt@kernel.org, frowand.list@gmail.com Subject: [PATCH 3/3] arm64: kexec_file: add crash dump support Date: Thu, 12 Sep 2019 15:01:50 +0900 Message-Id: <20190912060150.10818-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190912060150.10818-1-takahiro.akashi@linaro.org> References: <20190912060150.10818-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-20190911_225945_975716_FCC1358F X-CRM114-Status: GOOD ( 19.17 ) 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:441 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_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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 | 105 ++++++++++++++++++++++++- 3 files changed, 106 insertions(+), 7 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 2514fd6f12cb..60cedfa9529b 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 58871333737a..f5276e27c12b 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" @@ -38,6 +41,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); } @@ -53,6 +60,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); @@ -110,7 +142,8 @@ static int setup_dtb(struct kimage *image, } /* - * More space needed so that we can add initrd, bootargs and kaslr-seed. + * More space needed so that we can add initrd, bootargs, kaslr-seed, + * userable-memory-range and elfcorehdr. */ #define DTB_EXTRA_SPACE 0x1000 @@ -158,6 +191,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, @@ -165,14 +235,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;