From patchwork Tue Dec 20 22:32:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 88654 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1962879qgi; Tue, 20 Dec 2016 14:32:36 -0800 (PST) X-Received: by 10.99.253.85 with SMTP id m21mr2501257pgj.38.1482273156415; Tue, 20 Dec 2016 14:32:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si23970129pli.269.2016.12.20.14.32.36; Tue, 20 Dec 2016 14:32:36 -0800 (PST) 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=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752007AbcLTWcf (ORCPT + 2 others); Tue, 20 Dec 2016 17:32:35 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:36279 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753370AbcLTWce (ORCPT ); Tue, 20 Dec 2016 17:32:34 -0500 Received: by mail-io0-f180.google.com with SMTP id m133so7033219iom.3 for ; Tue, 20 Dec 2016 14:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JNh9potUc2Ht0GmEzHFZMA4bpMdjjAUO1RK2cPdV99I=; b=YGe5S186HY4sGnWJbf4xe+KE8crM9nuWGlAn2Vb1v2kKjefDQuqT8DfwLH0aQEj8sA 2fdI7WN7EZM0JUWORBbZ7quaDiPrGvX5aJAI/Arb+mIRZdNkrpt2C09PLlgC67KAHZR9 HbwBP4yYM1XBfUKPV1Fw2xdoWF1YdumoFjCvg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JNh9potUc2Ht0GmEzHFZMA4bpMdjjAUO1RK2cPdV99I=; b=fE44QRmunNsD9OxzKLI4c7K5p+asJl/7rSu/LaCFMAjK14iPti8JfoRQOacd0jNznA zQyTVVpl3e5W/yjADf/oXqN4hegF8VLrgr949uUzP2B8gun33cyU4a88Sc/u5rSsyLdK 1ZWyvd64nlJocRlZbVfzdoR/+gB5+SfwlH6n4sGbhH1eS4zVaHVkGdQLkwaSiMkrHB9M UxKez5et756RxM9QqLAhIQX/6w2dxfU+wjyN1YoG02TaMlwwZ7apsvAfzi1Hw1uqoBB1 ciuZ72Or9aHN1xZ5zVI44iMrO+gQF93oAXEt9YN3yY04moFQclF6hPBqJW+ewzzKtp43 0E8A== X-Gm-Message-State: AIkVDXLF1o+DBYvRWoFoP9ZGZYwjoo84rw0avprWih4zK+nHx2oouKDXkVp2zB90rI4h4A2WTdn5+VvUIjAB9Ea2 X-Received: by 10.107.18.39 with SMTP id a39mr2364957ioj.45.1482273153731; Tue, 20 Dec 2016 14:32:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.169.101 with HTTP; Tue, 20 Dec 2016 14:32:33 -0800 (PST) In-Reply-To: <20161219213859.GA2225@codeblueprint.co.uk> References: <20161219142419.16780-1-james.morse@arm.com> <20161219213859.GA2225@codeblueprint.co.uk> From: Ard Biesheuvel Date: Tue, 20 Dec 2016 22:32:33 +0000 Message-ID: Subject: Re: [PATCH v2] efi/libstub: arm*: Pass latest memory map to the kernel To: Matt Fleming Cc: James Morse , "linux-efi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Jeff Hugo Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On 19 December 2016 at 21:38, Matt Fleming wrote: > On Mon, 19 Dec, at 02:24:19PM, James Morse wrote: >> From: Ard Biesheuvel >> >> As reported by James, the current libstub code involving the annotated >> memory map only works somewhat correctly by accident, due to the fact >> that a pool allocation happens to be reused immediately, retaining its >> former contents. >> >> Instead of juggling memory maps, which makes the code more complex than >> it needs to be, simply put a placholder value into the FDT, and only >> write the actual value after ExitBootServices() has been called. >> >> Reported-by: James Morse >> Signed-off-by: Ard Biesheuvel >> [Update mmap-size too, remove updated_fdt()s unused params and header entry] >> Signed-off-by: James Morse >> --- >> Hi Ard, >> >> This is a v2 of your patch that updates the mmap-size too. This solves the >> truncated memmap problem I saw with v1 on Seattle. >> >> The original patch was CC-stable, so I think this should also have: >> Cc: >> Fixes: ed9cc156c42f ("efi/libstub: Use efi_exit_boot_services() in FDT") >> >> >> Thanks, >> >> James >> >> drivers/firmware/efi/libstub/efistub.h | 8 ---- >> drivers/firmware/efi/libstub/fdt.c | 75 +++++++++++++++++++++------------- >> 2 files changed, 47 insertions(+), 36 deletions(-) > > Thanks James. I've queued this one up in the 'urgent' queue and tagged > it for stable. I'll send it to tip before the end of the week. Could we fold the hunk below, please? My mistake, and harmless in practice, but sloppy nonetheless -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index 9b11b0559a23..90ab96845937 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -149,26 +149,25 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, static efi_status_t update_fdt_memmap(void *fdt, u64 memmap, u32 map_size) { int node = fdt_path_offset(fdt, "/chosen"); - efi_status_t status; + int err; if (node < 0) return EFI_LOAD_ERROR; memmap = cpu_to_fdt64(memmap); - status = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-start", - &memmap, sizeof(memmap)); + err = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-start", + &memmap, sizeof(memmap)); if (status) return EFI_LOAD_ERROR; map_size = cpu_to_fdt32(map_size); - status = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-size", - &map_size, sizeof(map_size)); + err = fdt_setprop_inplace(fdt, node, "linux,uefi-mmap-size", + &map_size, sizeof(map_size)); if (status) return EFI_LOAD_ERROR; - return EFI_SUCCESS; }