Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5082829rwr; Mon, 8 May 2023 18:05:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fARUcfvDeDPMh8cJ8xpw/hif0PppWA6k3wIglNN9z38uwyjPD4C9rvw/NwqCHey3aC4/H X-Received: by 2002:a17:902:bf4a:b0:1a1:a800:96a7 with SMTP id u10-20020a170902bf4a00b001a1a80096a7mr11995613pls.8.1683594304855; Mon, 08 May 2023 18:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683594304; cv=none; d=google.com; s=arc-20160816; b=b1pcPm5fasf3YWnsN7ffB2+IPwOL/zcMNMOIYrWmKfvUJQibRU8RJKfvpFs98UdQK1 ancGzbRHYjE1Hx3BfJjEotbQEZVZsakiAyuRdaopbL84zAz75bOKk1SZG+VTx7xuoQbz zoqcrdzXnscOfDXUxa98NRR2kc2cwHXfV59mJZpjXiYlIzaSbwYS0vpETMG6FOu0M8Sx bOZova+ZpWtgKjpnj0Jfd6N/kqlFDzK2Hc16KsFg7rQ3JhnPDUFVU3V9Ih9ACKQHzZcP 0vBnCpSS/73/Ocg/i3Rzv/RtJx60ZKLEfSobLjTRSmXnKGBFioCYtDQ7yGMrkTrL1HSV BWuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=R0MvdCJrAGQ3Lx601BQioOuJmlf2hwwfSdhcLcNWO5Q=; b=ANA9syZCjfMWiFtR9GfZK8SmrzPASwYhoHn9cYEmQg4ExdLU6l3TRuui/YAQIIzJHL XECsE9G063TcLaBdU5LnJgB1VxrxPEUMPY2kZgYToVjEGTnUgprX9tW5l03Hq2K8G5Dn il4GOoDUqTkK3QzO0WH+Rro6RMJ4H+w7/DjDAVrOt3UqnnWtu4HYJZq9oliI1tjRl0ZE vO8B764L7iga9TMbHHzJOrJTbNEkJC26FzfHkRRcMbAcgoWpasBaAqw+uglpX5oe0dz5 M9OgcfftN5U8uTXoy7p0xMHQNr3UlnFa5ImZgI5gEAjxQucTremh8drWcAHGGqyKy8dQ MKGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=sEeEvU6y; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="g/w0UhmN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a170902d2ca00b001a6fce1d951si250147plc.377.2023.05.08.18.04.49; Mon, 08 May 2023 18:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=sEeEvU6y; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="g/w0UhmN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230101AbjEIA4q (ORCPT + 99 others); Mon, 8 May 2023 20:56:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjEIA4o (ORCPT ); Mon, 8 May 2023 20:56:44 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 032673A84; Mon, 8 May 2023 17:56:42 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B99285C01AA; Mon, 8 May 2023 20:56:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 08 May 2023 20:56:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1683593799; x= 1683680199; bh=R0MvdCJrAGQ3Lx601BQioOuJmlf2hwwfSdhcLcNWO5Q=; b=s EeEvU6yL9KcddveYTaG4jW49jAptZTFLlcgGM7rB5S79PZlLO/WT5o7kriEpPZzd jNxN9wQGt4jmdJV68b/Q05Oo2SOo3FR7UPK1aDOvrKntXqbxZK0lDqMESF3/usWx jOUFx5Po71d1NncnScZ4Ej9IICFrbIHIS1kDZfGs3NfC+fBLjFMr7MTyZJfaUzUg rnoA0HdA4znpZ+OCutRFCblzmWw+mMAWUe48qpFsypD4RpJiMUork6hZCnipfdiY 3Ekv9ZBusPtuovilI2BjnmY/Baer0aA815jHxR6WMaKoK/dYNOmUk1L0phbivXQF rxxhh+qu3aEvvQrEPRt2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1683593799; x=1683680199; bh=R0MvdCJrAGQ3L x601BQioOuJmlf2hwwfSdhcLcNWO5Q=; b=g/w0UhmNd2dweHlXYwAIHgEQlefGr Cxa7kh+pkPfbpoHlavNypmWkCIYcGm84Zvr97hAOp/QvhNf4TS1h9I20ljSYthI2 9kzfxxrukjzZ3KbI31uDt4vsKyx7mI54LJP8ckq8DdyMNOMWMU56J11oBW4pjngs jgMvtWW1XVu4UE3u0WjzcLV/28ZVopNibtVTcJLzHdrCw3EZ1A0eczDyuKK9ooAK AJ1WxInDWqZKq0fV9vjzdmUWsRGoQK9L2wtTjxzDxJT+stcLSGx//Vj+r86znjZW hox7ObZSqiMDnSoiRD2//yLDTKf9gDvbRS0+WasRF/ol3RbI6vPaSpn/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeefledgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdttddttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpeeulefgteeukeeihfffveeukefhudehvdegvdeh lefhvdduffegheegffeifeelveenucffohhmrghinhepthhhihhnghhsrdhhmhenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehkihhrihhllhes shhhuhhtvghmohhvrdhnrghmvg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 May 2023 20:56:37 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id 5E0AE10C40B; Tue, 9 May 2023 03:56:34 +0300 (+03) Date: Tue, 9 May 2023 03:56:34 +0300 From: "Kirill A. Shutemov" To: Ard Biesheuvel Cc: "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Dave Hansen , Sean Christopherson , Andrew Morton , Joerg Roedel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Dario Faggioli , Mike Rapoport , David Hildenbrand , Mel Gorman , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, aarcange@redhat.com, peterx@redhat.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv10 04/11] efi/x86: Implement support for unaccepted memory Message-ID: <20230509005634.qtuiodpirexbxu2k@box.shutemov.name> References: <20230507234618.18067-1-kirill.shutemov@linux.intel.com> <20230507234618.18067-5-kirill.shutemov@linux.intel.com> <20230508190043.ouauzbghn27khdy4@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 09, 2023 at 12:11:41AM +0200, Ard Biesheuvel wrote: > > @@ -1324,13 +1325,15 @@ void __init e820__memblock_setup(void) > > * e820_table is not finalized and e820__end_of_ram_pfn() cannot be > > * used to get correct RAM size. > > */ > > - if (boot_params.unaccepted_memory) { > > + if (efi.unaccepted != EFI_INVALID_TABLE_ADDR) { > > + struct efi_unaccepted_memory *unaccepted; > > unsigned long size; > > > > - /* One bit per 2MB */ > > - size = DIV_ROUND_UP(e820__end_of_ram_pfn() * PAGE_SIZE, > > - PMD_SIZE * BITS_PER_BYTE); > > - memblock_reserve(boot_params.unaccepted_memory, size); > > + unaccepted = __va(efi.unaccepted); > > + > > + size = sizeof(struct efi_unaccepted_memory); > > + size += unaccepted->size; > > + memblock_reserve(efi.unaccepted, size); > > } > > > > This could be moved to generic code (but we'll need to use early_memremap()) I don't understand why early_memremap() is needed. EFI_LOADER_DATA already mapped into direct mapping. We only need to reserve the memory so it could not be reallocated for other things. Hm? -- Kiryl Shutsemau / Kirill A. Shutemov