Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp76985ybb; Thu, 19 Mar 2020 16:58:59 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvi7ifYqxjDQfm3I9cqVR1+Pin0sDUybQaCAqz8CoaDj62bjzZUGPVlLL9yqeDLdDVfgcLN X-Received: by 2002:a05:6830:1d7:: with SMTP id r23mr4423715ota.181.1584662339547; Thu, 19 Mar 2020 16:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584662339; cv=none; d=google.com; s=arc-20160816; b=WQ1GPygPXUOX0WptdA9L/jffWxPHLIHJZDRzZqcAvmbKNUDIuMUwZsEybYe18BzdqE haPXzccMLnfa71l1RtQWe5S2Je/ORkQfBpQUmjy0a8DXlFhgulGktuppazhlzVP4IkfR ZLPxVThqa6DjWKPFc6P17yFfAu9/rgxxE38lH02XAf7BS1KiappaHQ2ccMazCcM6C2Sl G4PyD/UYE6qdo/2zw+w2f+dY8lzzAPDEGvyS7Az3WQ3e4/1x5pGcAkKZpY1sypZgkNMF 4vOvsKhKOf+4LHsxwE/XrbipNdDgueOn9JrSUxyiHiGAHeVrWmctJotBWSUrdbcrGyO8 e5Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature:dkim-filter; bh=7Ov2izSIpJrQkE36Te6iGCXuLs/J08C26N9tQn+FpSg=; b=uKlLwQhHF8Rt0A8u4kbSScmS6n1BYZ5Ml7UZ+ZRcbwVxKAdch6M5pM7wZmQSGngoPZ SrZCorKhB2xDTsEeFEMgjsc5mDbCh9nP/CDLiG9ipB6OqYxhcBLBeQLJZL0kbc1D5IMA ysXquUT449VIOsgEKSNJnqA6n1YFeC4zD0OlXCYaMTTERoPnpSXNj2QRKDOrwQ2yfBrM vbe05kAASiPQ1Z8xKMhNR9QQnC3BMxDoJd5dvqjmxhlxXlzeYVX/FOhM6KnMAM8wK8L9 sV2/A/MHPpazqbuJt/cdR/NhcFN+aGcFhg97uJB9oDPjZMeuHOhAzZvTpOB8ty+53Ac2 Igjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@zytor.com header.s=2020022001 header.b=N0GwUHxM; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11si1737660oib.32.2020.03.19.16.58.46; Thu, 19 Mar 2020 16:58:59 -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=fail header.i=@zytor.com header.s=2020022001 header.b=N0GwUHxM; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727228AbgCSX5z (ORCPT + 99 others); Thu, 19 Mar 2020 19:57:55 -0400 Received: from terminus.zytor.com ([198.137.202.136]:48693 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726827AbgCSX5z (ORCPT ); Thu, 19 Mar 2020 19:57:55 -0400 Received: from [IPv6:2601:646:8600:3281:9577:eff3:b2f7:e372] ([IPv6:2601:646:8600:3281:9577:eff3:b2f7:e372]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id 02JNvYSk1240058 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Thu, 19 Mar 2020 16:57:36 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 02JNvYSk1240058 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2020022001; t=1584662256; bh=7Ov2izSIpJrQkE36Te6iGCXuLs/J08C26N9tQn+FpSg=; h=Date:In-Reply-To:References:Subject:To:CC:From:From; b=N0GwUHxM77X1qx243jlFS2ZbJfmcNYSjowkur8m+o7Lt2pl3qhI4XH2gJyf00vdOY 6lggxlq/U/+3F1SxrlyAwazEFyexf00QOJq2QowDv0iSrxyZyTQPvSG7fRWP1HlueT XiC7sOwIpw/nV6OwXrGfRVUx+pvywjk6bFftQW31ZTG4DMGTn2n2WYiH+no5yhv2rE F0I3IRKlcJDOOmnCKKNx/SdyPvJaMKZ0ejVno4VqOuLs1SV4sqxLfejUkldkJlGkvw LHA+STAhZSo7wBipOnLh7jNutXK6Q+UTiRlgWhCrCP1IswK6zxpvktgdBbDH/6HW+q xe5ev1ASYGFBw== Date: Thu, 19 Mar 2020 16:57:27 -0700 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 1/1] x86 support for the initrd= command line option To: ron minnich CC: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE..." , mjg59@google.com, lkml - Kernel Mailing List From: hpa@zytor.com Message-ID: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On March 19, 2020 4:49:05 PM PDT, ron minnich wrote: >In LinuxBoot systems, a kernel and initramfs are loaded into FLASH >to replace proprietary firmware/BIOS code=2E Space being at a premium >on some systems, the kernel and initramfs must be place in whatever >open corners of the FLASH exist=2E These corners are not always >easily used=2E > >For example, on Intel-based UEFI systems, the Management Engine >(ME) is given half the FLASH, though it uses very little, as little >as 1=2E25MiB=2E Not only is 2=2E75MiB of an 8MiB part unused; but >10=2E75MiB of a 16MiB part is unused=2E This space can be recovered by >a number of tools, e=2Eg=2E utk and its tighten_me command, and if >Linux can be told where the space is Linux can load an initrd from >it=2E > >In an ideal case, we would take the space from the ME and add it to >a FLASH-based filesystem=2E While UEFI does have filesystem-like >structures, this recovered space can only be added to its "file >system" by rebuilding UEFI from source or writing a UEFI device >driver=2E Both these options are impractical in most cases=2E The space >can only be referenced as a physical address=2E > >There is code in the core that allows specification of the initrd >as a physical address and size, but it is not supported on all >architectures=2E This patch adds support for initrd=3D to the x86=2E > >For debugging and recovery purposes, if initrd=3D is present in the >command line, other existing initrd sources should still have >higher priority=2E The initramfs in flash might be damaged or >broken=2E Hence, it must still be possible to load a kernel and >initramfs with a conventional bootloader, or even load the >FLASH-based kernel with a different initramfs; or boot a >kernel and let it use the initrd in FLASH=2E > >In support of that priority ordering, this patch sets the ramdisk >image pointer to phys_initrd_start only if it is not already set; >and sets ramdisk_size to phys_initrd_size only if it is not already >set=2E > >It has been tested extensively in LinuxBoot environments=2E > >Signed-off-by: Ronald G=2E Minnich >--- > arch/x86/kernel/setup=2Ec | 6 ++++++ > 1 file changed, 6 insertions(+) > >diff --git a/arch/x86/kernel/setup=2Ec b/arch/x86/kernel/setup=2Ec >index a74262c71484=2E=2E1b04ef8ea12d 100644 >--- a/arch/x86/kernel/setup=2Ec >+++ b/arch/x86/kernel/setup=2Ec >@@ -237,6 +237,9 @@ static u64 __init get_ramdisk_image(void) > > ramdisk_image |=3D (u64)boot_params=2Eext_ramdisk_image << 32; > >+ if (ramdisk_image =3D=3D 0) { >+ ramdisk_image =3D phys_initrd_start; >+ } > return ramdisk_image; > } > static u64 __init get_ramdisk_size(void) >@@ -245,6 +248,9 @@ static u64 __init get_ramdisk_size(void) > > ramdisk_size |=3D (u64)boot_params=2Eext_ramdisk_size << 32; > >+ if (ramdisk_size =3D=3D 0) { >+ ramdisk_size =3D phys_initrd_size; >+ } > return ramdisk_size; > } The initrd=3D option is reserved namespace for the bootloader=2E It is als= o worth noting that the x86 boot protocol now allows the bootloader to poin= t to arbitrary chunks of memory for the initrd=2E --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E