From patchwork Fri May 21 10:47:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaxson Han X-Patchwork-Id: 12272901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5951C433ED for ; Fri, 21 May 2021 10:51:04 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 6969660FE3 for ; Fri, 21 May 2021 10:51:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6969660FE3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=VbPh7lPLEadSV6XYBRrUqhw8kBcIDu+J5j611pcJelA=; b=fdrI2HW04bTml5jmFHN37cVxc5 U63CCNDfyfuplgZxrnFqxwp7kcsxaNFfSa9+yZlFnyg3SRhVIYum0kflkfxDTZgqklj8M9PfIL6Al QLGLg/XZnVUFkGW3OsNR675JQK3Xbjpx2c9kBwWCwENOnrbWz+lUcmwRQ1+mI/74WFfelzRFTGnDO fxCnjbXJBDnJQWOSWGNu5O/j0gvkc3KF19PbHKHxkXfIg5TLTXudoFhF1ys1HFP3bxxJxUtU+kg1h v1p1kjejh9GBUUVTBFRA2LIf+jDI5LnYpdaVzVYwgod6rOunT6+uSIgLX0tdagbRdoWrqe39+rsqp qB2naPzw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk2hw-00509M-Jv; Fri, 21 May 2021 10:48:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk2hi-00505F-V4 for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 10:48:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=Ib24p0qU9DXvgr26MRBXCKeDzNbM+YXgmr+YEQgBktw=; b=HMR+34u50VaWa6dVkiVe8d2ggE 8CP1n4kbfwuUnqA2AveohcTp6q1aAXXyN9AY3jp5tL3a/Qi6wqw+arZtQChCKZ7y0T28rzc+6kE+t jITayfS9gdQPdXRj7cpgR6e40agSiX6YhJemBndlYqc7cNflNlHhAEt89W8o+hdBnuPuKXzPAw2xc 2t/tGvcFKFwkZykkWLhfiB3BPPyObvFZwMYUDp5+nejMtycmSzatv+beTRUkhsmXLLPJWEOi8iNn2 aozBn9C6KjYtOISNVy/XSwlDJuTiUv+bgfRvVFqHD7Ad0DjSIKFXZoQb1u9UifkATDJiNHzQ7x3Xt 0ry58vvg==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lk2hd-00H37F-Ne for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 10:48:29 +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 2FB1B1424; Fri, 21 May 2021 03:48:21 -0700 (PDT) Received: from optiplex-7070.shanghai.arm.com (optiplex-7070.shanghai.arm.com [10.169.188.115]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 59AC63F73D; Fri, 21 May 2021 03:48:19 -0700 (PDT) From: Jaxson Han To: mark.rutland@arm.com, andre.przywara@arm.com Cc: linux-arm-kernel@lists.infradead.org, wei.chen@arm.com, jaxson.han@arm.com Subject: [boot-wrapper PATCH v2 0/8] Add Armv8-R AArch64 support Date: Fri, 21 May 2021 18:47:59 +0800 Message-Id: <20210521104807.138269-1-jaxson.han@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_034825_861270_6A83D173 X-CRM114-Status: UNSURE ( 9.79 ) 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 Currently, we cannot boot Linux with boot-wrapper on Armv8-R AArch64: 1. The Armv8-R AArch64 profile does not support the EL3. 2. The Armv8-R AArch64 EL2 only supports a PMSA, which Linux does not support. So it's necessary to drop into EL1 before entering the kernel. 3. There is no EL2 booting code for Armv8-R AArch64 and no configuration for dropping to EL1 in boot-wrapper. These patches enable boot-wrapper booting Linux with Armv8-R AArch64: Patch 1 allows boot-wrapper to boot on more platforms. Patch 2 renames some labels as preparations for booting from lower EL. Patch 3 remove the redundant setup_stack. Patch 4-5 does some preparations for lower EL booting. Patch 6 prepares for GICv3 initialization with EL2. Patch 7 adds necessary EL2 registers. Patch 8 adds auto-detection for Armv8-R AArch64 to drop into EL1 before entering the kernel. Refs: Arm Architecture Reference Manual Supplement - Armv8, for Armv8-R AArch64 architecture profile. [https://developer.arm.com/documentation/ddi0600/latest/] --------- v1 -> v2: 1. Split Patch 2 to Patch 2,3,4. 2. Slightly refine some comments. 3. More checks on Armv8-R AArch64. 4. Force setting HCR_EL2 instead of modifying. Jaxson Han (8): Decouple V2M_SYS config by auto-detect dtb node aarch64: Rename labels and prepare for lower EL booting aarch64: Remove the redundant setup_stack aarch64: Prepare for EL1 booting aarch64: Prepare for lower EL booting gic-v3: Prepare for gicv3 with EL2 aarch64: Prepare for booting with EL2 aarch64: Introduce EL2 boot code for Armv8-R AArch64 Makefile.am | 4 +- arch/aarch32/include/asm/gic-v3.h | 7 ++ arch/aarch64/boot.S | 146 +++++++++++++++++++++++++++--- arch/aarch64/include/asm/cpu.h | 3 + arch/aarch64/include/asm/gic-v3.h | 38 +++++++- arch/aarch64/psci.S | 13 +-- arch/aarch64/spin.S | 8 +- arch/aarch64/utils.S | 10 +- gic-v3.c | 2 +- platform.c | 4 + 10 files changed, 203 insertions(+), 32 deletions(-)