Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2145776pxu; Sun, 13 Dec 2020 15:28:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvWI97/toL5vsRB9IO8KQ7DKKCiiBzuIwgITuRD9mmq5MOSq+ip3WgXDaynqF6vzg/PyMV X-Received: by 2002:a17:906:229a:: with SMTP id p26mr13550176eja.291.1607902119870; Sun, 13 Dec 2020 15:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607902119; cv=none; d=google.com; s=arc-20160816; b=Zou3ve1AFkpaCDvai3rMhscUOQn7e9T+NVvklwv94UuLjABCuyI8vEzroMPYDAZi8O QWmXfhl/fdeMtJEZTpB81VSmzPdwavgNukp8pu+J10HuD++eTiM+Jc6BSiH7J5B+4Vz1 r0jqMvSVQ6vUnQkAU8zPI7ExmQjATAt1p3BWXFtF7tsyTGFwalI/J28c2uOMIYXyMrEn uTK4Rmbb04Jh17lrMz3k3T/i6/xccSKCnB3iOlDACsRXLEs6rNKXBMo/KdOG8vrPVtry RvVYv9rgK0g5tQKXu86rEB3z/1FfOu6WkEmVQM1tw8mztpQW2po6jAo+QEmZJ8rG8tKA 5yHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-filter; bh=V31bOChnr8lat3WNyoEvadwinYKZ3Pm3p29JNFXDyvc=; b=EThDJWdrVG/+CfxTAvdqV1fcCTAlkU5mL+kYJ5fs4dh4prd8DbEhdFc6URbcnSN1jf SN+Wn+okXDcba3QXy2MSKNVWiytCctfLKoceeI7CFlvUVvygjU4OY7njOnolrZKtU8Dz PzD0ouU+jTKGiYBqGOQKvi4WiWB91Knz/FKPM/BX1XBKjCOtOmJ+KU9AZCmj9cELKjQw u5fneXkyZ4Xubb5esLMkbnzJF7tr9JR+uIHoIvTOyV8E///7MGMrNNLT+pOL4beNVMjQ C78AAY1CyRT7YGEyTSDq0NBVafXBe6KJ4oYC8vNCz1NQcUOMkCOJZ5Z2kkTMi1SKBteM w+mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=m5okTUXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si2309320edz.579.2020.12.13.15.28.17; Sun, 13 Dec 2020 15:28:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=m5okTUXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731788AbgLLFra (ORCPT + 99 others); Sat, 12 Dec 2020 00:47:30 -0500 Received: from linux.microsoft.com ([13.77.154.182]:41340 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731406AbgLLFrK (ORCPT ); Sat, 12 Dec 2020 00:47:10 -0500 Received: from [192.168.0.104] (c-73-42-176-67.hsd1.wa.comcast.net [73.42.176.67]) by linux.microsoft.com (Postfix) with ESMTPSA id 195E420B717A; Fri, 11 Dec 2020 21:46:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 195E420B717A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1607751988; bh=V31bOChnr8lat3WNyoEvadwinYKZ3Pm3p29JNFXDyvc=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=m5okTUXaQpr9BxPcQD+AKL1HBqahIUQGwQy5M0QXxtaObm3u3cP5aGmBF8SCtyZD8 bhl8wETUf6c/N0ncRmptKshSMM9lvyRPf4QzEyml8m4gB/CXc0Op/ss2tR6CZyTbJs X2wjf4djHP4LKy9fbUokPuvcVqOMy4Nho/T8tqMk= Subject: Re: [RFC PATCH 2/4] of: Add a common kexec FDT setup function To: Thiago Jung Bauermann Cc: Rob Herring , takahiro.akashi@linaro.org, will@kernel.org, catalin.marinas@arm.com, mpe@ellerman.id.au, zohar@linux.ibm.com, james.morse@arm.com, sashal@kernel.org, benh@kernel.crashing.org, paulus@samba.org, frowand.list@gmail.com, vincenzo.frascino@arm.com, mark.rutland@arm.com, dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com, pasha.tatashin@soleen.com, allison@lohutok.net, masahiroy@kernel.org, bhsharma@redhat.com, mbrugger@suse.com, hsinyi@chromium.org, tao.li@vivo.com, christophe.leroy@c-s.fr, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, prsriva@linux.microsoft.com, balajib@linux.microsoft.com References: <20201211221006.1052453-1-robh@kernel.org> <20201211221006.1052453-3-robh@kernel.org> <6934c005-d848-314d-cfee-23f2273c119d@linux.microsoft.com> <87360bahup.fsf@manicouagan.localdomain> From: Lakshmi Ramasubramanian Message-ID: <49579baf-6159-0eac-fa36-6fdb618c2320@linux.microsoft.com> Date: Fri, 11 Dec 2020 21:46:27 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87360bahup.fsf@manicouagan.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/11/20 6:17 PM, Thiago Jung Bauermann wrote: > > Lakshmi Ramasubramanian writes: > >> On 12/11/20 2:10 PM, Rob Herring wrote: >> >> Hi Rob, >> >>> Both arm64 and powerpc do essentially the same FDT /chosen setup for >>> kexec. We can simply combine everything each arch does. The differences >>> are either omissions that arm64 should have or additional properties >>> that will be ignored. >>> The differences relative to the arm64 version: >>> - If /chosen doesn't exist, it will be created (should never happen). >>> - Any old dtb and initrd reserved memory will be released. >>> - The new initrd and elfcorehdr are marked reserved. >>> - "linux,booted-from-kexec" is set. >>> The differences relative to the powerpc version: >>> - "kaslr-seed" and "rng-seed" may be set. >>> - "linux,elfcorehdr" is set. >>> - Any existing "linux,usable-memory-range" is removed. >>> Signed-off-by: Rob Herring >>> --- >>> This could be taken a step further and do the allocation of the new >>> FDT. The difference is arm64 uses vmalloc and powerpc uses kmalloc. The >>> arm64 version also retries with a bigger allocation. That seems >>> unnecessary. >>> --- >>> drivers/of/Makefile | 1 + >>> drivers/of/kexec.c | 228 ++++++++++++++++++++++++++++++++++++++++++++ >>> include/linux/of.h | 5 + >>> 3 files changed, 234 insertions(+) >>> create mode 100644 drivers/of/kexec.c >>> diff --git a/drivers/of/Makefile b/drivers/of/Makefile >>> index 6e1e5212f058..8ce11955afde 100644 >>> --- a/drivers/of/Makefile >>> +++ b/drivers/of/Makefile >>> @@ -13,5 +13,6 @@ obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o >>> obj-$(CONFIG_OF_RESOLVE) += resolver.o >>> obj-$(CONFIG_OF_OVERLAY) += overlay.o >>> obj-$(CONFIG_OF_NUMA) += of_numa.o >>> +obj-$(CONFIG_KEXEC_FILE) += kexec.o >> >> For the functions moved from powerpc & arm64 to "drivers/of/kexec.c" in this >> patch, compiling kexec.c when CONFIG_KEXEC_FILE is enabled is fine. But when >> more functions (such as remove_ima_buffer()) are moved to this file, Makefile >> needs to be updated for other ima kexec related CONFIGs. > > IMA kexec is only available if CONFIG_KEXEC_FILE is enabled, so I don't > understand what problem you are seeing. > delete_fdt_mem_rsv() and setup_fdt() functions are defined when CONFIG_KEXEC_FILE is enabled. So there is no problem with this patch as such. I was thinking when other arch independent functions such as do_get_kexec_buffer() and remove_ima_buffer() are moved to "drivers/of/kexec.c", they need to be defined only when CONFIG_HAVE_IMA_KEXEC is enabled. If CONFIG_HAVE_IMA_KEXEC is enabled, CONFIG_KEXEC_FILE is also enabled. So there shouldn't be a problem moving those functions to "drivers/of/kexec.c". You are right Thiago. Thanks. -lakshmi