From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VgRcN-0000Up-Hy for mharc-grub-devel@gnu.org; Tue, 12 Nov 2013 22:59:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgRcH-0000Uj-Aj for grub-devel@gnu.org; Tue, 12 Nov 2013 22:59:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VgRcB-0001gQ-Mb for grub-devel@gnu.org; Tue, 12 Nov 2013 22:59:45 -0500 Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:43529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgRcB-0001gK-Dz for grub-devel@gnu.org; Tue, 12 Nov 2013 22:59:39 -0500 Received: by mail-lb0-f178.google.com with SMTP id y6so535580lbh.9 for ; Tue, 12 Nov 2013 19:59:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=sjfYm89N59Wq/jAQblAVskrTjHo3juRU7SpRFXoaDvg=; b=acqWXpoZwLRBu6u/RRigiSoBIqX5zF8QmkF786plSyxcIjt0OStLK3RXXp0xAbpDts 9fBZOTpUFpXuVBxC9s9OgGJ7LlcpQ0NPr6nnbZqMuxJ5gVcVakyx8AinbHdPq+nPfVqz KgSwRXNGf8btm5YLz9Moa4CcNGHfj1wEak2salywG6ePKV3ZQLB/w2UCG1vqTZ/LgqSV FpkGGm597eGRsBMXelgXdVgIn9ftG8xt9Il8vR4xqvPqrbWTnAlddm6858J24GIQaQtq MnP7Uab6meW4SO8ukz22Prk156eChJu9s5nKoTAg3YbkApXHxij22pzURuEre2/zmhmd xn/Q== X-Received: by 10.152.26.131 with SMTP id l3mr9285621lag.29.1384315177339; Tue, 12 Nov 2013 19:59:37 -0800 (PST) Received: from opensuse.site (ppp91-76-174-89.pppoe.mtu-net.ru. [91.76.174.89]) by mx.google.com with ESMTPSA id e10sm7341270laa.6.2013.11.12.19.59.36 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Tue, 12 Nov 2013 19:59:36 -0800 (PST) Date: Wed, 13 Nov 2013 07:59:34 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH 3/4] efi: Support GRUB_MMAP_MALLOC_LOW in the EFI firmware allocator Message-ID: <20131113075934.2e62671d@opensuse.site> In-Reply-To: References: X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.18; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::232 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2013 03:59:51 -0000 В Tue, 12 Nov 2013 18:26:39 -0800 Josh Triplett пишет: > EFI supports allocating memory below a specified address; use that to > implement GRUB_MMAP_MALLOC_LOW by requesting memory below 1M. Out of curiosity - why would you need it on EFI? Your patch does not add any consumer of GRUB_MMAP_MALLOC_LOW and on EFI notion of low memory should not exist? > --- > > ChangeLog entry: > > 2013-11-13 Josh Triplett > > * include/grub/efi/memory.h (GRUB_MMAP_MALLOC_LOW): Define. > * grub-core/mmap/efi/mmap.c (grub_mmap_malign_and_register): Add > support for GRUB_MMAP_MALLOC_LOW, to allocate memory below 1M via the > EFI firmware. > > grub-core/mmap/efi/mmap.c | 15 ++++++++++----- > include/grub/efi/memory.h | 2 ++ > 2 files changed, 12 insertions(+), 5 deletions(-) > > diff --git a/grub-core/mmap/efi/mmap.c b/grub-core/mmap/efi/mmap.c > index e6cd185..64ad05c 100644 > --- a/grub-core/mmap/efi/mmap.c > +++ b/grub-core/mmap/efi/mmap.c > @@ -239,9 +239,9 @@ void * > grub_mmap_malign_and_register (grub_uint64_t align __attribute__ ((unused)), > grub_uint64_t size, > int *handle, int type, > - int flags __attribute__ ((unused))) > + int flags) > { > - grub_efi_physical_address_t address; > + grub_efi_physical_address_t address, max_address; > grub_efi_boot_services_t *b; > grub_efi_uintn_t pages; > grub_efi_status_t status; > @@ -254,13 +254,18 @@ grub_mmap_malign_and_register (grub_uint64_t align __attribute__ ((unused)), > > b = grub_efi_system_table->boot_services; > > - address = 0xffffffff; > + if (flags & GRUB_MMAP_MALLOC_LOW) > + max_address = 0xfffff; > + else > + max_address = 0xffffffff; > + address = max_address; > > #if GRUB_TARGET_SIZEOF_VOID_P < 8 > /* Limit the memory access to less than 4GB for 32-bit platforms. */ > atype = GRUB_EFI_ALLOCATE_MAX_ADDRESS; > #else > - atype = GRUB_EFI_ALLOCATE_ANY_PAGES; > + atype = (flags & GRUB_MMAP_MALLOC_LOW) ? GRUB_EFI_ALLOCATE_MAX_ADDRESS > + : GRUB_EFI_ALLOCATE_ANY_PAGES; > #endif > > pages = (size + 0xfff) >> 12; > @@ -276,7 +281,7 @@ grub_mmap_malign_and_register (grub_uint64_t align __attribute__ ((unused)), > { > /* Uggh, the address 0 was allocated... This is too annoying, > so reallocate another one. */ > - address = 0xffffffff; > + address = max_address; > status = efi_call_4 (b->allocate_pages, atype, > make_efi_memtype (type), pages, &address); > grub_efi_free_pages (0, pages); > diff --git a/include/grub/efi/memory.h b/include/grub/efi/memory.h > index 20526b1..b4940af 100644 > --- a/include/grub/efi/memory.h > +++ b/include/grub/efi/memory.h > @@ -24,6 +24,8 @@ > > #define GRUB_MMAP_REGISTER_BY_FIRMWARE 1 > > +#define GRUB_MMAP_MALLOC_LOW 1 > + > grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size, > int type, int handle); > grub_err_t grub_machine_mmap_unregister (int handle);