From patchwork Thu May 14 12:38:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 1290275 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.a=rsa-sha256 header.s=mail2016061301 header.b=Va0Kfpd1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49NB285s4kz9sPF for ; Thu, 14 May 2020 22:39:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 03A6B81F18; Thu, 14 May 2020 14:39:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.b="Va0Kfpd1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 77E6981EED; Thu, 14 May 2020 14:38:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F1E5281C73 for ; Thu, 14 May 2020 14:38:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@walle.cc Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 5993622F53; Thu, 14 May 2020 14:38:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1589459922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KbM3tkychVQ8woQgoTuZpXgAMSbShU3+qL+klyCD1ZE=; b=Va0Kfpd1m2kArijOmBqzv3DABYs8Ztqztu84UbR55GwcEPG32izgKe4epGeV8C+ltMV20G NYiqySu0xLkytZIZzcBWLHXrOdbj3iPDvR4Hs/KF5G6MWHEyE3DBiOsuSFy/jS9MvFuaIx bunocNJSJ7mBs2uwyrwAVTXa4oXNa20= From: Michael Walle To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Alexander Graf , Michael Walle Subject: [PATCH 1/4] efi_loader: aarch64: align runtime section to 64kb Date: Thu, 14 May 2020 14:38:28 +0200 Message-Id: <20200514123831.30157-2-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514123831.30157-1-michael@walle.cc> References: <20200514123831.30157-1-michael@walle.cc> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Commit 7a82c3051c8f ("efi_loader: Align runtime section to 64kb") already aligned the memory region to 64kb, but it does not align the actual efi runtime code. Thus it is likely, that efi_add_memory_map() actually adds a larger memory region than the efi runtime code really is, which is no error I guess. But what actually leads to an error is that there might be other efi_add_memory_map() calls with regions overlapping with the already registered efi runtime code section. Align the actual runtime code to 64kb instead. Fixes: 7a82c3051c8f ("efi_loader: Align runtime section to 64kb") Signed-off-by: Michael Walle --- arch/arm/cpu/armv8/u-boot.lds | 9 ++++++++- lib/efi_loader/efi_memory.c | 15 ++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds index 2554980595..3bc4675586 100644 --- a/arch/arm/cpu/armv8/u-boot.lds +++ b/arch/arm/cpu/armv8/u-boot.lds @@ -27,7 +27,14 @@ SECTIONS CPUDIR/start.o (.text*) } - /* This needs to come before *(.text*) */ + /* + * Runtime Services must be 64KiB aligned according to the + * "AArch64 Platforms" section in the UEFI spec (2.7+). + * + * This needs to come before *(.text*) + */ + + . = ALIGN(65536); .efi_runtime : { __efi_runtime_start = .; *(.text.efi_runtime*) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 97d90f069a..fd79178da9 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -12,7 +12,6 @@ #include #include #include -#include DECLARE_GLOBAL_DATA_PTR; @@ -734,7 +733,6 @@ __weak void efi_add_known_memory(void) static void add_u_boot_and_runtime(void) { unsigned long runtime_start, runtime_end, runtime_pages; - unsigned long runtime_mask = EFI_PAGE_MASK; unsigned long uboot_start, uboot_pages; unsigned long uboot_stack_size = 16 * 1024 * 1024; @@ -745,22 +743,13 @@ static void add_u_boot_and_runtime(void) uboot_start + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT; efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false); -#if defined(__aarch64__) - /* - * Runtime Services must be 64KiB aligned according to the - * "AArch64 Platforms" section in the UEFI spec (2.7+). - */ - - runtime_mask = SZ_64K - 1; -#endif - /* * Add Runtime Services. We mark surrounding boottime code as runtime as * well to fulfill the runtime alignment constraints but avoid padding. */ - runtime_start = (ulong)&__efi_runtime_start & ~runtime_mask; + runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK; runtime_end = (ulong)&__efi_runtime_stop; - runtime_end = (runtime_end + runtime_mask) & ~runtime_mask; + runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK; runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; efi_add_memory_map(runtime_start, runtime_pages, EFI_RUNTIME_SERVICES_CODE, false); From patchwork Thu May 14 12:38:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 1290274 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.a=rsa-sha256 header.s=mail2016061301 header.b=g9Mc0A3n; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49NB1m2f7bz9sPF for ; Thu, 14 May 2020 22:39:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3B74981F0B; Thu, 14 May 2020 14:38:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.b="g9Mc0A3n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 95F2A81C73; Thu, 14 May 2020 14:38:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 51C8381EB6 for ; Thu, 14 May 2020 14:38:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@walle.cc Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id C7E2122FE3; Thu, 14 May 2020 14:38:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1589459924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eVG4V3H/JjG090Gb6ehr3AOtINoMb8bwJ1+zDK+5s24=; b=g9Mc0A3nlJpkJw1QJSnhSJoV7qGQhDJ69EXPaeptL6gba4kGAEq19Frw2oBFcVl9QZJatv pnR3KyzCsDGYZ7BV6o2Oc0EbCzH2anJ+iqSxsllIcbc+LcGqhgLq7knYgKHswqZhgAnYb/ i/L39W03NkysjoTdjy1BFrK/7KNYFmw= From: Michael Walle To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Alexander Graf , Michael Walle Subject: [PATCH 2/4] efi_loader: check alignment in efi_add_memory_map() Date: Thu, 14 May 2020 14:38:29 +0200 Message-Id: <20200514123831.30157-3-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514123831.30157-1-michael@walle.cc> References: <20200514123831.30157-1-michael@walle.cc> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean The first argument has to be aligned with EFI_PAGE_SIZE. This alignment is already checked for external callers but it is not checked for internal callers. Unfortunately, most of the time the return value is not checked, so scream loud and clear. Signed-off-by: Michael Walle --- lib/efi_loader/efi_memory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index fd79178da9..b56e19cb30 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -248,6 +248,9 @@ efi_status_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type, EFI_PRINT("%s: 0x%llx 0x%llx %d %s\n", __func__, start, pages, memory_type, overlap_only_ram ? "yes" : "no"); + if (start & EFI_PAGE_MASK) + panic("%s: start not aligned\n", __func__); + if (memory_type >= EFI_MAX_MEMORY_TYPE) return EFI_INVALID_PARAMETER; From patchwork Thu May 14 12:38:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 1290273 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.a=rsa-sha256 header.s=mail2016061301 header.b=U/BOK8mq; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49NB1P4xlmz9sVC for ; Thu, 14 May 2020 22:39:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CB6D081C73; Thu, 14 May 2020 14:38:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.b="U/BOK8mq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 26A8A81F0B; Thu, 14 May 2020 14:38:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ACB6C81EED for ; Thu, 14 May 2020 14:38:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@walle.cc Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 13B1F22FF5; Thu, 14 May 2020 14:38:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1589459925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hVZosN2yrVMT1TFssu9DqZLqG75gZULAZbXnVlRh01g=; b=U/BOK8mqMx6Mc6PUXwdSSV5L57gwZhp8StvLX4PWO+96DwZxf29N1ovri++tmZbWf5CjAi /t5PHvAjvn7rPCWLPw4WMWVuANqBg20Mgj6ON/nAl/uHD5K7Qb2BUJIaiQN5AfbXFMf9K+ mIw7UEFBDRefa21LOWyptsBYL/3ChHk= From: Michael Walle To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Alexander Graf , Michael Walle Subject: [PATCH 3/4] fsl-layerscape: align first parameter of efi_add_memory_map() Date: Thu, 14 May 2020 14:38:30 +0200 Message-Id: <20200514123831.30157-4-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514123831.30157-1-michael@walle.cc> References: <20200514123831.30157-1-michael@walle.cc> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean The start parameter must be aligned to EFI_PAGE_SIZE. Fixes: 5a37a2f0140c ("armv8: ls2080a: Declare spin tables as reserved for efi loader") Signed-off-by: Michael Walle --- arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c index 3bbad827cb..fc65ad6c1e 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c @@ -146,7 +146,7 @@ remove_psci_node: fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code, *boot_code_size); #if CONFIG_IS_ENABLED(EFI_LOADER) - efi_add_memory_map((uintptr_t)&secondary_boot_code, + efi_add_memory_map(ALIGN_DOWN((uintptr_t)&secondary_boot_code, EFI_PAGE_SIZE), ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT, EFI_RESERVED_MEMORY_TYPE, false); #endif From patchwork Thu May 14 12:38:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 1290276 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.a=rsa-sha256 header.s=mail2016061301 header.b=CN2h+qqN; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49NB2N5fjdz9sPF for ; Thu, 14 May 2020 22:39:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E81F081F27; Thu, 14 May 2020 14:39:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.b="CN2h+qqN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A6AB81F00; Thu, 14 May 2020 14:38:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D40D38116F for ; Thu, 14 May 2020 14:38:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@walle.cc Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 507D92305A; Thu, 14 May 2020 14:38:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1589459925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YNW93IZNmFzAFtwcOkmeLA7U76qQK2UMV2IkrnDAmmo=; b=CN2h+qqNkb9XWWFY8iHwUJ5YRceRXjpnSd3hBfDQ7wgslOywe5Nxxz7k4KQKvSEBOcWtni 41Lx72HnVbcm1E2+tfuvlY6DqRDDWatmRmfChKEoLEOFumxvprPlqWG6Jri8Ga7N1TS3pU T4BjxKljKqhjFK5t9/owvW6EZflQyBE= From: Michael Walle To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Alexander Graf , Michael Walle Subject: [PATCH 4/4] efi_loader: call smp_kick_all_cpus() Date: Thu, 14 May 2020 14:38:31 +0200 Message-Id: <20200514123831.30157-5-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514123831.30157-1-michael@walle.cc> References: <20200514123831.30157-1-michael@walle.cc> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean On some architectures, specifically the layerscape, the secondary cores wait for an interrupt before entering the spin-tables. This applies only to boards which doesn't have PSCI provided by TF-a and u-boot does the secondary cores handling. bootm/booti already call that function for ARM architecture; also add it to bootelf before switching to EL2. Additionally, provide a weak noop function so we don't have to have "#ifdef CONFIG_ARM64" guards. Signed-off-by: Michael Walle --- common/bootm.c | 9 +++++++++ lib/efi_loader/efi_setup.c | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/common/bootm.c b/common/bootm.c index db4362a643..65adf29329 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -816,6 +816,15 @@ void __weak switch_to_non_secure_mode(void) { } +/** + * smp_kick_all_cpus() - kick all CPUs + * + * This routine is overridden by architectures requiring this feature. + */ +void __weak smp_kick_all_cpus(void) +{ +} + #else /* USE_HOSTCC */ #if defined(CONFIG_FIT_SIGNATURE) diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index 26a7423203..7e5364adc5 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -132,6 +132,12 @@ efi_status_t efi_init_obj_list(void) /* Allow unaligned memory access */ allow_unaligned(); + /* + * Some architectures need to kick secondary cores to enter their + * spin table. + */ + smp_kick_all_cpus(); + /* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */ switch_to_non_secure_mode();