From 9f8bb9191f0eb8c88b5c3300a0c25fddc3010cbd Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 15 Oct 2019 08:57:19 +0100 Subject: [PATCH] fix booting on ARMv7 due to OPTIMIZE_INLINING now being forced, drop old i.MX MMC patch, fix for UFEI on ARMv7 on some devices --- ...-case-uaccess_-calls-are-not-inlined.patch | 143 ++++++++++++ arm-sdhci-esdhc-imx-fixes.patch | 57 ----- ...e-reserved-memory-at-the-base-of-RAM.patch | 216 ++++++++++++++++++ kernel.spec | 11 +- 4 files changed, 367 insertions(+), 60 deletions(-) create mode 100644 ARM-fix-__get_user_check-in-case-uaccess_-calls-are-not-inlined.patch delete mode 100644 arm-sdhci-esdhc-imx-fixes.patch create mode 100644 efi-libstub-arm-account-for-firmware-reserved-memory-at-the-base-of-RAM.patch diff --git a/ARM-fix-__get_user_check-in-case-uaccess_-calls-are-not-inlined.patch b/ARM-fix-__get_user_check-in-case-uaccess_-calls-are-not-inlined.patch new file mode 100644 index 000000000..db893d26e --- /dev/null +++ b/ARM-fix-__get_user_check-in-case-uaccess_-calls-are-not-inlined.patch @@ -0,0 +1,143 @@ +From patchwork Mon Sep 30 05:59:25 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Masahiro Yamada +X-Patchwork-Id: 1132459 +Return-Path: +Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) + by smtp.lore.kernel.org (Postfix) with ESMTP id DF215C4360C + for ; Mon, 30 Sep 2019 06:02:56 +0000 (UTC) +Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) + by mail.kernel.org (Postfix) with ESMTP id B032A20815 + for ; Mon, 30 Sep 2019 06:02:56 +0000 (UTC) +Authentication-Results: mail.kernel.org; + dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com + header.b="sVJyT1RO" +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S1729635AbfI3GCz (ORCPT + ); + Mon, 30 Sep 2019 02:02:55 -0400 +Received: from conuserg-10.nifty.com ([210.131.2.77]:65305 "EHLO + conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S1726121AbfI3GCz (ORCPT + ); + Mon, 30 Sep 2019 02:02:55 -0400 +Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp + [153.142.97.92]) (authenticated) + by conuserg-10.nifty.com with ESMTP id x8U60ANM011158; + Mon, 30 Sep 2019 15:00:10 +0900 +DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x8U60ANM011158 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; + s=dec2015msa; t=1569823213; + bh=31RHoPop8t0h2pCPRnwABR+VMelvfuLJ6qwFWQxvRAk=; + h=From:To:Cc:Subject:Date:From; + b=sVJyT1ROU+6mzkZMRTb0M214/0QcKkmxRbNgDwh2q1TPJpEjPLOoE+y1jkVndgyce + qBfr7v3nYiN5WSsx5xTwPYvHohsWcSS3AWwyVRw8Kxjd0CGrX8l5WcF76SmCvJPLCB + wLRZ7C1/Z/zv9v8AVlB2BGhDmSvNQJ9bvuGi42d+JbBXGDfg0HZGGHEj7yDDLBV9nW + EZkTGzP6wtIdqgD6DM5Lj4LA7FnlzH8Ocy6yp5agIZ7tdaiVh4E+Xb97KFsLgRin/o + kTPCap5ub1TziurVW+1pbzwH+G3TNVeY+yJdYcAQRFzXXOrTa7s5zIJUtObrYVGCA2 + ctH5uaN1kjx1g== +X-Nifty-SrcIP: [153.142.97.92] +From: Masahiro Yamada +To: linux-arm-kernel@lists.infradead.org, + Russell King +Cc: Linus Torvalds , + Olof Johansson , Arnd Bergmann , + Nick Desaulniers , + Nicolas Saenz Julienne , + Masahiro Yamada , + Julien Thierry , + Russell King , + Stefan Agner , + Thomas Gleixner , + Vincent Whitchurch , + linux-kernel@vger.kernel.org +Subject: [PATCH] ARM: fix __get_user_check() in case uaccess_* calls are not + inlined +Date: Mon, 30 Sep 2019 14:59:25 +0900 +Message-Id: <20190930055925.25842-1-yamada.masahiro@socionext.com> +X-Mailer: git-send-email 2.17.1 +Sender: linux-kernel-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: linux-kernel@vger.kernel.org + +KernelCI reports that bcm2835_defconfig is no longer booting since +commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING +forcibly"): + + https://lkml.org/lkml/2019/9/26/825 + +I also received a regression report from Nicolas Saenz Julienne: + + https://lkml.org/lkml/2019/9/27/263 + +This problem has cropped up on arch/arm/config/bcm2835_defconfig +because it enables CONFIG_CC_OPTIMIZE_FOR_SIZE. The compiler tends +to prefer not inlining functions with -Os. I was able to reproduce +it with other boards and defconfig files by manually enabling +CONFIG_CC_OPTIMIZE_FOR_SIZE. + +The __get_user_check() specifically uses r0, r1, r2 registers. +So, uaccess_save_and_enable() and uaccess_restore() must be inlined +in order to avoid those registers being overwritten in the callees. + +Prior to commit 9012d011660e ("compiler: allow all arches to enable +CONFIG_OPTIMIZE_INLINING"), the 'inline' marker was always enough for +inlining functions, except on x86. + +Since that commit, all architectures can enable CONFIG_OPTIMIZE_INLINING. +So, __always_inline is now the only guaranteed way of forcible inlining. + +I want to keep as much compiler's freedom as possible about the inlining +decision. So, I changed the function call order instead of adding +__always_inline around. + +Call uaccess_save_and_enable() before assigning the __p ("r0"), and +uaccess_restore() after evacuating the __e ("r0"). + +Fixes: 9012d011660e ("compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING") +Reported-by: "kernelci.org bot" +Reported-by: Nicolas Saenz Julienne +Signed-off-by: Masahiro Yamada +Acked-by: Arnd Bergmann +Tested-by: Nicolas Saenz Julienne +Tested-by: Fabrizio Castro +Tested-by: Geert Uytterhoeven +--- + + arch/arm/include/asm/uaccess.h | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index 303248e5b990..559f252d7e3c 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -191,11 +191,12 @@ extern int __get_user_64t_4(void *); + #define __get_user_check(x, p) \ + ({ \ + unsigned long __limit = current_thread_info()->addr_limit - 1; \ ++ unsigned int __ua_flags = uaccess_save_and_enable(); \ + register typeof(*(p)) __user *__p asm("r0") = (p); \ + register __inttype(x) __r2 asm("r2"); \ + register unsigned long __l asm("r1") = __limit; \ + register int __e asm("r0"); \ +- unsigned int __ua_flags = uaccess_save_and_enable(); \ ++ unsigned int __err; \ + switch (sizeof(*(__p))) { \ + case 1: \ + if (sizeof((x)) >= 8) \ +@@ -223,9 +224,10 @@ extern int __get_user_64t_4(void *); + break; \ + default: __e = __get_user_bad(); break; \ + } \ +- uaccess_restore(__ua_flags); \ ++ __err = __e; \ + x = (typeof(*(p))) __r2; \ +- __e; \ ++ uaccess_restore(__ua_flags); \ ++ __err; \ + }) + + #define get_user(x, p) \ diff --git a/arm-sdhci-esdhc-imx-fixes.patch b/arm-sdhci-esdhc-imx-fixes.patch deleted file mode 100644 index 1b10c3e18..000000000 --- a/arm-sdhci-esdhc-imx-fixes.patch +++ /dev/null @@ -1,57 +0,0 @@ -From patchwork Thu Jun 28 08:13:30 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [2/3] mmc: sdhci: add quirk to prevent higher speed modes -From: Stefan Agner -X-Patchwork-Id: 10493273 -Message-Id: <20180628081331.13051-3-stefan@agner.ch> -To: adrian.hunter@intel.com, ulf.hansson@linaro.org -Cc: fabio.estevam@nxp.com, haibo.chen@nxp.com, aisheng.dong@nxp.com, - michael@amarulasolutions.com, rmk+kernel@armlinux.org.uk, - linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, - Stefan Agner -Date: Thu, 28 Jun 2018 10:13:30 +0200 - -Some hosts are capable of running higher speed modes but do not -have the board support for it. Introduce a quirk which prevents -the stack from using modes running at 100MHz or faster. - -Signed-off-by: Stefan Agner ---- - drivers/mmc/host/sdhci.c | 8 ++++++++ - drivers/mmc/host/sdhci.h | 2 ++ - 2 files changed, 10 insertions(+) - -diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c -index 1c828e0e9905..8ac257dfaab3 100644 ---- a/drivers/mmc/host/sdhci.c -+++ b/drivers/mmc/host/sdhci.c -@@ -3749,6 +3749,14 @@ int sdhci_setup_host(struct sdhci_host *host) - } - } - -+ if (host->quirks2 & SDHCI_QUIRK2_NO_UHS_HS200_HS400) { -+ host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 | -+ SDHCI_SUPPORT_DDR50); -+ -+ mmc->caps2 &= ~(MMC_CAP2_HSX00_1_8V | MMC_CAP2_HSX00_1_2V | -+ MMC_CAP2_HS400_ES); -+ } -+ - if (host->quirks2 & SDHCI_QUIRK2_NO_1_8_V) { - host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 | - SDHCI_SUPPORT_DDR50); -diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h -index 23966f887da6..cb2433d6d61f 100644 ---- a/drivers/mmc/host/sdhci.h -+++ b/drivers/mmc/host/sdhci.h -@@ -450,6 +450,8 @@ struct sdhci_host { - * block count. - */ - #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18) -+/* Do not support any higher speeds (>50MHz) */ -+#define SDHCI_QUIRK2_NO_UHS_HS200_HS400 (1<<19) - - int irq; /* Device IRQ */ - void __iomem *ioaddr; /* Mapped address */ diff --git a/efi-libstub-arm-account-for-firmware-reserved-memory-at-the-base-of-RAM.patch b/efi-libstub-arm-account-for-firmware-reserved-memory-at-the-base-of-RAM.patch new file mode 100644 index 000000000..47bccc262 --- /dev/null +++ b/efi-libstub-arm-account-for-firmware-reserved-memory-at-the-base-of-RAM.patch @@ -0,0 +1,216 @@ +From patchwork Mon Oct 14 16:33:09 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Ard Biesheuvel +X-Patchwork-Id: 11189097 +Return-Path: + +Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org + [172.30.200.123]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1AD11390 + for ; + Mon, 14 Oct 2019 16:33:28 +0000 (UTC) +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.kernel.org (Postfix) with ESMTPS id BF9BE217D9 + for ; + Mon, 14 Oct 2019 16:33:28 +0000 (UTC) +Authentication-Results: mail.kernel.org; + dkim=pass (2048-bit key) header.d=lists.infradead.org + header.i=@lists.infradead.org header.b="AWaZtE0p"; + dkim=fail reason="signature verification failed" (2048-bit key) + header.d=linaro.org header.i=@linaro.org header.b="THTDXG/3" +DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF9BE217D9 +Authentication-Results: mail.kernel.org; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: mail.kernel.org; + spf=none + smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To + :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: + Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: + List-Owner; bh=bFVBLmSAI67EKVRVJ976rFVJhb17XzlF5Frmxpt4Q24=; b=AWaZtE0prtFAKn + TzXV3jyYung5GM46YpbdIYSXq5utN5mbiOzHoadisQSsfKUn1h5/wpF7esUHXwHaDS5FWUUp5g6F+ + P0rKmQjVgWN+jVD7Kk7RvmJewoFKWvlUzoG5+Lfin8NLSHMwNg+v2Z+sUayE+SylST1LP8jkK8B7e + QiOi647qxPv6IW25Zucu4D+N8DXmh+t6DjJXZ2W1LznbCD0PIPjTpcen0dntkHUYL0FHya3ghdrC3 + ejo+MjvSDlrs4LgP5ER56hiSeucu58WMLefoUS3oSEYirB+9zt3Qk2Ppxv6k2GY/NBkLjw9jT76kg + OIZj83Gck17z+l7+NVmQ==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) + id 1iK3Hk-0001ZP-CS; Mon, 14 Oct 2019 16:33:28 +0000 +Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) + by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) + id 1iK3Hf-0001Tp-Mo + for linux-arm-kernel@lists.infradead.org; Mon, 14 Oct 2019 16:33:26 +0000 +Received: by mail-wm1-x341.google.com with SMTP id y135so386665wmc.1 + for ; + Mon, 14 Oct 2019 09:33:23 -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:mime-version + :content-transfer-encoding; + bh=yuEdphuMWOUGDahWSE97oqgmOlObKgpyvQgzFU8TRQU=; + b=THTDXG/3mOeZtb6dOK6qrH1eQvV7z52+jijnE+ULOhMbPReKZiIPTLCR3+W7HnWIkL + RFmtL80kGqOr/FynSqFtzLiwv4TaClqwXnVtULNnpITi/cHhy+AnvWVfQCDZ1THjSHSh + pduFTV40hbsfQR4K3wm6K4LGLOnaAkS193JT28eOdR7oOcCjbZSKoQKTYCquWrAWTeIo + oQAUnFNuy4gdBy+94VmzR0AdgNrDXTc5KPDYLaOTSBxZUJQ8+7pDFhxOxm06B6gNgPEp + fzYcPcRV2R9hc6PtL8jxMKRNQ3PcJnas8KU2DsmaK/FJZxgtzXs97TaHydGKq33TYgst + Mpow== +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:mime-version + :content-transfer-encoding; + bh=yuEdphuMWOUGDahWSE97oqgmOlObKgpyvQgzFU8TRQU=; + b=PJHaADcio6H7WwVXfMpYGT2fr/FMtU5GUUbNeD+td9rfpid6nfbHrh2TCAQtpxAMaS + B63nd+HNchQoPhWWHWMMx8gbY9KwOKzc5/FO5wqeDo5gbpI/eWidH+ieGLaxozX/Aqku + BLTdsnGMIB+FxmFCmtaY1y9wuqdVmS/4RiobjBycBZmXBYOYxZc3I81zM1u+nBjRKsNZ + h2D/gN8sjkRbT4f5kU/xpHbh+8CbpVp4ze5cpKOf35Iwf+ASNw/l53NHft0Y41ehG2NA + YFsdBpquso+CNhTGqN5VOBlpGdMFRJ4SIseygRQbXVT4KEeZBP60so7Ed8MwxoXmG6sw + gM5w== +X-Gm-Message-State: APjAAAUc9u8vjoe8La6L5Z/DMvnvVKz828SBRtfClkhDufJCaEZaQ1S9 + nO3+g66C+iOliANLi0dTY/L7SkabogZiQQ== +X-Google-Smtp-Source: + APXvYqz0XzN3uY3m31zQi76ZEDZQMtYggJ6COqe0WCePJ5GuE+rYLNtFHVBakYmvlBvQjlPYRU+lrg== +X-Received: by 2002:a1c:a516:: with SMTP id + o22mr16781400wme.116.1571070801893; + Mon, 14 Oct 2019 09:33:21 -0700 (PDT) +Received: from localhost.localdomain + (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) + by smtp.gmail.com with ESMTPSA id o70sm25785240wme.29.2019.10.14.09.33.20 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 14 Oct 2019 09:33:21 -0700 (PDT) +From: Ard Biesheuvel +To: linux-arm-kernel@lists.infradead.org +Subject: [PATCH] efi: libstub/arm: account for firmware reserved memory at the + base of RAM +Date: Mon, 14 Oct 2019 18:33:09 +0200 +Message-Id: <20191014163309.2860-1-ard.biesheuvel@linaro.org> +X-Mailer: git-send-email 2.20.1 +MIME-Version: 1.0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20191014_093323_781941_B57BEE97 +X-CRM114-Status: GOOD ( 13.99 ) +X-Spam-Score: -0.2 (/) +X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: + Content analysis details: (-0.2 points) + pts rule name description + ---- ---------------------- + -------------------------------------------------- + -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, + no trust [2a00:1450:4864:20:0:0:0:341 listed in] + [list.dnswl.org] + 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record + -0.0 SPF_PASS SPF: sender matches SPF record + -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from + author's domain + 0.1 DKIM_SIGNED Message has a DKIM or DK signature, + not necessarily + valid + -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from + envelope-from domain + -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: Chester Lin , Guillaume Gardet , + linux-efi@vger.kernel.org, Ard Biesheuvel +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org + +The EFI stubloader for ARM starts out by allocating a 32 MB window +at the base of RAM, in order to ensure that the decompressor (which +blindly copies the uncompressed kernel into that window) does not +overwrite other allocations that are made while running in the context +of the EFI firmware. + +In some cases, (e.g., U-Boot running on the Raspberry Pi 2), this is +causing boot failures because this initial allocation conflicts with +a page of reserved memory at the base of RAM that contains the SMP spin +tables and other pieces of firmware data and which was put there by +the bootloader under the assumption that the TEXT_OFFSET window right +below the kernel is only used partially during early boot, and will be +left alone once the memory reservations are processed and taken into +account. + +So let's permit reserved memory regions to exist in the region starting +at the base of RAM, and ending at TEXT_OFFSET - 5 * PAGE_SIZE, which is +the window below the kernel that is not touched by the early boot code. + +Cc: Guillaume Gardet +Cc: Chester Lin +Signed-off-by: Ard Biesheuvel +--- + drivers/firmware/efi/libstub/Makefile | 1 + + drivers/firmware/efi/libstub/arm32-stub.c | 16 +++++++++++++--- + 2 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile +index 0460c7581220..ee0661ddb25b 100644 +--- a/drivers/firmware/efi/libstub/Makefile ++++ b/drivers/firmware/efi/libstub/Makefile +@@ -52,6 +52,7 @@ lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \ + + lib-$(CONFIG_ARM) += arm32-stub.o + lib-$(CONFIG_ARM64) += arm64-stub.o ++CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) + CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) + + # +diff --git a/drivers/firmware/efi/libstub/arm32-stub.c b/drivers/firmware/efi/libstub/arm32-stub.c +index e8f7aefb6813..47aafeff3e01 100644 +--- a/drivers/firmware/efi/libstub/arm32-stub.c ++++ b/drivers/firmware/efi/libstub/arm32-stub.c +@@ -195,6 +195,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table, + unsigned long dram_base, + efi_loaded_image_t *image) + { ++ unsigned long kernel_base; + efi_status_t status; + + /* +@@ -204,9 +205,18 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table, + * loaded. These assumptions are made by the decompressor, + * before any memory map is available. + */ +- dram_base = round_up(dram_base, SZ_128M); ++ kernel_base = round_up(dram_base, SZ_128M); + +- status = reserve_kernel_base(sys_table, dram_base, reserve_addr, ++ /* ++ * Note that some platforms (notably, the Raspberry Pi 2) put ++ * spin-tables and other pieces of firmware at the base of RAM, ++ * abusing the fact that the window of TEXT_OFFSET bytes at the ++ * base of the kernel image is only partially used at the moment. ++ * (Up to 5 pages are used for the swapper page table) ++ */ ++ kernel_base += TEXT_OFFSET - 5 * PAGE_SIZE; ++ ++ status = reserve_kernel_base(sys_table, kernel_base, reserve_addr, + reserve_size); + if (status != EFI_SUCCESS) { + pr_efi_err(sys_table, "Unable to allocate memory for uncompressed kernel.\n"); +@@ -220,7 +230,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table, + *image_size = image->image_size; + status = efi_relocate_kernel(sys_table, image_addr, *image_size, + *image_size, +- dram_base + MAX_UNCOMP_KERNEL_SIZE, 0); ++ kernel_base + MAX_UNCOMP_KERNEL_SIZE, 0); + if (status != EFI_SUCCESS) { + pr_efi_err(sys_table, "Failed to relocate kernel.\n"); + efi_free(sys_table, *reserve_size, *reserve_addr); diff --git a/kernel.spec b/kernel.spec index 508032ab3..1bcc774f2 100644 --- a/kernel.spec +++ b/kernel.spec @@ -526,9 +526,6 @@ Patch304: usb-phy-tegra-Add-38.4MHz-clock-table-entry.patch # http://patchwork.ozlabs.org/patch/587554/ Patch305: ARM-tegra-usb-no-reset.patch -# https://patchwork.kernel.org/project/linux-mmc/list/?submitter=71861 -Patch306: arm-sdhci-esdhc-imx-fixes.patch - # https://patchwork.kernel.org/patch/11173461/ Patch307: arm64-dts-rockchip-fix-RockPro64-vdd-log-regulator-settings.patch # https://patchwork.kernel.org/patch/11155461/ @@ -545,6 +542,9 @@ Patch323: gpio-max77620-Use-correct-unit-for-debounce-times.patch # https://www.spinics.net/lists/linux-tegra/msg44216.html Patch324: arm64-tegra186-enable-USB-on-Jetson-TX2.patch +# https://www.spinics.net/lists/arm-kernel/msg761152.html +Patch342: efi-libstub-arm-account-for-firmware-reserved-memory-at-the-base-of-RAM.patch + # 400 - IBM (ppc/s390x) patches # 500 - Temp fixes/CVEs etc @@ -562,6 +562,11 @@ Patch503: KEYS-Make-use-of-platform-keyring-for-module-signature.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1756655 Patch504: 0001-mm-kmemleak-skip-late_init-if-not-skip-disable.patch +# it seems CONFIG_OPTIMIZE_INLINING has been forced now and is causing issues on ARMv7 +# https://lore.kernel.org/patchwork/patch/1132459/ +# https://lkml.org/lkml/2019/8/29/1772 +Patch505: ARM-fix-__get_user_check-in-case-uaccess_-calls-are-not-inlined.patch + # END OF PATCH DEFINITIONS %endif