Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1704602imm; Wed, 16 May 2018 01:38:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoYfWv6bUPuJnqioCvOyHktjJoVDLgJluJZeRI6cHLCf584FPHppR863vLjtDqAi4pQBODq X-Received: by 2002:a62:1a4e:: with SMTP id a75-v6mr18738818pfa.84.1526459913341; Wed, 16 May 2018 01:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526459913; cv=none; d=google.com; s=arc-20160816; b=Vo3VkgYmacyiiycKF88HIiW1xVNjGI8EKs30r/fT96OMLbkQ+1S1ovSTBxmsNszC4u qcqnowkglkISJsBj5vMc36+2QvrNsUVitEQr7GaV5O2/7Bkp8jw0UC/PdaFwj+klSUXu xY9dv9iuWQWWLlMeikhdbPvUnK8AJWsZuzS0ECUZHDnK2zZl1AGNItwoyhXo7aUwLfUL 9srG3cgTfcS/IvTm+Y9eoWGLbbr8HiXC6NCMIdIsNqu0WbKRfdA7Dx7/w4H621i8aL8D OefuxaT7YbzBrbDDYkTyhOCsEudTSTkG9op+dC2JSe9m28p3daKaNQIgEReI+fA9AJ14 tIRg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=vSLYhRoL9mw5Z19h7LcZQX3mswbsErN1m//ewuuSwLM=; b=NlQxQ6RipqcXz+Y9zN6wCIeiKQJ4xCoLqEfrDnVcIPMtkMmyoa/qiOIg3kUMPvApGI rFBt4dIQDGfz/l2zVGUYuPs7Otl7Dh5EDu3KXPQogajCRebvot//AUyfqjdCZpeVEbgB I9poQn/ShyTOei0T8FsH2LiGDlIm9Q7qR7CN+SM/nhUFSKRK6WQs4D2Tq4jUOaZiy0Vd YJzTHtvCqXfnt7MfDbxsZR0VieSkrs/OXsIuyuWFRqqzo3lxWsrJ5+PPS04O8WxUDE8I wtF85tSpfGghZgnZGBuP9wkRzWS0JXS62g0V5wVG8rsru3mGrm/dQNKcvU3wcPK5WmQl JdwA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v66-v6si2151900pfv.48.2018.05.16.01.38.19; Wed, 16 May 2018 01:38:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752619AbeEPIhu (ORCPT + 99 others); Wed, 16 May 2018 04:37:50 -0400 Received: from foss.arm.com ([217.140.101.70]:43902 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510AbeEPIhq (ORCPT ); Wed, 16 May 2018 04:37:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CF0A11529; Wed, 16 May 2018 01:37:45 -0700 (PDT) Received: from [10.1.207.55] (melchizedek.cambridge.arm.com [10.1.207.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B90D63F25D; Wed, 16 May 2018 01:37:42 -0700 (PDT) Subject: Re: [PATCH v9 07/11] arm64: kexec_file: add crash dump support From: James Morse To: AKASHI Takahiro Cc: catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, ard.biesheuvel@linaro.org, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20180425062629.29404-1-takahiro.akashi@linaro.org> <20180425062629.29404-8-takahiro.akashi@linaro.org> Message-ID: <3d70c7d1-4985-a427-ecc6-a7edc84edfff@arm.com> Date: Wed, 16 May 2018 09:34:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Akashi, On 15/05/18 18:11, James Morse wrote: > On 25/04/18 07:26, AKASHI Takahiro wrote: >> 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 repsectively a memory range >> to be used by crash dump kernel and the header's location >> diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c >> index 37c0a9dc2e47..ec674f4d267c 100644 >> --- a/arch/arm64/kernel/machine_kexec_file.c >> +++ b/arch/arm64/kernel/machine_kexec_file.c >> @@ -76,6 +81,78 @@ int arch_kexec_walk_mem(struct kexec_buf *kbuf, >> +static void fill_property(void *buf, u64 val64, int cells) >> +{ >> + u32 val32; >> + >> + if (cells == 1) { >> + val32 = cpu_to_fdt32((u32)val64); >> + memcpy(buf, &val32, sizeof(val32)); >> + } else { > >> + memset(buf, 0, cells * sizeof(u32) - sizeof(u64)); >> + buf += cells * sizeof(u32) - sizeof(u64); > > Is this trying to clear the 'top' cells and shuffle the pointer to point at the > 'bottom' 2? I'm pretty sure this isn't endian safe. It came to me at 2am: this only works on big-endian, which is exactly what you want as that is the DT format. > Do we really expect a system to have #address-cells > 2? Thanks, James