From patchwork Mon Jun 12 14:53:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 103640 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp234031qgd; Mon, 12 Jun 2017 07:59:49 -0700 (PDT) X-Received: by 10.55.55.207 with SMTP id e198mr69448234qka.44.1497279589694; Mon, 12 Jun 2017 07:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497279589; cv=none; d=google.com; s=arc-20160816; b=kC5hWYzVjuIEes7NkD/qnT7Bk5zeHYrFTozD3Np/YTFnp8ytSKsDE4/rSYh0vGKNs2 p9DXqy10XNET7L8kK1RTebXJpjMDUqcwG7XauDCuxd4v9d7dP2e/OWyhMf7TU10xk+A7 mqO1+Ic7nRCPpQlKpXnZn14mtZrjoD8fna7Ga890FdFDAxjLQ8UV7URYyydnR6ryHYX6 oeGzYBDrjM0b8PXvb7hxBrLdwwZNnRZ/8VyGvsxl7eD/BBHIj6WoNEyVWkrw4QZT6eUH 7n5g2Ekl0MgWh1/RBk6fxshlbFxjfbgNIWHGcEyFO4+gSiHwGA1ht+F+BFx3gSKTynsb a7Ig== 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=+byrmcIiyhljORwrVF/f/DxgW8c5H7seKNwNGPcpaBI=; b=MhWf9z/swwFXB8k2uXtAE43s7o0L8++EPQrGDZM/dFl10yHJ/35WRPoU4maGgGOH4e i2bN8+gKOI0RaTRmXU35COnF8ZLtidIVabJ5OoDSjfikH1yWUlOK4YGUHE/fDvUHUP51 Y3/keEE+PhCuMow+jKkp0X73yJB9LkBSfMRwMPuIB4vXZVO45Ri4ADtUhKga6Mzw86bt p0Evx0fYXp3YqFplnIgEVW+vF50sPP+nF0yguwN2JrkMK2bjJe2aY2FiOFpfsyXhzylA Jhoz8jZ+Bb1rsJwJhqkdotLjYiFy6v7uL+ROHg3dr0dQGYt1auUzhfp5hSh2zYlio1sj yD+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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 u23si8824961qte.158.2017.06.12.07.59.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 12 Jun 2017 07:59:49 -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; 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]:38540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKQol-0004UG-GT for patch@linaro.org; Mon, 12 Jun 2017 10:59:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKQky-0000u1-9y for grub-devel@gnu.org; Mon, 12 Jun 2017 10:55:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKQku-0000tx-9l for grub-devel@gnu.org; Mon, 12 Jun 2017 10:55:52 -0400 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:35738) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dKQku-0000tT-04 for grub-devel@gnu.org; Mon, 12 Jun 2017 10:55:48 -0400 Received: by mail-wr0-x22c.google.com with SMTP id q97so100597764wrb.2 for ; Mon, 12 Jun 2017 07:55:46 -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=+KFBXtE/UiOyrxrCAGJo4dHc6dVMR8Tu2pG0mh2Cqmk=; b=esYbgc5FPJSYvwkj1Cu10kZ3jjK1z7TaweD0fWLpQUCb6jMMcdu4QfCTnTCOvNQWBl F5IUQZA+5Ofxmgz37RUkP3kESCIFtQIGhYEUww24w01FC86t+9JjYBanjyl05llHlpaP VN7AcDeq3CncCN9zlqocj5EhydqVLrSpiN5yk= 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=+KFBXtE/UiOyrxrCAGJo4dHc6dVMR8Tu2pG0mh2Cqmk=; b=moY8mq9cL+R2ifbJehKNEvxvT+sueb+s719jDSCr4UTqQYl2tiL13+Btai8XFbQCkl FVfb6njl1QMmuNVSd4seKeQHUtRE3Rtm5jJ3u5e6k8nXqvoTRTVhay9m0gWengdQhf1O vJctnxOI5or1RyPN9CtxzdNJBwAD6u4I7DTvGVbkQaBNT4h2GPpzNLBL3ntx8S+x39r7 fTxbv4mAFK1U5IMBu9N0mDjzn8zX6U/u0iR6gkde9hpwjbU65GqfxG1yAZAQUTkGxfsv Aj6jhplHvPzvEnxnI0jdt9yq6myOnbJB/MXI4+bd7xH3FG/TTkKJFta2v3XBM9mBg0sD qapQ== X-Gm-Message-State: AKS2vOyEMjVTwyjiQpaBRfxvNP82sqFYO/+XbULFAGK8t9XpKvPiJpmo SzCLn74rAgNQD3ReNAw+/A== X-Received: by 10.223.128.141 with SMTP id 13mr6532721wrl.141.1497279343611; Mon, 12 Jun 2017 07:55:43 -0700 (PDT) Received: from mohikan.hemma.eciton.net (cpc92316-cmbg19-2-0-cust118.5-4.cable.virginm.net. [82.12.0.119]) by smtp.gmail.com with ESMTPSA id s140sm7722wmd.1.2017.06.12.07.55.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2017 07:55:43 -0700 (PDT) From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH 0/7] efi: improved correctness, arm unification, and cleanup Date: Mon, 12 Jun 2017 15:53:34 +0100 Message-Id: <20170612145341.3351-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::22c 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: ard.biesheuvel@linaro.org, lersek@redhat.com, agraf@suse.de, kraxel@redhat.com 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. I first sent this series out on 28 February this year. Changes since previous submission: - 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 (7): efi: add grub_efi_get_dram_base() function for arm* efi: refactor grub_efi_allocate_pages efi: move fdt helper library arm64: make efi linux loader more generic arm: reuse arm64 linux loader on efi systems 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 | 92 ++++++++++++---- 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 +- include/grub/arm/efi/loader.h | 26 ----- include/grub/arm/efi/memory.h | 3 + include/grub/arm/linux.h | 30 ++--- include/grub/arm64/linux.h | 13 +-- include/grub/efi/efi.h | 10 ++ include/grub/{arm64 => efi}/fdtload.h | 3 - include/grub/efi/memory.h | 3 + include/grub/efi/pe32.h | 2 + 16 files changed, 176 insertions(+), 353 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