From patchwork Wed Dec 22 18:15:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697194 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EF8F3C433EF for ; Wed, 22 Dec 2021 18:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=g1YGCTbOiFXgWFkUEMTMEfa2GB7gfoqJvyV719ozIas=; b=Y+caOlciTKMdVW NM17SPuoeYrxt+3Ank68ilUX2nqqhl2B0IGNdEMo367beSOxLCxBlU6YgAiCgrhbnGjvxBz9pjRrX ydNId9Hux4kMAjJVQVKWxiqMun0GCBGsAhGhqgY93QyPjT3WrTfc8S8tJtAudFtutsGH/q/nyHzHu JNGI37cOGDap0F/losSeWPOLyrTaY3tvWusCjLzTu/JjCZ7tR3BZDi/HOPdmHA74JFwrqs+5ZF+9b rUQgy9qX7hC5jIo+fiL5Ch8qULxptIwCAEFjECRGrj0uK/vb4KPRWIM6vehW2b15FUSVdc11iLNhX nmnI9hobvGla4OXesYyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06A1-00B3a0-KA; Wed, 22 Dec 2021 18:16:21 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n069x-00B3Yj-Pf for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:19 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F343106F; Wed, 22 Dec 2021 10:16:17 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8FBE63F5A1; Wed, 22 Dec 2021 10:16:16 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 1/9] Makefile: Avoid .got section creation Date: Wed, 22 Dec 2021 18:15:59 +0000 Message-Id: <20211222181607.1203191-2-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101617_896941_F95DD09D X-CRM114-Status: GOOD ( 12.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org At the moment we build the boot-wrapper with the default toolchain settings, which has issues if that is a toolchain targeted to Linux userland, for instance. Since boot-wrapper is rather simple, we get away with this, *mostly*, but there is at least one case where this breaks: Many distributions enable PIE builds by default when building GCC, so by just calling "gcc" we build the .o files for PIE (although we don't link them accordingly, since we use "ld" directly). When we moved the PSCI code from assembly to C, we also introduced global variables, which a PIE enabled GCC will put into a .got section (global offset table), to be able to easily relocate them at runtime (if needed). This section happens to be outside of the memory region we reserve, so can (and will be) overwritten by Linux at some point. Doing PSCI calls afterwards does not end well then. "memtest=1" is one way to trigger this. To avoid the (in our case pointless) creation of the GOT, we specify -fno-pic and -fno-pie, to override any potential toolchain default. This fixes boot-wrapper builds on many distro compilers, for instance as provided by Ubuntu and Arch Linux. Signed-off-by: Andre Przywara --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index d0a68df..3e970a3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -126,6 +126,7 @@ CPPFLAGS += $(INITRD_FLAGS) CFLAGS += -I$(top_srcdir)/include/ -I$(top_srcdir)/$(ARCH_SRC)/include/ CFLAGS += -Wall -fomit-frame-pointer CFLAGS += -ffunction-sections -fdata-sections +CFLAGS += -fno-pic -fno-pie LDFLAGS += --gc-sections OBJ := $(addprefix $(ARCH_SRC),$(ARCH_OBJ)) $(addprefix $(COMMON_SRC),$(COMMON_OBJ)) From patchwork Wed Dec 22 18:16:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697196 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 117F2C433F5 for ; Wed, 22 Dec 2021 18:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VWcqIoWOLSrqNS+hAfjnSOZPEQqd3xJJimnrNT0uBaw=; b=XhoTbL+8tOUky+ EPZy6VfnAW/mY96McC0rRTM7xlW4U/ZJXZc8tF8H84cQR3QjomKdtrMgovCHmMgZuBXREJQ8/iQcx 7xkbGIiwgvoYmjJePqraDUoP3ze929727Ur7KKKNtYz1Af6Wz6WjqTlYyFCkqaN4KUrkHTFuhFiE8 0Bsgl/OQWUXPS6WTIbcrSCa9OvnKK3EpZItpzKobp08jVDok9S0Ahai/9uE10QNm8Ec1p5wr0tGeJ gCmDZJanHoR2p0ByFHkdK6hc6qqF6a+r/UJ3OfZ7ARTdi7IGG9gDTuneBS0sZV4Jmy7833V5F72Da LE2IwYBpgvK89Jqjt6+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06AR-00B3iR-6E; Wed, 22 Dec 2021 18:16:47 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n069z-00B3Z9-3C for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:20 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 21F80113E; Wed, 22 Dec 2021 10:16:18 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 728043F5A1; Wed, 22 Dec 2021 10:16:17 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 2/9] Add standard headers Date: Wed, 22 Dec 2021 18:16:00 +0000 Message-Id: <20211222181607.1203191-3-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101619_201178_AB509A9E X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org So far we were relying on some standard C headers to be provided by the toolchain. This applies for instance to stddef.h and stdint.h. As a "bare-metal" application, we should not rely on external headers, or even on a toolchain providing them in the first place. Define our own version of stddef.h and stdint.h, containing just the types that we actually need. Signed-off-by: Andre Przywara --- arch/aarch32/include/stdint.h | 19 +++++++++++++++++++ arch/aarch64/include/stdint.h | 19 +++++++++++++++++++ include/stddef.h | 15 +++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 arch/aarch32/include/stdint.h create mode 100644 arch/aarch64/include/stdint.h create mode 100644 include/stddef.h diff --git a/arch/aarch32/include/stdint.h b/arch/aarch32/include/stdint.h new file mode 100644 index 0000000..77546f0 --- /dev/null +++ b/arch/aarch32/include/stdint.h @@ -0,0 +1,19 @@ +/* + * arch/aarch32/include/stdint.h + * + * Copyright (C) 2021 ARM Limited. All rights reserved. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE.txt file. + */ +#ifndef STDINT_H__ +#define STDINT_H__ + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; + +typedef unsigned int uintptr_t; + +#endif diff --git a/arch/aarch64/include/stdint.h b/arch/aarch64/include/stdint.h new file mode 100644 index 0000000..92c2603 --- /dev/null +++ b/arch/aarch64/include/stdint.h @@ -0,0 +1,19 @@ +/* + * arch/aarch64/include/stdint.h + * + * Copyright (C) 2021 ARM Limited. All rights reserved. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE.txt file. + */ +#ifndef STDINT_H__ +#define STDINT_H__ + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; + +typedef unsigned long int uintptr_t; + +#endif diff --git a/include/stddef.h b/include/stddef.h new file mode 100644 index 0000000..3208b10 --- /dev/null +++ b/include/stddef.h @@ -0,0 +1,15 @@ +/* + * include/stddef.h - standard data type definitions + * + * Copyright (C) 2021 ARM Limited. All rights reserved. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE.txt file. + */ +#ifndef STDDEF_H__ +#define STDDEF_H__ + +typedef unsigned long int size_t; +typedef signed long int ssize_t; + +#endif From patchwork Wed Dec 22 18:16:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0F5A7C433F5 for ; Wed, 22 Dec 2021 18:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0R2y0VxfnW7rs962o823jX/5CjxTeixhIbfUf7TL1+c=; b=IfEGKzZfvW+nzH 4IBBgSCPyqxZn75IAOJr0ZtYcY7/u+yEUK4eNq0uqNP+30HsnbuEzIP7B7Q9VWjdG4m1ShxCNRVim jgIFmMwnhlfTnRzeq0xDJu8vqVMk8GCC/KD7ilNTPxl74R+KSGLcvqeM2bLrgdXXIua+VusxBP9n8 q5DcgLxG0AoxI8gfHEyx3SmfJXHxg3RnhGPLoVI5CGNhsPtUSGgm5fmmqdeOGMTXZK7QQ2RwMFNU7 3mZoBfipr903ndSRxG98uMX58Xk8KcJwj6T5wt8x9Mb6HQXobHagWW2U+QZgQ8pXClPowv+B+Hu6Q Be+/iVzbIx5PBlBQhTgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06Aj-00B3nq-Fk; Wed, 22 Dec 2021 18:17:05 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n069z-00B3ZX-OS for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 045BA11B3; Wed, 22 Dec 2021 10:16:19 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 54AD33F5A1; Wed, 22 Dec 2021 10:16:18 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 3/9] Makefile: Tell compiler to generate bare-metal code Date: Wed, 22 Dec 2021 18:16:01 +0000 Message-Id: <20211222181607.1203191-4-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101619_859614_5AF392C4 X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Our GCC invocation does not provide many parameters, which lets the toolchain fill in its own default setup. In case of a native build or when using a full-featured cross-compiler, this probably means Linux userland, which is not what we want for a bare-metal application like boot-wrapper. Tell the compiler to forget about those standard settings, and only use what we explicitly ask for. In particular that means to not use toolchain provided libraries and headers, since they might pull in more code than we want, and might not run well in the boot-wrapper environment. This also enables optimisation, since it produces much better code and tends to avoid problems due to missing inlining, for instance. Signed-off-by: Andre Przywara --- Makefile.am | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3e970a3..d9ad6d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -124,9 +124,14 @@ CHOSEN_NODE := chosen { \ CPPFLAGS += $(INITRD_FLAGS) CFLAGS += -I$(top_srcdir)/include/ -I$(top_srcdir)/$(ARCH_SRC)/include/ -CFLAGS += -Wall -fomit-frame-pointer +CFLAGS += -Wall -Wstrict-prototypes -fomit-frame-pointer +CFLAGS += -ffreestanding -nostdinc -nostdlib +CFLAGS += -fno-common -fno-strict-aliasing -fno-stack-protector +CFLAGS += -fno-toplevel-reorder +CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -fno-pic -fno-pie +CFLAGS += -Os LDFLAGS += --gc-sections OBJ := $(addprefix $(ARCH_SRC),$(ARCH_OBJ)) $(addprefix $(COMMON_SRC),$(COMMON_OBJ)) From patchwork Wed Dec 22 18:16:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697198 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 811FFC433EF for ; Wed, 22 Dec 2021 18:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AlMoORQmjBsBiVmA5LlMrd6mAeRXzkbcmSoJkRVeyOM=; b=l5zlh2Et+SDQ7R jc+4iOki2akQHwVS7HGFXKhoeCZAveFFjP8PGplCHFYpQIL/SD/8HKdxrGK2x3dExw/aON6Q6Yuiz arAxESnRGlbN7bYQ0mNssMtBDne/DyxbW31NsFZqWR1z1AQXoDHVcBKXCXoZfiSa7UBI0ZQ7yZqe6 4EUJ87P5cM62wFpt8VDI/FehobhNecFxY4tmNLUY247KUkSZUh8Z2F3IV57v9SY+77gaYE2Cx5ofO 8/pHZBFsc4vUNI6d6g/sxDh6SoAKH+k6EczgFu+qalpQAEGEnqo+6UNP0kQ8cb73evkZiyFXliKmd v3DIWCsPH/+nWHGGPu+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06B1-00B3uR-IT; Wed, 22 Dec 2021 18:17:23 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06A0-00B3Zu-Lu for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB18A106F; Wed, 22 Dec 2021 10:16:19 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 370943F5A1; Wed, 22 Dec 2021 10:16:19 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 4/9] configure: Make PSCI the default boot method Date: Wed, 22 Dec 2021 18:16:02 +0000 Message-Id: <20211222181607.1203191-5-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101620_789746_6E846E46 X-CRM114-Status: GOOD ( 10.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When the boot-wrapper was originally conceived, PSCI was a rather new feature, so support in contemporary kernels wasn't guaranteed. The boot-wrapper consequently defaulted to not using PSCI. Fortunately the times have changed, and most people expect PSCI these days, so let's enable PSCI by default. We keep the --enable-psci/--disable-psci configure switch, so it can be still turned off if needed. Signed-off-by: Andre Przywara --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6914eb4..852fd9a 100644 --- a/configure.ac +++ b/configure.ac @@ -82,8 +82,8 @@ AS_IF([test "x$X_IMAGE" != "x"], # Allow a user to pass --enable-psci AC_ARG_ENABLE([psci], - AS_HELP_STRING([--enable-psci], [enable the psci boot method]), - [USE_PSCI=$enableval]) + AS_HELP_STRING([--disable-psci], [disable the psci boot method]), + [USE_PSCI=$enableval], [USE_PSCI="yes"]) AM_CONDITIONAL([PSCI], [test "x$USE_PSCI" = "xyes"]) AS_IF([test "x$USE_PSCI" = "xyes"], [], [USE_PSCI=no]) From patchwork Wed Dec 22 18:16:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F32ABC433FE for ; Wed, 22 Dec 2021 18:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ed5GvK9f1sWX4ao04CR1GL+z0dCKssSGSCy5dCjMrW4=; b=q7jPShN5wiNg3D qTUV5CaZvxSlCWgiFi8UbcovXOQgB9CzaTigxALFVo5vSO9+ATsfI/doAw0YqUZ+HLlM1CA2No42O ZjjJKOqHbnWiFd5ObrES6/6whywHDVrBSUMHBx6TITr14OJg2RE/DqxTwbde5Xj+aykTgF1c6QRVh w2NAZn01+v13CcuPrKBLZNBd3H771V1WxzBWQFo5Q7EiuojjK1Dm9eE1vp1fUtRCmpaiFw9pPeGD/ HkGr01i9WhKZDUfpOyzu/trpi3NR8B/cUjHoFjrz+5yJsC7hbPGnfOr+L8Zvie+hQXfHommO0Zh23 G14Aue4t2DJtKavAIvjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06BK-00B43t-1v; Wed, 22 Dec 2021 18:17:42 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06A1-00B3aT-Kj for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD23C1FB; Wed, 22 Dec 2021 10:16:20 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 194703F5A1; Wed, 22 Dec 2021 10:16:19 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 5/9] configure: Fix default DTB Date: Wed, 22 Dec 2021 18:16:03 +0000 Message-Id: <20211222181607.1203191-6-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101621_748537_31982CD9 X-CRM114-Status: GOOD ( 11.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The DTS files for Arm Ltd. boards and the fastmodel have long been moved into the arm/ subdirectory of the arm64 kernel tree's DT folder. Adjust the default path to make this build out of the box. Also change the default DTB to the more modern FVP RevC model on the way. Signed-off-by: Andre Przywara --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 852fd9a..2b295de 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,7 @@ AC_ARG_WITH([kernel-dir], AS_IF([test "x$KERNEL_ES" = x32], [KERN_IMAGE=$KERN_DIR/arch/arm/boot/zImage], [KERN_IMAGE=$KERN_DIR/arch/arm64/boot/Image]) -KERN_DTB=$KERN_DIR/arch/arm64/boot/dts/rtsm_ve-aemv8a.dtb +KERN_DTB=$KERN_DIR/arch/arm64/boot/dts/arm/fvp-base-revc.dtb # Allow the user to override the default DTB AC_ARG_WITH([dtb], From patchwork Wed Dec 22 18:16:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697200 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 48D0AC4332F for ; Wed, 22 Dec 2021 18:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Rs6a+VMjSgJcpbOIQTfRdFOQjaSVax8CCxlbTKdpnHc=; b=ySXGAMtBp1EHUa wkvkvHvrLwgGsaMhoF51q10lKWmykq3kTdeODWTDWo95U5uexs2t3wi+yAppcvglY048GHID0Ytjd D0DrBkJ7tSnv9711+u5YchChIQu6WFGR/Glzlk3dizPQMbLqezsmeORJ/DTOCSSlTZx+q+Q8/Ej0j 2o3/2wOcmmxGftiRJWLsuxXkxLEjKw7+14uTkMpG9i+4l6pR/2SSK+LZjWGl2nT9mBR6HDsvzyMsN iJ7osjtMhH+NyVJuGTCzjL6cL83xjuXN/9INiDyVynaeJAeTpXwpf/rciHfGrOhqmFHN0WPOmuV/6 6V/88tCppB4FDz/0tkpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06BZ-00B4Bn-9g; Wed, 22 Dec 2021 18:17:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06A2-00B3as-A7 for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F4DA113E; Wed, 22 Dec 2021 10:16:21 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EFC113F5A1; Wed, 22 Dec 2021 10:16:20 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 6/9] configure: Use earlycon instead of earlyprintk Date: Wed, 22 Dec 2021 18:16:04 +0000 Message-Id: <20211222181607.1203191-7-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101622_436092_1A5AE0BF X-CRM114-Status: GOOD ( 12.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The arm64 Linux kernel dropped support for the "earlyprintk" command line parameter a long time ago[1], instead it uses the earlycon parameter now. Replace earlyprintk with earlycon on the default command line, to see early kernel output. Ideally we would just say "earlycon" (without specifying an MMIO address), but this relies on the stdout-path property in the /chosen node, which the model DTs do not carry. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8ef0ed95ee04 Signed-off-by: Andre Przywara --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2b295de..9e3b722 100644 --- a/configure.ac +++ b/configure.ac @@ -99,7 +99,7 @@ AC_SUBST([FILESYSTEM], [$USE_INITRD]) AM_CONDITIONAL([INITRD], [test "x$USE_INITRD" != "x"]) AS_IF([test "x$X_IMAGE" = "x"],[C_CONSOLE="ttyAMA0"],[C_CONSOLE="hvc0"]) -C_CMDLINE="console=$C_CONSOLE earlyprintk=pl011,0x1c090000" +C_CMDLINE="console=$C_CONSOLE earlycon=pl011,0x1c090000" AC_ARG_WITH([cmdline], AS_HELP_STRING([--with-cmdline], [set a command line for the kernel]), [C_CMDLINE=$withval]) From patchwork Wed Dec 22 18:16:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AA577C433EF for ; Wed, 22 Dec 2021 18:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Qp9hNTort4kmVXQQ/DX8CisUkUathetP59FxEExFZ8Y=; b=j/dhtKLfsOZKx/ NtTDx0sn7U11itGQEC4RXOHeKdVoIGSoGshcV3oSIXsFaZKXRIPgBaaxVbUCsDUb5tjafba7xp+ZV WDp5+7+abHJAOGHTFe80vZBwOIVWitGbzrBCnnNu7Id7lSoAzyqY9+I9uouRqF52Hvs/uTRbXlHSE VDcERAP5f0pURN7040ZrMpkcgVe5oOiWNrPyW+kTaB3FtUQL+JUJ1H9VG03FAHGzACj9CscC1F2RY AiGisufqK3rOlFaAI0AR/pGf0+fIeGNbnbKCENV503mo7aWvRbunX+n5R5MG/CftbD09c175cPcmg 9LnYp++EDflnOdm6AARw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06Bq-00B4MG-FN; Wed, 22 Dec 2021 18:18:14 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06A2-00B3Zu-TG for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:24 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8163E106F; Wed, 22 Dec 2021 10:16:22 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D1F233F5A1; Wed, 22 Dec 2021 10:16:21 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 7/9] pointer auth: Document CPU feature bit mask Date: Wed, 22 Dec 2021 18:16:05 +0000 Message-Id: <20211222181607.1203191-8-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101623_019181_3FC810E8 X-CRM114-Status: UNSURE ( 9.44 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When checking for the pointer authentication feature, we actually look for *four* different CPUID feature sets. Add a comment to make it more obvious that the 0xff is not a typo. Signed-off-by: Andre Przywara --- arch/aarch64/boot.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/aarch64/boot.S b/arch/aarch64/boot.S index bfbb6ec..27ba449 100644 --- a/arch/aarch64/boot.S +++ b/arch/aarch64/boot.S @@ -38,7 +38,8 @@ ASM_FUNC(_start) /* Enable pointer authentication if present */ mrs x1, id_aa64isar1_el1 - ldr x2, =(((0xff) << 24) | (0xff << 4)) + /* We check for APA+API and GPA+GPI */ + ldr x2, =((0xff << 24) | (0xff << 4)) and x1, x1, x2 cbz x1, 1f From patchwork Wed Dec 22 18:16:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697202 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CC6B5C433F5 for ; Wed, 22 Dec 2021 18:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ETnpsqnq1RBmw3clNl3lty3BMRcOnlp8AXoEgLFGlj0=; b=lQ077KGi8Ib4RP oJjv8pjnH6SSEZ4PahZsQMqPLLJst55G5zDpSdImJXZDIU+uIGUr68lS4tJ3o6/EgSPJTlVPUizkZ QEGvV/1qjLbnFjK/SxnRR1HUCTLdtrzKgT18oj4ew/MMZo9tmNMlk4S5z9ZoROCeAm4sxtOBgubWl 0QmAiSkk7jCZ7mi+GnZQkv+lT8L719jvO2eKLY/dHcHJ82Z6p7qfVXCvowVu/D1NIBnn7UohPfJTk 4kUsYR8eZ29vCft0KoCWSq+AL8HOcOWaWhp0IPzoLEL/37sPeNKUwncqPJtPe4Zo4KkPFJTKrOIo6 AyjUF9QroPw+sENuHQ1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06CA-00B4XB-R4; Wed, 22 Dec 2021 18:18:35 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06A3-00B3aT-PH for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:25 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 636461FB; Wed, 22 Dec 2021 10:16:23 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B400E3F5A1; Wed, 22 Dec 2021 10:16:22 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 8/9] configure: Autodetect GICv3 Date: Wed, 22 Dec 2021 18:16:06 +0000 Message-Id: <20211222181607.1203191-9-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101623_967132_94025BC2 X-CRM114-Status: GOOD ( 11.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently the user has to specify the GIC architecture version (v2 or v3) on the ./configure command line, even though this is actually redundant information, since the DTB can carry only one GIC type. Unconditionally query for the two GIC compatible strings in the provided DTB, then choose the GIC type automatically depending on which string is found. This saves the user from specifying the GIC type on the configure command line, and avoids errors when the wrong type was accidentally named. Signed-off-by: Andre Przywara --- Makefile.am | 23 +++++++++-------------- configure.ac | 8 -------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/Makefile.am b/Makefile.am index d9ad6d1..3d8128f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,19 +63,14 @@ PSCI_NODE := CPU_NODES := endif -if GICV3 -GIC_DIST_BASE := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,gic-v3') -GIC_RDIST_BASE := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 1 'arm,gic-v3') -DEFINES += -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DEFINES += -DGIC_RDIST_BASE=$(GIC_RDIST_BASE) -COMMON_OBJ += gic-v3.o -else -GIC_DIST_BASE := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,cortex-a15-gic') -GIC_CPU_BASE := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 1 'arm,cortex-a15-gic') -DEFINES += -DGIC_CPU_BASE=$(GIC_CPU_BASE) -DEFINES += -DGIC_DIST_BASE=$(GIC_DIST_BASE) -COMMON_OBJ += gic.o -endif +GICV3_DIST_BASE := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,gic-v3' 2> /dev/null) +GIC_RDIST_BASE := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 1 'arm,gic-v3' 2> /dev/null) +GICV2_DIST_BASE := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,cortex-a15-gic' 2> /dev/null) +GIC_CPU_BASE := $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 1 'arm,cortex-a15-gic' 2> /dev/null) +DEFINES += $(if $(GICV3_DIST_BASE), -DGIC_DIST_BASE=$(GICV3_DIST_BASE), -DGIC_DIST_BASE=$(GICV2_DIST_BASE)) +DEFINES += $(if $(GIC_RDIST_BASE), -DGIC_RDIST_BASE=$(GIC_RDIST_BASE), ) +DEFINES += $(if $(GIC_CPU_BASE), -DGIC_CPU_BASE=$(GIC_CPU_BASE), ) +GIC_OBJ := $(if $(GICV3_DIST_BASE), gic-v3.o, gic.o) if KERNEL_32 MBOX_OFFSET := 0x7ff8 @@ -134,7 +129,7 @@ CFLAGS += -fno-pic -fno-pie CFLAGS += -Os LDFLAGS += --gc-sections -OBJ := $(addprefix $(ARCH_SRC),$(ARCH_OBJ)) $(addprefix $(COMMON_SRC),$(COMMON_OBJ)) +OBJ := $(addprefix $(ARCH_SRC),$(ARCH_OBJ)) $(addprefix $(COMMON_SRC),$(COMMON_OBJ)) $(addprefix $(COMMON_SRC),$(GIC_OBJ)) # Don't lookup all prerequisites in $(top_srcdir), only the source files. When # building outside the source tree $(ARCH_SRC) needs to be created. diff --git a/configure.ac b/configure.ac index 9e3b722..ed3e094 100644 --- a/configure.ac +++ b/configure.ac @@ -111,13 +111,6 @@ AC_ARG_WITH([xen-cmdline], [X_CMDLINE=$withval]) AC_SUBST([XEN_CMDLINE], [$X_CMDLINE]) -# Allow a user to pass --enable-gicv3 -AC_ARG_ENABLE([gicv3], - AS_HELP_STRING([--enable-gicv3], [enable GICv3 instead of GICv2]), - [USE_GICV3=$enableval]) -AM_CONDITIONAL([GICV3], [test "x$USE_GICV3" = "xyes"]) -AS_IF([test "x$USE_GICV3" = "xyes"], [], [USE_GICV3=no]) - # Ensure that we have all the needed programs AC_PROG_CC AC_PROG_CPP @@ -144,7 +137,6 @@ echo " Device tree blob: ${KERN_DTB}" echo " Linux kernel command line: ${CMDLINE}" echo " Embedded initrd: ${FILESYSTEM:-NONE}" echo " Use PSCI? ${USE_PSCI}" -echo " Use GICv3? ${USE_GICV3}" echo " Boot-wrapper execution state: AArch${BOOTWRAPPER_ES}" echo " Kernel execution state: AArch${KERNEL_ES}" echo " Xen image ${XEN_IMAGE:-NONE}" From patchwork Wed Dec 22 18:16:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 12697203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4D1C6C433EF for ; Wed, 22 Dec 2021 18:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BnaGXKa7A6vX1EEiaaekaiuKTAOXAPVRvUfVvvseFto=; b=EZJSS0g/zqtfA/ Wu9bbxlyyylq9JCzHKdDrJRU81Re3GzonRL2vgcxhPaaTy+gRKl6+9OL6Ac0PXAiuIh5CTZ2lvWsK MV4pliFZUMJuGVxnZJyQcmUp5ZcdUbFQGvtkMSmG8P4BceXD/xwiiLt3Df+zhMmwXOklvEGvexwTk +DRnvYW1MpFCDWEPU1qqz1dwhvGYX/gP/L4YTvf9rR0PVOTJFQhsLBfrDUqdml/ocqNjxgBcXclNY IfQ1kZJluGWbYjMRgh82Jnzwy6LpDAvWAScGcPEP7k4VQVlXZvup+zVIELbFrKL6hiokhDudLoFsU HG5UQyiAqTR9+/bsKJGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06CV-00B4k6-T0; Wed, 22 Dec 2021 18:18:56 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06A4-00B3as-Q2 for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:26 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45933113E; Wed, 22 Dec 2021 10:16:24 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 963663F5A1; Wed, 22 Dec 2021 10:16:23 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 9/9] avoid dtc warnings on re-compiling DTB Date: Wed, 22 Dec 2021 18:16:07 +0000 Message-Id: <20211222181607.1203191-10-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101624_928003_6D118B85 X-CRM114-Status: GOOD ( 13.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When we add the PSCI nodes to the provided DTB, we use dtc to de-compile the blob first, then re-compile it with our nodes and properties added. In our input DTB the proper phandle references have already been lost, all we see in the DTB is phandle properties in the target node, and some numbers in the clocks and gpios properties: =========== clk24mhz { compatible = "fixed-clock"; #clock-cells = <0x00>; clock-frequency = <0x16e3600>; clock-output-names = "v2m:clk24mhz"; -> phandle = <0x05>; }; ... serial@90000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x90000 0x1000>; interrupts = <0x05>; -> clocks = <0x05 0x05>; clock-names = "uartclk", "apb_pclk"; }; =========== dtc warns that those numbers might be wrong: ========= :177.6-27: Warning (clocks_property): /bus@8000000/motherboard-bus@8000000/iofpga-bus@300000000/serial@90000: clocks: cell 0 is not a phandle reference .... ========= The proper solution would be to use references (&v2m_clk24mhz) instead, as there are in the source .dts file, but we don't have that information anymore, and cannot easily recover it. To avoid the lengthy list of warnings, just drop those checks from the dtc compilation run. This disables more checks than we want or need, but we somewhat trust in the original DTB to be sane, so that should be fine. Signed-off-by: Andre Przywara --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3d8128f..430b4a9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -160,7 +160,7 @@ model.lds: $(LD_SCRIPT) Makefile $(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) $(XEN) -DXEN_OFFSET=$(XEN_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -DTEXT_LIMIT=$(TEXT_LIMIT) -P -C -o $@ $< fdt.dtb: $(KERNEL_DTB) Makefile - ( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) }; $(CPU_NODES)" ) | $(DTC) -O dtb -o $@ - + ( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) }; $(CPU_NODES)" ) | $(DTC) -O dtb -o $@ -Wno-clocks_property -Wno-gpios_property - # The filesystem archive might not exist if INITRD is not being used .PHONY: all clean $(FILESYSTEM)