From patchwork Fri Sep 21 16:32:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 147304 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1023651ljw; Fri, 21 Sep 2018 09:32:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYWcAgzGoAiWMJHtnbWxo3YCJxRQY86q4DayXZUQAemld5rkRvQWydwCWL9uvo3xUQUiJPS X-Received: by 2002:a62:1544:: with SMTP id 65-v6mr46921703pfv.178.1537547572779; Fri, 21 Sep 2018 09:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537547572; cv=none; d=google.com; s=arc-20160816; b=AFWKMGUD03CLiFgIyWBhjphgWZEq1+ta2qe+eMyaN5JFOaIa2RzrNdBw1i7b4SVqCO e5O9D3skpSt1hxXuNEnJvH5P0kJWluAtnsVZqf1oYw81qrfaqjxMx1h+3EB7vxxjQDOo yetzadVYOgDqacaedTVrWLqBFKwszyrlDZAn2XR6ojBuM7dWL7tAWuQ6GSchiP1/XB2R 226fx/+DgpgsxSWpy1vTZyogvOl/j+4c5exCe/MOlWiHgUVf6wvva/uX+16+XANtRS7x 1tmFTMTiliZezkfetSHooDvIHi0HamiNDkSNJ2N0+z0UoOLhx0oi8trv5Cd1pIQjuduQ JMrA== 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=+xTBG6e1Ietga+Fy3ANr2FAmeF/SEH9hQqVSCRf7Tp8=; b=IV2ztrKd70Ln3r2t2kUanX0OphSVKsOa4bd1v3DJ9RU6D0KHhNRI6D5XDslqxlULKg gopsnHo4S/cpYDVe2VUP8o51FJE9xQVrsv4Fwj1YORWAATlnKt4HpEvkErxAA8AmuWck KcMoWIx7n7x76PTmfA8/vDz5XiII/xSZajIlBXj2EXxdW9ReR65KypTydmG6sJWC1WgW 6l4FwlyqoEdVaChCCOxUiQ+LLQwGk0zB2CArsNwHxSo3fDsSV+a6hy8qGfT6rEKpxwtr N7KQCYAZpzB+RSyrHKPAwInc7u2lzxUcMYzkzZzUgEOt5YOtzAYCLAC2N4kgtOzJzuGi r+rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="g/ucUVqC"; 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 c31-v6si26024953pgl.126.2018.09.21.09.32.52; Fri, 21 Sep 2018 09:32:52 -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="g/ucUVqC"; 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 S2390811AbeIUWWa (ORCPT + 3 others); Fri, 21 Sep 2018 18:22:30 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46309 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390767AbeIUWWa (ORCPT ); Fri, 21 Sep 2018 18:22:30 -0400 Received: by mail-pg1-f194.google.com with SMTP id b129-v6so6276815pga.13 for ; Fri, 21 Sep 2018 09:32:51 -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=+xTBG6e1Ietga+Fy3ANr2FAmeF/SEH9hQqVSCRf7Tp8=; b=g/ucUVqCXGkD64hgIgRPvSYHnUWxn/ry6Ips6NVg/mZPv4wAsjQG61PG3T/fRP9XZ+ 81NVUQ/M3PdpseGDxkUihLXGT70osVq6P2qm4SewYU96/0SGPZnvGmf3XYm2WDIb7MpN jOTvSURmUPxiammve4W9LXFqfGOgGnFF/MwmA= 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=+xTBG6e1Ietga+Fy3ANr2FAmeF/SEH9hQqVSCRf7Tp8=; b=CsTQJ6ON/z167l3vNnJ9K4EYogMvzJ083fX4t8GfOeqrRzM1iC3N9Mq8EyJySB8kp+ C331pi9FuTJwt8yncsV4wVKiXrhTj5+tcyuy8Z1rmj23sQyDNq3Xe2SnjMptFVS80lc8 olhMXjeESvPrfvwuNpP/egXuFPrXmV13G4QdyYjxUeE8DadH7bp5liI7ePXtta724SC4 IJov/Y6hX+cWi7wBK/gOw5AlaRPqujLWxGDSH13U4pY1azBYLFfDQUIfqYsEFZVSpGOs p18KPo7/MLJxaFKiBFl/ztXsACsOeW+MLdrjXp5LZ+NvUegV717mDtnelIPsfsRqrSlF 0/mw== X-Gm-Message-State: APzg51Dhc4XNqVuMfBze83RyAVVjSg8mdAG/uvZllvKvJIEHW0ktYCVJ 5L8vkfvr+xmZXagE3KkzG8v5Wx5cDH4= X-Received: by 2002:a63:4107:: with SMTP id o7-v6mr11234292pga.256.1537547571184; Fri, 21 Sep 2018 09:32:51 -0700 (PDT) Received: from localhost.localdomain ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id y4-v6sm39313996pfn.123.2018.09.21.09.32.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 09:32:50 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: Ard Biesheuvel , Jeremy Linton , Marc Zyngier Subject: [PATCH 2/3] efi/arm: libstub: add a root memreserve config table Date: Fri, 21 Sep 2018 09:32:45 -0700 Message-Id: <20180921163246.16632-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921163246.16632-1-ard.biesheuvel@linaro.org> References: <20180921163246.16632-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. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm-stub.c | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.17.1 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),