From patchwork Mon Sep 17 02:45:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 146821 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3259714ljw; Sun, 16 Sep 2018 19:45:19 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZui1I6RUb23P9ZscEhUMnXt5shJdXR30VZfheC9oBQCdFHB76ksmpm99arm40yX+x38QC0 X-Received: by 2002:a50:ca83:: with SMTP id x3-v6mr37433737edh.287.1537152319136; Sun, 16 Sep 2018 19:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537152319; cv=none; d=google.com; s=arc-20160816; b=cT/denQEr7gXHTuPjzcGE1DAjdKgH399WkUqSj5RX1T6jnUwglURNN1rXPj0p7xuv9 ZejyfyM/SzEsKZtNKMV5iIXwkqb7s+Wb/awCLROrtQElZkrIYbfQPhBVivjKVAmaUcGq VMx1v7ABSKXn43Co2IQQyGHoq6FiQKfZz0CevlPaEbtWZrpXw+eyvEVbLrTmdv0ePqub hQlObiPPCTgKHNx22IHfSflKtxRw6AmUbB2GKgGctPSBmQmQ5iG5Ue9R4e/Q4S5KIZqf v+HHmLvZHxJWXnmBHYHu6VinlILRTb9RlQCSy5BrZuL5vUR9zUaoVk6feMzFfRSrBN9Z ubYA== 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 :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from; bh=xFHFy0o9DYw+psr6s1UdqlW86lo+4MV6DNjol8/Ikdo=; b=Hc3V2v/eRzghkt7J2lCDwrkVcvGmCh+xv4a2ynhDUkrsAB3BFKDcloKY0iRsOoUfEM sM2KfYNAEXq5p+i/WX3Lb+s9sf14ZQ/0rqPspJES+n1Tp67uHsgJnD+cC1jDA6yKHkao 3HXcyecOg36KPz+gbYSwbAKoJsY6v1uZicM40RqN8s5o7YjgbjABSYSttJODPUvitcVw cTOE1lhX1y5Gzy0tWFrkXhJLDgN6IkyfMdV6LBIPD2wjUBJHvQ9zJ+wugvIE17xpDcHJ ibsrStvUJTCOi5T1Bt2cucJO3eyUt7OvdzkNwxshIxBZhCsbDyrT0bYWbHH7GEbimM6w 9gtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id o14si6949626edv.250.2018.09.16.19.45.18; Sun, 16 Sep 2018 19:45:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 98CF3C21C27; Mon, 17 Sep 2018 02:45:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5B0A8C21C2C; Mon, 17 Sep 2018 02:45:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C2E18C21C2C; Mon, 17 Sep 2018 02:45:13 +0000 (UTC) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 7455FC21C27 for ; Mon, 17 Sep 2018 02:45:13 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2CA79AF8B; Mon, 17 Sep 2018 02:45:13 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Mon, 17 Sep 2018 04:45:12 +0200 Message-Id: <20180917024512.58088-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH] efi_loader: Align runtime section to 64kb X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The UEFI spec mandates that runtime sections are 64kb aligned to enable support for 64kb page size OSs. This patch ensures that we extend the runtime section to 64kb to be spec compliant. Signed-off-by: Alexander Graf --- lib/efi_loader/efi_memory.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 4f8cb545ad..66ad54a152 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -11,6 +11,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -526,10 +527,10 @@ static void add_u_boot_and_runtime(void) uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT; efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false); - /* Add Runtime Services */ - runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK; + /* Add Runtime Services,must be 64kb aligned */ + runtime_start = (ulong)&__efi_runtime_start & ~(SZ_64K - 1); runtime_end = (ulong)&__efi_runtime_stop; - runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK; + runtime_end = (runtime_end + SZ_64K - 1) & ~(SZ_64K - 1); runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; efi_add_memory_map(runtime_start, runtime_pages, EFI_RUNTIME_SERVICES_CODE, false);