From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mCiu6-0002Pg-Pp for mharc-grub-devel@gnu.org; Sun, 08 Aug 2021 09:31:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCiu2-0002OM-14 for grub-devel@gnu.org; Sun, 08 Aug 2021 09:31:46 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:42769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCiu0-0002Wn-92 for grub-devel@gnu.org; Sun, 08 Aug 2021 09:31:45 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 50DCE5C00D9; Sun, 8 Aug 2021 09:31:43 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 08 Aug 2021 09:31:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=9vMhq7x7Lr78gpPfVnJhU8EWdnc 4kICNvcEZN9MZsXE=; b=BOCI7mJCLQCNE0zOET/xJxVd7OSu1ejq2GK60ljzIT8 6a5ysLK7aO+oysAySVdEQN7LPGoesysw1pPopfjwTO3Vx77R5KwyfZNPhdP0YHCF fVJr/0V5LJ7+L1QPHxwXjXwN0F0RFmz/T6tEFgDWaInD7A9t42yfpeIAzk42MBym RfYGE8tRrJzbZr+AkQThFsMfWG2UWb6N0dwfeANiegexECtNHZO1QgU2h0XCLa1T rsWzA0BuK4LAxJ+c4YUM2S/UBuneelwNSa99XebTPra13VZk1ZKIW8fEsaXE6qng 8aPf6Tk4Y0rHyno/yt481nkEhv/1NtPLALc8KuEHBhw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=9vMhq7 x7Lr78gpPfVnJhU8EWdnc4kICNvcEZN9MZsXE=; b=rHWdaLWxSNOq5c2u23d2Oo +N3dJZbOCekevdb0CYidOIk10tk1AFNufjUFWEHZnMX7pFz1GZK5BgyuPuIq7+2D 1w/TIAf8D2iyZmxhC0Lv21x09q5AcRDRnSPjvFytUnrDZorgvaRXrAgxeFI4YhEk h1b3nSTGePeUOQeHDrot3zO86bzye9dIaUtVuqknLyDV+J6eUscGo5f8Alj149ZB TDjykV9yzvWK8Qg07fRbjAhAzyOCj8BxjFYvf+5/tO7J3Bz1a7lEPLetx4/Ybin7 5wfBtTNoe8WhIPRBuL75VZEDYNcV0Y4rTjspYtt8Lr/Qe61wXSj0Bell0Zc2Tz3Q == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrjeehgdeihecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhrihgt khcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnh epheeghfdtfeeuffehkefgffduleffjedthfdvjeektdfhhedvlefgtefgvdettdfhnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkh hsrdhimh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 8 Aug 2021 09:31:41 -0400 (EDT) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id e20d1dc7 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 8 Aug 2021 13:31:38 +0000 (UTC) Date: Sun, 8 Aug 2021 15:31:37 +0200 From: Patrick Steinhardt To: grub-devel@gnu.org Cc: Leif Lindholm , Daniel Kiper , Stefan Berger Subject: [PATCH v2 0/4] Runtime allocation of memory regions Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0J2GMRUsFyCWpDkZ" Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=66.111.4.29; envelope-from=ps@pks.im; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 13:31:46 -0000 --0J2GMRUsFyCWpDkZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, this is version two of the patch series which implements allocation of new memory regions at runtime for EFI-based systems. The goal is to be able to allocate big chunks of memory, which is currently not possible given that GRUB only allocates a fixed amount of bytes. This version has been rebased on top of the current master. The only change compared to v1 is a the patch 3/4, which changes the signature of `add_memory_regions ()` to pass up any errors instead of raising a fatal error. I've tested this change with my Argon2 support for LUKS2. Due to Argon2 being memory hard, it requires us to allocate a consecutive 1GB chunk in which the resulting key will be computed. Patrick Patrick Steinhardt (4): mm: Allow dynamically requesting additional memory regions efi: mm: Extract function to add memory regions efi: mm: Pass up errors from `add_memory_regions ()` efi: mm: Implement runtime addition of pages grub-core/kern/efi/mm.c | 83 +++++++++++++++++++---------------------- grub-core/kern/mm.c | 11 +++++- include/grub/mm.h | 13 +++++++ 3 files changed, 61 insertions(+), 46 deletions(-) Range-diff against v1: 1: ba8127734 =3D 1: cf709a8a1 mm: Allow dynamically requesting additional= memory regions 2: b18710852 =3D 2: 2a9ccee9e efi: mm: Extract function to add memory reg= ions -: --------- > 3: ff7e5be9f efi: mm: Pass up errors from `add_memory_regi= ons ()` 3: f29c60962 ! 4: a27f5b047 efi: mm: Implement runtime addition of pages @@ Commit message Signed-off-by: Patrick Steinhardt =20 ## grub-core/kern/efi/mm.c ## -@@ grub-core/kern/efi/mm.c: static void +@@ grub-core/kern/efi/mm.c: static grub_err_t add_memory_regions (grub_efi_memory_descriptor_t *memory_map, grub_efi_uintn_t desc_size, grub_efi_memory_descriptor_t *memory_map_end, @@ grub-core/kern/efi/mm.c: print_memory_map (grub_efi_memory_descripto= r_t *memory_ grub_efi_memory_descriptor_t *memory_map_end; @@ grub-core/kern/efi/mm.c: grub_efi_mm_add_regions (grub_efi_uint64_t= required_bytes) /* Allocate memory regions for GRUB's memory management. */ - add_memory_regions (filtered_memory_map, desc_size, - filtered_memory_map_end, -- BYTES_TO_PAGES (required_bytes)); -+ BYTES_TO_PAGES (required_bytes), -+ flags & GRUB_MM_REGION_CONSECUTIVE); + err =3D add_memory_regions (filtered_memory_map, desc_size, + filtered_memory_map_end, +- BYTES_TO_PAGES (required_bytes)); ++ BYTES_TO_PAGES (required_bytes), ++ flags & GRUB_MM_REGION_CONSECUTIVE); + if (err !=3D GRUB_ERR_NONE) + return err; =20 - #if 0 - /* For debug. */ @@ grub-core/kern/efi/mm.c: grub_efi_mm_add_regions (grub_efi_uint64_t= required_bytes) void grub_efi_mm_init (void) --=20 2.32.0 --0J2GMRUsFyCWpDkZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAmEP3LgACgkQVbJhu7ck PpRoUg/+Ny9Qf44PNTRUoowB+FP/HJpmwQosWduRK26YRRLq3ATyNo9P7eTTRJJy 7YYDOEqyM0fN3O25BvVk/ZjTzwDAnDt6R7p184Nu1QVO+G8igefleHkkb40mwHwr XA3uRdOh7H4Oa4hRiwfRy1P35VY4C7fO4y4WIxiA3zWB50EVQ82gXmiZTKh3zazT rCVfvlDVBJHdPSFbXAUyQZhVlsQINmH3brfB++/BIJGiSYMZcBKBWnN2wThL8gWg OEKmsyiIQGOGTQkRKsGX1LAV/dlZPWZqWY1yTDYJIyNZZpkHUf9zrMKEKiBdfSnh t/57+xtmoPa9NNTzDcdKPWETGRYEEa5vM5XRwvdRU8Oc10o4+vjeiOvyw317QhCY 276bwbFNKetiKFEhLBy3iAvGH7RrVjPyaTmJUmIvZBdpEp4RbRq4Wm8LsG+EYcmd im5uxwD9Cpy3FbLaUw/nuzJjCTy01RwHR2Alfjd05xni9X+zcldAxWR4HkQROwBQ j3XmaKABpl+KTPidwGDHCoTzXKeFeVKii7uZsVMUtnBjZPF1UB5B211OG9PURNvG LLUxbvV4xHeUwH1Slb6XDuMmu5fDlth/eNCtuZYMSawdROqf91YZ7EXd8cUsww6i Y+S3gBfrNp2DQV2G5yxzNHBGrXYBhgzIuRqPW6WvX/RM3LD0UvA= =ia2z -----END PGP SIGNATURE----- --0J2GMRUsFyCWpDkZ--