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: 179365 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp10573037ilf; Wed, 13 Nov 2019 21:14:45 -0800 (PST) X-Google-Smtp-Source: APXvYqyOmhVtXZdBNCwF0/PjEbGnOPbOdrbGR2FLxkFYAkaWu8j72y2+D/9XOm0RV50JHLBfQdWt X-Received: by 2002:a17:906:6093:: with SMTP id t19mr6544466ejj.50.1573708485420; Wed, 13 Nov 2019 21:14:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573708485; cv=none; d=google.com; s=arc-20160816; b=FcKgCBg8loKX1XPV6DwOjpDtCsKMQZTyLF6tKoq9UTui+MROWTKET2YCcH08sKAsj4 +YCg70p1bcAXGhznjeF8RWuQfr1O7KAU/NpcWMw7qOVwsNDMiTo7x+cE8ohI02T7yx0s n0fQHzgTvQIpGGqqvZefZdUt/FKGTv+H+eZsHLHdn0scjo1UW7vqulj703WmDf0rwOTS 6BsJITF6aWQTYryYl7lS/dkdxUCsccv27KBJVG5DQTTw+2ULGF5nZv0lW4PZsdZwbWJt dHOYTvUJ3/xUKpA8aob0pQUU4oSIncCazQksb30On7ytFpiTiJqJsOpw7Lqngr6BR7Up 5JIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K2wlRR3w/KTNdVqCYnrEwvs7sg2WubrsMP6gUzcCK3w=; b=0VtxR0Pe63NAiuIuoneN5K/3UlSgMGP92GIlscunEPcSCcEOYJ3gxiNTqWRwq/rNiT lil8gxretm4esAsHMDaDSxQgUt6XxlARnfMQQcVM3Zd29L3vxPpSoOZ7d4R5ZVhCF5Fa Ug1V6uKqTlfcu6FN1pxL8uwX4mOUry9Opxg6LUAbkvlo//8XaAJkdSeJWxzwq9bjXepL D5lh5yOND1LB8+T2HGZs52kH2pH4gKJH8UPIZFcUcJVQTZE2nDpJN+pGqu1+bIRBXgrR 7n23uHexQnLeK8KBPW66B8YWt/Ki2j8RaOktYTT1hy8hmbEjfvQgt1kuJEpXfZWdnCQi yOmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zppns9CQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si3146989edd.8.2019.11.13.21.14.45; Wed, 13 Nov 2019 21:14:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zppns9CQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727363AbfKNFOo (ORCPT + 26 others); Thu, 14 Nov 2019 00:14:44 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:41129 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbfKNFOl (ORCPT ); Thu, 14 Nov 2019 00:14:41 -0500 Received: by mail-pg1-f194.google.com with SMTP id h4so2919193pgv.8 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=a2eXJAOwPu27/dx2fbmI6uCGHRI5EERwOG2zYLWoSxyJBF4oMEeScOHfbpXP1FTwML QsXN08VNtW2v9cxEEGPbG9zd65HgN0kcgXIfARFmRAeHBHw741vCBea3Vmfsz/Oe79O7 KPOGjGgmoJ2d1cN2mM8V/86cyvzVM337ADY224QInryOhs6bB6opxZwc9OQn9H2FFg/4 RGVG3ILTfUuMBLueMgfKM/VlQf39CgTGBFf/VM5ERdzjHcO9hsyt2ncg+O97fnyDssCj 89kdGM3w4kBMKkFAF5FfL5g8fKmAEyj43SDcXa9ilKArKKAYjydYKWNmq9FrHdyyko10 fUvA== X-Gm-Message-State: APjAAAUVWMCRTxhUw9rpAai2yarnZNFL6SNMwD8ylsWIKMMm5BI1gTJ7 /3zC3/t8WnrtNBOV2fI46hhk+Q== 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 Cc: james.morse@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(+) -- 2.21.0 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: 179366 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp10573103ilf; Wed, 13 Nov 2019 21:14:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyBAU2vbAh8+XuT8R+UZ6XGa3It41BlQmPxC+bi5nLrVwCKzB0soWBPw6vvEE5lT5/15Bop X-Received: by 2002:aa7:c887:: with SMTP id p7mr7737754eds.268.1573708490318; Wed, 13 Nov 2019 21:14:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573708490; cv=none; d=google.com; s=arc-20160816; b=00xszXtSKCphAXMA6NLbh3AbtMDEA4z/nTiSvUleSRdDjHkZkaBgaoSXhGBbWIHiLp hv1kjryKKpo9FW+k++JmdKn9mFZ3I2SqBQ0hRLxuWCXpkGm/X7rjK68iFGIena6hBrlL T8ZAI0pJYtcRE8G9aAyxjlU6JVa3IQh2jHoTdZAG6hiWMskDVsGNgTrv5X3+60RiN6UE rIBAW3T+vdI5FzkdxcfxzglSKQJYKWN4mxYXgLdPL7mbcEtIJWXp7VVyFWMCHPV/3jux 8QBVIMYCghrWEmM8yjN4BxqM+j5VQPC7ZiWyeF1K/nKoWO0dj1NRcv2mkRgtInhCE0XK hXPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zfaZ7B1OIQM+O5UvJ/wV2ZCp71JUGqq5m81NfGqahU8=; b=HcBE6qf4snmFywskDgQQEKDVoa5PS9wJfA/V4iWEW+GM7cOJblQgSPuAoqFA3tQpXP iLvKhNf84EQLtphcSxQE4tNFCtUTQ43qx5BbyVVUgM2Q8uOb07l1VS3ti1yxSXnJK5e7 tu/6fRtQRz8EFlcmk4S6WfRW8xKienNEtHwm4V6Eab6AhoPN7kAL1BQUl0crD1R1tAaK 5qOO3JJYZL8PFEsS9Nmogm+5m0DEqbOhYerpVFfBzpkbbMVIkAwGaZ21Asd7YBl9smLf rWMYc7wjE2DK4WbPSczl1z4EmHXlf1cYS6HI6oubTw9wehx3bqFhk6LzmzaklwBR9W/B 6FGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s7vJIIec; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f25si2649605ejw.85.2019.11.13.21.14.50; Wed, 13 Nov 2019 21:14:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s7vJIIec; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727387AbfKNFOs (ORCPT + 26 others); Thu, 14 Nov 2019 00:14:48 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36960 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbfKNFOq (ORCPT ); Thu, 14 Nov 2019 00:14:46 -0500 Received: by mail-pl1-f195.google.com with SMTP id bb5so2090126plb.4 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=SwAu+5myLx+JQW9r5bAqmK7bDsLbf9HEyax+YmXsJxPiJF9oUd+Vqb/MXnDiq7C3NY 9WUQvqgEHUiOJZjCfSS6vG732Iaza+ibWk0vACNklcBu4u5zG1htZUY3djHuHZsyG/Eq 6OFfDsszs6RF2OxTyGPgTBG0fM71aqFp5yNdtd8EAbBEQQe++Jp3KXaUiiHRQn3zYMj8 shOv7ZylFd/SrwhyVzBONoiHJDXzIrEMnI9h5txB0b5zzh1wx1mv4LO+JDI0AomhyXvn Y7cZZ+QKmxCg3sLtQsU+rx/Xc8w694DUVI5240L+f1ytnwPyNdKKFunKVw0yLk+UjCd4 pXqw== X-Gm-Message-State: APjAAAXzkbr3w6QzlUW/6wpvhYfMAC+E/8T3doUqLsoy7wbgiQ04ApWF mamHR2IDfY7BEAkX5KFlvt2fpA== 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 Cc: james.morse@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.21.0 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: 179367 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp10573136ilf; Wed, 13 Nov 2019 21:14:52 -0800 (PST) X-Google-Smtp-Source: APXvYqx95iHWI+wFAwU8R3zCJxylY3dpel+skX5Mg0Cz969R73TgmB1T+a2E9IDCBt8fEBx+K5pg X-Received: by 2002:a17:906:386:: with SMTP id b6mr6455956eja.148.1573708492172; Wed, 13 Nov 2019 21:14:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573708492; cv=none; d=google.com; s=arc-20160816; b=auhK0GNwoWU58F9ADlh1Edbd/dTZnBT/UktAIhE9AZLiA2F2xMlLCRLY6p2vgW3ifH 2/hOKzD4tlzwPa/VWiOBSRqk3WQpq5lbxvjavjANRahKK2T9UUd/IroDgQM+CKC6yJIE BZb/vBbrqc17WynAlsunj6GNxTM/ILiUDRZgKKaT8pvg+4J8lf8XqMxxc4ncN8frhYQL tO1MswLtwVE2zM5zlAXbKCQIo8Y/p5zu1VYNNkqQMt6/jrRGZKzgBD+OKOwln5UUwmkL r47iZnwMI385hBbophgEjs82qWlK8oksEmJIuUw7NXySdsPmLz0m3pWxTlpSDw3TSsKP mctg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ew9UIe0gxCMPozp8V2Gx3IW4RheVAJmULxjEy8TwDyE=; b=RS0tR0TGRGt7loxoXYh3XGZTAPNH+TOpPzk9ys2gO20R+rV/5eaLQxCmPBBscSH/p8 mOnyjSzsfeemZXFyxWygGKcCpwDpl7VmGLayWWzNH0bYD7daAgMpo/SPz8tXGqBD63hW jqUwxwEb+8vxzxwNvrhOo+xJrqSe+7sigZcmWgu52H/q5594b9zgBxI/B9X2+glExnne 7wy/pY30OMEKsywOKEwYDv87c8bePNOgZm8O8LXpnAYOkvLBYdP8LmsJ5fdM4gRWLYIy ii5dYGMnueSZV+KqvAY0tCzHeEB7HCqGZ+ybUjwyEBMpofUgo+EJ+KRbINkXg/u8Pa+J 4Zmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tLqR9tyQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si3127621edl.273.2019.11.13.21.14.51; Wed, 13 Nov 2019 21:14:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tLqR9tyQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727409AbfKNFOt (ORCPT + 26 others); Thu, 14 Nov 2019 00:14:49 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46408 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727378AbfKNFOs (ORCPT ); Thu, 14 Nov 2019 00:14:48 -0500 Received: by mail-pf1-f194.google.com with SMTP id 193so3296217pfc.13 for ; Wed, 13 Nov 2019 21:14:47 -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=l4Y9QbLu+W8eCindkfTPmpC5+2sPA0OEZF9gBH/uDSpG0AmDa7CPT0LIqoVX2J/ZLY 5Jy9qZv51J2xPG1lYxTaBRHpKjcztkLRUYs8XHeAxm38b1tumfdj6XCpOeafnkqHxvys ii5yimG2a1dCYSzWYOCyq+tj1TjoGNx82d5XKoudF+DmFUAMOYXuRicVhoPutGpzNz13 AktuUZ2+fWc0JIH9LR+2tNXiWCqMLumyc1vdO6fDHHDyJqnf6zEtX7HW1/XqCEhaLjUp MClkezgqVZsGU5S59iAhKC2wurIW9cQJiyBW0w201vf4vkU+MGsUNaKnpEktwXecX3/u Ia6Q== X-Gm-Message-State: APjAAAVfolnb7Ckm1e/nLsiD5B4XIBs3nl0gAra74IzqhWgmhhHa41Za jVfiBNRmnMowMfu2C2xpA8EfnA== 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 Cc: james.morse@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) -- 2.21.0 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;