From patchwork Thu Sep 27 08:50:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 147685 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1726208lji; Thu, 27 Sep 2018 01:51:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV61/2lPXqp7dyRCpGHOQprzha/LjPwZwFxyTDLmpx029nzFDabj0g1stwxWhxn8/iXl3AQEY X-Received: by 2002:a62:4299:: with SMTP id h25-v6mr10196640pfd.73.1538038262810; Thu, 27 Sep 2018 01:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538038262; cv=none; d=google.com; s=arc-20160816; b=dX52tokOORODC6eo0ibwK/Ct3MeKGB21gdvCDSyINXJAEjmTDB0BXSczakdfLL4END ZAmGuzgRT9f43olboTuhRUA/XkdnOO5mg1zB4vQeSifbBstsRmxumO0iIo6bPWms2Xuc VAdw0MOHyw95/AcR4xvuL9aTWD1J2exeOL+JS9jENLkzv/OpuTeKUC2jMT6VrXQGjgMp rRy05u1OnD6GcyZPSRCNRMSJx1JLIapuLsmS4zY9NUUxY4HDE5SVxAw3HgXK2E98NiwF uZUCNfc3SGPOkoPJh1YLOrtD0j02G6FhNRgneS/9xl2dvbJYFbhNxPS/gf5Sfp7D9ivP CTfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=pliM0wAhEQbP7B2f//HIg7uUcfNbBN60CgcLvrL/TbY=; b=X0WLEB0emrXsLqD9H2G0USmQJUR51IjdqrdM5+BwAOFcEk6Sz9e6uJmrl6r1Y8oJG4 eVvDn97lTzusKT0VMmAJ8XMxLUY+2QuNaxJHSFvVxBH9qpWpUnCOTXze1biGX2oE5rej rz92p161VszarlhTsHcgDxw8UTt0ATDJofzscSw6U24ie+v19fRiafcubtr3D3FtTJSP NQoUqR4tC0+34ktRSM6UnYCoHSCz1LAHQh+AkY5SGLITrZhk0QPycLAkcaMVenFNRoPn WhDYB8900j+IfSyLSx+hC6XcBarAt5ve55f3znrw1TYnSNmLISePaJYwpXJRahlJ/FLc BXJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ji+Retyv; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9-v6si1608734pfg.46.2018.09.27.01.51.02; Thu, 27 Sep 2018 01:51:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ji+Retyv; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727285AbeI0PIK (ORCPT + 3 others); Thu, 27 Sep 2018 11:08:10 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39028 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbeI0PIJ (ORCPT ); Thu, 27 Sep 2018 11:08:09 -0400 Received: by mail-wr1-f65.google.com with SMTP id s14-v6so1657217wrw.6 for ; Thu, 27 Sep 2018 01:50:59 -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:in-reply-to:references; bh=pliM0wAhEQbP7B2f//HIg7uUcfNbBN60CgcLvrL/TbY=; b=Ji+RetyvGrM4kppR1BHBn9jBPUwbfAU9gkrn7EX19XHyKQlRz6DO6xiwEGj8pMihfV ouVzVT4iEDQmICj+j0fDYb3BrF0KxfpM0Nd+LlDgCMfLDtgccC1Az25bz088U6nsF1t4 OJZc9pz4892orsoD1Xirg/GDdwX89C9KKc7rA= 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:in-reply-to :references; bh=pliM0wAhEQbP7B2f//HIg7uUcfNbBN60CgcLvrL/TbY=; b=cwddkXGr9A0RfbbwOyoQYLK8Iu4Yt0PbCN4vDfhx8g8A7cTraqeV8gAhBqf2cGS5xc uTxznktW1qj2evFh4vu5cnU/N9McfBJBmVeAT2n1JfQihVOR1dVyghf4QDXi3URH2SRM bLnDT2ZjeyujeIVvOMUn2WoNuE7lt08BHdt5XS9zk6gbrJ4m36CoN1ZaZJP7GSnU4JwF GU6ynyvXiyWxxvxosdgp6yowMw0utOhHtUJA3rV/nEhr84fLfzzYWJtEZ0k7oI+lTkQ9 dH9RBldba0fs/8g545Rnp3Kj5jquYSjeST9WHNWNqsxzR2wyIhdGFhClu2ISkygzIhFN UNWA== X-Gm-Message-State: ABuFfohD1MuS1biRj/8LZ024Zjj42QLb0meDvav5FTQWowRJZF9xokJE bSue6t4AKnE+ne3QGg9MN4cDDg== X-Received: by 2002:adf:a185:: with SMTP id u5-v6mr8316031wru.50.1538038258916; Thu, 27 Sep 2018 01:50:58 -0700 (PDT) Received: from rev03.home ([2a01:cb1d:112:6f00:546e:3c44:5966:2f5e]) by smtp.gmail.com with ESMTPSA id p11-v6sm1304055wrd.74.2018.09.27.01.50.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Sep 2018 01:50:58 -0700 (PDT) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-efi@vger.kernel.org, Aaron Ma , Alistair Strachan , Ben Hutchings , Bhupesh Sharma , Hans de Goede , Ivan Hu , Jeremy Linton , Marc Zyngier , Matt Fleming , Peter Robinson , Sai Praneeth Prakhya , Sebastian Andrzej Siewior , Stefan Agner Subject: [PATCH 02/11] efi/arm: libstub: add a root memreserve config table Date: Thu, 27 Sep 2018 10:50:29 +0200 Message-Id: <20180927085039.8391-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180927085039.8391-1-ard.biesheuvel@linaro.org> References: <20180927085039.8391-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Installing UEFI configuration tables can only be done before calling ExitBootServices(), so if we want to use the new MEMRESRVE config table from the kernel proper, we need to install a dummy entry from the stub. Tested-by: Jeremy Linton Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm-stub.c | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.18.0 diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 6920033de6d4..30ac0c975f8a 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -69,6 +69,31 @@ static struct screen_info *setup_graphics(efi_system_table_t *sys_table_arg) return si; } +void install_memreserve_table(efi_system_table_t *sys_table_arg) +{ + struct linux_efi_memreserve *rsv; + efi_guid_t memreserve_table_guid = LINUX_EFI_MEMRESERVE_TABLE_GUID; + efi_status_t status; + + status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv), + (void **)&rsv); + if (status != EFI_SUCCESS) { + pr_efi_err(sys_table_arg, "Failed to allocate memreserve entry!\n"); + return; + } + + rsv->next = 0; + rsv->base = 0; + rsv->size = 0; + + status = efi_call_early(install_configuration_table, + &memreserve_table_guid, + rsv); + if (status != EFI_SUCCESS) + pr_efi_err(sys_table_arg, "Failed to install memreserve config table!\n"); +} + + /* * This function handles the architcture specific differences between arm and * arm64 regarding where the kernel image must be loaded and any memory that @@ -235,6 +260,8 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, } } + install_memreserve_table(sys_table); + new_fdt_addr = fdt_addr; status = allocate_new_fdt_and_exit_boot(sys_table, handle, &new_fdt_addr, efi_get_max_fdt_addr(dram_base),