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: 173655 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp1695470ilq; Wed, 11 Sep 2019 22:59:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxi245mE8Z2TQlG3ML7mLSgX8hGNqkOyJsBCewtV3O7NquwDatVBcE6BkKfCEi1SBDD4WH3 X-Received: by 2002:a05:6402:1447:: with SMTP id d7mr39952955edx.146.1568267986320; Wed, 11 Sep 2019 22:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568267986; cv=none; d=google.com; s=arc-20160816; b=mQT/d+Ppg0cqLHLmzIvr++iVV1SsLqcGEqH5EZNy0kvGLDVO9co3JLHbbJAH1D5gaK 7WCSW7HqXOtGhwKn/6OZ3VSaMoTRUNUL3eNq9qoHuNXOPofVCGX6KbP4QzoJDuK3wzrn YsqhERaJVgMyuEGds2+8bqsTMnXhus85rOQn7DC5B0YVUbWkJPG+YDc2Ip2BgqXMtRCx EU2LDiT1jm1DkRKWLyBLwVZgH37JcValeyjrFzIOM/gpkj4IfnHUaJMU2solILK3exAg jDJKLLwk3+Z0gsMPud2p3SRBLfNgFA18H5udYASw/dm5uc+c89ELGbZj8G3OQDmel2S4 FXQQ== 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=hwye5rZeCSnIXAVVIFhx3WzuEtIgJnJcnfATuN1qrCzxQ1RQjrUqGM7c1Ag95I5jtS mnUzYU/aSHwGGRuJlx73rt0FWqvLw23qbMgWW2rXpfnP1ytnWLrak82S1tiZ2uo1UJDV GlKvEG2pYCeEHekFlGk+FHy6gPeFAiEhe/doGKCWjRjJGAj0CyA2jjc4fwfBClkOZkXr gachu8n4lneFTRlY/ALSo4J6WDTbq8lPKd6W/R/6ohr7A7RvrgyC2PbohSlm9qfEb/M+ PMPF5jhH2bVV8r5ScQ3wjOvPuRZ92+iPEpilYsknEm8LAR0GEoas4VR/h0La0X/B3WcX K4tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a1izBfJN; 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 d4si5858231ejk.327.2019.09.11.22.59.46; Wed, 11 Sep 2019 22:59:46 -0700 (PDT) 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=a1izBfJN; 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 S1728947AbfILF7l (ORCPT + 27 others); Thu, 12 Sep 2019 01:59:41 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40547 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfILF7k (ORCPT ); Thu, 12 Sep 2019 01:59:40 -0400 Received: by mail-pf1-f193.google.com with SMTP id x127so15237990pfb.7 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=lTjpc3DHGlyi5kNA/IK9iDRuz42Gc99QAiRSfz0/+g2ZrlsZ+ShPs4Fu4WIF83gxNT MCwyl1GP1lHWVeBHHYuhrqzTjdbT5qWUG0iBhgNJQa14ISEX8pwCckKB6nJXzsFSDSme MVIsFp8Y3xG9TsYAACsUYNnjnjKvLctAGBX5bM1I2dma8zAUQW3voXmThKVYNMjt0fF4 8lD/pLOvuxTN2aV+WZ8mhYXTZeGPHxh5jQ78lYhQjQ58EW7zn8Rsw6RMkJ/qfu80KhSs IRonuzKI44cDluSafl49/aM3Wz8PEKjfpolRaYfP2DWu240XJyVgBvHQ7trGxUJ8rU0e 9fOQ== X-Gm-Message-State: APjAAAUB58vDX37LqWCWLBUzLp7QQ22y2T0tIjnq0kSKRE3ODTnwh3v3 VslVYWnaZVJpgS0CIyvwVcJ6RmuVOaw= 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 Cc: james.morse@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro 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 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 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: 173656 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp1695478ilq; Wed, 11 Sep 2019 22:59:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxx6hKafNsKGof/4QoJZGbVRpD9lTnUNO49Upd4k+8udnWp3NkLCyasrGIg80NMl7o/yNkP X-Received: by 2002:a17:906:134e:: with SMTP id x14mr32982509ejb.280.1568267986842; Wed, 11 Sep 2019 22:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568267986; cv=none; d=google.com; s=arc-20160816; b=mLXa9JJLqWmI8HQDzDmmGF5MRwTfCI4YDNZDqHknWJx1M2Afn6EIPeB6KjCadTXxSk +EPbC4U9fheJsbROEYgixOEGVhD08KVSgo96iSB0YjfaB6dIhAjVkee7C0R9oKuUX3kH ufMt2hzfncz6V4O1Mt0HVSp23Amq3U02aV2NafsMhJrHQlPsr9GJWRIaO56ODKCAKF8p Dc9SGsq439nZKb0QE3I62VO1R3vWhUOYRgRh04swbgzEOGCcLFLJbtGomMKSB6JspB+Y kQIA1z1WzCEl7sFMSVDrsaw6elfWgN2BaTHYnBqMxRfQpuwagNEqUpX616yoeJ22n6o5 C8eA== 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=9duNwvJ16wl6i9JK0JxmwLCbqMy/YOSDsatt/Ugxhh0=; b=r2n5rj372zkWLWaHvuUNnBVMCP8gbdwSpv3kQGMthfJvFn1dSpVIfb1/NYqqA1r9XY KYTC1eEeinn5cNGHcf1m73DcWD5ZFYCduByc47Cdjz9324yEZJ6iedO9nbgpcRSAPMVL 5/MVWX4SwFVQdvCEARkSAdmAdoytyCZanxWx7eos8JXrBzVPGuK2wEVY6lIvVOQFl6FE HcX9v0dgOdmvNiCTFdM7wmgnzOHnS+bKOVoI3mbeO+wIeVwmB1n+1l8/erPrHmvC5iM/ Gg778iB3bMsrIvkGqjdIxm55RgSuHn1o8HRYOGeVM5zI07ZqMk9VthVNCE7cHtnU9con tLRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FRbBT6xd; 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 d4si5858231ejk.327.2019.09.11.22.59.46; Wed, 11 Sep 2019 22:59:46 -0700 (PDT) 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=FRbBT6xd; 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 S1729147AbfILF7p (ORCPT + 27 others); Thu, 12 Sep 2019 01:59:45 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46884 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfILF7o (ORCPT ); Thu, 12 Sep 2019 01:59:44 -0400 Received: by mail-pf1-f195.google.com with SMTP id q5so15230147pfg.13 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=FOP6XYVR06Je1+kIvdxBttZXFPLQzaP61UlQ/sx71boNJIbX+E/24G3sBxXlkidUot 2S3nu5A+hDu/+d7b3uPeOtdCgutnfIw4WJP1vL/czgeNkPYEKU6McQQ1Zrj6PBRI7M/C a/AKAUEgwf7FgOBNwKbx6ZwIrmCycm6QJRLEnst0dp+Y3ZqB/lzdEwKAn5VzLQFZle+r oOCnax6lX+5vW8XurFoWL2nZfipIfdsD4YZHLRVlWv2AkWs2tVNFSFyr9TNs7augHrfh npNqyu/3zSUlBTWSFGVjIugTzESZICtN3uuqJevrwb5QHhouftpXe1cELk/fhVHqzhHc 7WhQ== X-Gm-Message-State: APjAAAWtV/GGwvn9oTW6UgFBQtK+V9Nqc7WXDlq++YMh6yUA1ktbfK9K dqb6uaZY6nPZL7GqgE2nZCT7KA== 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 Cc: james.morse@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro 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 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 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: 173657 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp1695602ilq; Wed, 11 Sep 2019 22:59:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTM1s8d2qBCtvZ7oPpcY3Z7Q4a2qPCosf5xpmYbi0ziiLw3T4/oqRtSS/3pRNzBRqj31Xu X-Received: by 2002:aa7:c559:: with SMTP id s25mr4362685edr.198.1568267995676; Wed, 11 Sep 2019 22:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568267995; cv=none; d=google.com; s=arc-20160816; b=rt1Mi8oT/dLh7QBvHPZGxdA1/hBra3VrI898qJaUj1FnCnVnP4DEBhTnV32ROg5TNA fyvrpz/YAa4TQakld8QJOBq6D9S5LGRYZmNw4i6Ko6iBTFfOS7nDl0tPVOwVq+bmXhxf P18MYzpiOL31mpG7/yr6PNa1F1ZhuavHOFyueyRRuSD/3kdRPcdmaFk8x5vHAQMcmwOV bk92PZzkzewWpE0XQjk/rWedDgQD61lEzmClhYTKlUBWu6PlUg+wH1SkJys4adf7RzIA aNXSR4hymbW/fMsndsrrSGbroDCi+fIBbHBVH5Om19AqUv+hR4SL1jjrzHcQOPiuiTep 6j4Q== 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=FxFE8kRj/EbRgKoWP35uNVOjcf/RHJrS7TO4gPoF1aw=; b=oqVmLf8ObhtbBphz/+ZY61BGwtG1NvRWFc8CxIdPWez6SLeuegYQ0+PASmB2aTe3Gw To+0o4GgRJHvBQjwkvxK5h7L5MNgwa5337txtA47fwNf7hR0UCeRJXDzeK0JMRVZ+f/u h9phmPNvg3/Yqwsp/qjErdT/VRO+jQ51DvVQnR3CMgWF8q/Sgd6eE+N7pw5Hy02+6ZxG 35QxkWY9Veaj/2r92Ep/7bzAYF/RF/sPJjE4pCM+fHqjrX2azhAFs4P4Uc2V7EbGjV1O aSC2u8YGwWp+Ve3J4Z0U3KB/olqU2PHpQQlyZ1H2jw/XwQU0LZx+sNRtXZYosj14BRqa 71lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eBDesVj3; 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 e22si14131460eda.300.2019.09.11.22.59.55; Wed, 11 Sep 2019 22:59:55 -0700 (PDT) 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=eBDesVj3; 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 S1729240AbfILF7r (ORCPT + 27 others); Thu, 12 Sep 2019 01:59:47 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45187 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfILF7q (ORCPT ); Thu, 12 Sep 2019 01:59:46 -0400 Received: by mail-pf1-f193.google.com with SMTP id y72so15211109pfb.12 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=dmaoRwBf6JDv9BdWgq2cPM7kW2UeNjcsEpkuVWqxNn32ljLLE6nGjWG6081SCRzM8J MaOXmrL3r5qKl1RkijsQBeDSGhfbrTZR5JkJbPLvtn9JEy7c3PM2U1C3czsrdfOYzWm/ Qy35B0gmuIAoIJ07534/M0guVIQhKHoIOWrxY3C8ILf7ZeRqG15q3ndt8XtF3Wh2aVCG bTYGUDRoYBLSgvTgX3SoFF3SMAOZX9HmkoUH657985LIj7nSMUUCPwrABjR0Iwm9S1E+ rBN4jwUk0AODoZZA/Zyr+idy4LqpPfNTxk4zMHJMSgMWDzLl/dIgLP7CBISeZkB7o3OS xJ9w== X-Gm-Message-State: APjAAAVI8GDeWGRVcoLkpE2kgS8lf+VmiGbzQwwywlP8Kzk4Bt0x0yT/ ZAHMKE5P1kDFnjit4L6ckZkZcIPlneY= 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 Cc: james.morse@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro 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 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 | 105 ++++++++++++++++++++++++- 3 files changed, 106 insertions(+), 7 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 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;