From patchwork Thu Aug 3 10:04:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 109303 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp571022qge; Thu, 3 Aug 2017 03:08:05 -0700 (PDT) X-Received: by 10.55.33.194 with SMTP id f63mr1762466qki.112.1501754884961; Thu, 03 Aug 2017 03:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501754884; cv=none; d=google.com; s=arc-20160816; b=R1jTUbtmCBLz3U5Nstb9PHbc4DZ2W3Wg9XTxKLJC+CbqHw0IT1w1Ggti1czgpzKMfN iYvUQ+LYnWWYBkeWdQg3v9nkCSU1k0YDF6uvFtWjl+QxFmImz7QCwB5v95xD6A8z1+9p JEXqLAeiwIEZvGOMAyn7m9lchgQw54J7/WAOThvOrJ8boghXE6y43fD9GdC/085mdXK1 R7ofmmjzQxfgTh/KVKr0dAiNExzYcirKLSo133XvkR/SP0/xJTXNpojZcH6YcKPCIrXS bkUuxxlwQw9jyF/w0E/yIik24/tmlpc5oyKEGL//M/RpExO26h9u++LqFmbD/B5wG89q dEIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:dkim-signature :arc-authentication-results; bh=f+LJLev1vmULhuBXzJ+vCTgEUEwLeyPlY86U4LGmPnk=; b=NQ6YDDzdHXs3DhbdOass8Wkk78zTubSFK1nYruUSbHVeFoE2vOPRqzoQ7er1XPsX33 eTKrT5tLo39J6l0bdyVCe7yBgQ8EQXb+939FnKIZvtNw8etAJKPKERshA+rnidz/vsOZ JC1a22hRVnPelB8B7v9s9V4YA+A4+arT+x5fdT4Mh/UK7PW0fBosYqDA7bnMANe2CiFn NIoAVmvm0Iz5HcxpyZpFlDa+mZXNHSHLuGpDLGBklg6x/ClTll0ZFBtsGaX8IwPTBrN2 GqOn0C5E1VYuwy/ytC9GhoZvdWO9+Mw9gF8XSDLujS7N6GOk9ol9JV+uguvhUdg1m+Zx crPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=kWvH6D+8; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s16si6974757qts.98.2017.08.03.03.08.04 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 03 Aug 2017 03:08:04 -0700 (PDT) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=kWvH6D+8; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53197 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddD2w-0000Fo-7d for patch@linaro.org; Thu, 03 Aug 2017 06:08:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddD1c-0000F4-C3 for grub-devel@gnu.org; Thu, 03 Aug 2017 06:06:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddD1Z-00045K-IY for grub-devel@gnu.org; Thu, 03 Aug 2017 06:06:40 -0400 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]:37214) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddD1Z-00042x-7N for grub-devel@gnu.org; Thu, 03 Aug 2017 06:06:37 -0400 Received: by mail-wr0-x233.google.com with SMTP id 33so3715250wrz.4 for ; Thu, 03 Aug 2017 03:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=SN/n1JZik1a+6oOuwgjX1mvTtO9E2AWk9K1ou7sp3Zs=; b=kWvH6D+8CKngCEK9fIGPUqMKlTpPTPBsres1kO4gbxy81c+P12XsQScHTNII1tPpo1 iQD0VxRSYIpuz+aR9vYcWhRQHfos977e2dX/fQIjf9LtL1pIcIo9VyRVcJbbUe6HC6a3 xDvMeCPhHYOAdqM5QHkJibI9xbcB133bdKHwg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SN/n1JZik1a+6oOuwgjX1mvTtO9E2AWk9K1ou7sp3Zs=; b=pRKOdicYBBJzBR9IOqjvswXbO5zf9a7/2GWMLwWx2EXnCB3WLi3G/4PNvJCxX2FRJ5 U1sPxDBzIRBKQi4A6Qu6X1dBathF+3p2e7z5uIrci99FyJA2Jus65SZvFXHxAKQyFBPg 4guxeyi/CcCOnu7rGq0Zw2hTmmgT7jNcNk6y+Iidbyddx7+7ypeo63vL+j894fP9UvHG 29SpAtFCj77dtDx40e46i8X5ex8cZQhvqOLVUlFZRb+bvHTgVGh90CUAwt7diXZMG1sp GHJJBNRffKvAs/4opEenygXv3wrxBbhLNkMMUo7ROKy4+3PEm2gRboAtEE2mSRmf6c4S Q8IQ== X-Gm-Message-State: AIVw113QDfjyNtFgUOW0zKW4oVXlwVmHXdSDEr258hQZaaopnCYl2CCg rQVhGaMO9E/4t+sGXENwLw== X-Received: by 10.223.151.135 with SMTP id s7mr1012206wrb.231.1501754794369; Thu, 03 Aug 2017 03:06:34 -0700 (PDT) Received: from vanye.hemma.eciton.net (cpc92316-cmbg19-2-0-cust118.5-4.cable.virginm.net. [82.12.0.119]) by smtp.gmail.com with ESMTPSA id e5sm2274543wre.24.2017.08.03.03.06.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2017 03:06:33 -0700 (PDT) From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH v2 00/14] efi: improved correctness, arm unification, and cleanup Date: Thu, 3 Aug 2017 11:04:18 +0100 Message-Id: <20170803100432.29913-1-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::233 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Cc: Daniel Kiper MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" This patch series is really three different ones, but they unite around the need for (and the implementation) of more flexible control of memory allocation on UEFI systems. 1: Adding new interfaces - A function for detecting the start address of RAM Since ARM platforms have no standardised memory map, implement a function that picks the lowest-address region supporting the write-back cache atribute from the UEFI memory map. - Implement and expose a new memory allocation function giving access to the allocation type and memory type arguments to the AllocatePages boot service. 2: ARM unification - The fdt helper library for arm64-efi is really an efi/fdt function. So move it to neutral ground in loader/efi. - The arm64 efi linux loader was written for arm64 only, so clean it up a bit with regards to 32/64-bit portability, and abstract out some definitions and function prototypes. - Move the arm efi port to use the arm64 linux loader instead of the one shared with the u-boot port. Clean up the u-boot loder by deleting the efi-specific bits and other code only used by that. 3: Correctness improvements - There are some restrictions on the placement of initrd images in relation to the runtime kernel images, for both arm and arm64 - but the arm64 one did not use to be explicitly documented (and only triggerable on systems with > 40GB of RAM), and the u-boot loader always placed the images nearly adjacent. Use the new interfaces to place the initrd as approrpiate for each architecture. - The allocation of memory for the grub heap is done of memory type GRUB_EFI_LOADER_DATA. Since UEFI can return memory with non-executable mappings for this request, and modules are loaded onto the heap, change this allocation to GRUB_EFI_LOADER_CODE instead. Changes between v1 and v2: - Move EFI_PAGE_SHIFT/EFI_BYTES_TO_PAGES first in the series, as separate patch. - Add GRUB_EFI_PAGE_SIZE definition. - Break out find_efi_mmap_size function from existing code to common code for reuse. - Move current users to this version. - Rename grub_efi_get_dram_base -> grub_efi_get_ram_base. - Break up commits to better separate logical changes. - Moved initrd location restrictions description, and the resulting macros, to the body of the function that uses them. Changes between RFC and v1: - Rebased (to deal with arm coreboot upstream changes). - Moved EFI page size definitions to common header. - Moved a few stray 32/64-bit fixes from 3/7 to 4/7. Leif Lindholm (14): arm64/efi: move EFI_PAGE definitions to efi/memory.h efi: add central copy of grub_efi_find_mmap_size loader: drop local implementations of find_efi_mmap_size efi: add grub_efi_get_ram_base() function for arm* efi: refactor grub_efi_allocate_pages efi: move fdt helper library efi: Add GRUB_PE32_MAGIC definition arm64 linux loader: improve type portability arm64 linux loader: rename functions and macros and move to common headers loader: switch arm/linux to grub_linux_kernel_header struct arm/efi: switch to arm64 linux loader arm: delete unused efi support from loader/arm efi: restrict arm/arm64 linux loader initrd placement efi: change heap allocation type to GRUB_EFI_LOADER_CODE grub-core/Makefile.am | 1 - grub-core/Makefile.core.def | 6 +- grub-core/kern/arm/efi/misc.c | 202 ---------------------------------- grub-core/kern/efi/mm.c | 130 ++++++++++++++++++---- grub-core/loader/arm/linux.c | 39 +------ grub-core/loader/arm64/linux.c | 73 ++++++++---- grub-core/loader/arm64/xen_boot.c | 15 +-- grub-core/loader/{arm64 => efi}/fdt.c | 11 +- grub-core/loader/i386/linux.c | 51 +-------- grub-core/loader/multiboot_mbi2.c | 38 +------ include/grub/arm/efi/loader.h | 26 ----- include/grub/arm/linux.h | 31 ++---- include/grub/arm64/linux.h | 13 +-- include/grub/efi/efi.h | 11 ++ include/grub/{arm64 => efi}/fdtload.h | 3 - include/grub/efi/memory.h | 4 + include/grub/efi/pe32.h | 2 + 17 files changed, 216 insertions(+), 440 deletions(-) delete mode 100644 grub-core/kern/arm/efi/misc.c rename grub-core/loader/{arm64 => efi}/fdt.c (93%) delete mode 100644 include/grub/arm/efi/loader.h rename include/grub/{arm64 => efi}/fdtload.h (89%) -- 2.11.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel