From mboxrd@z Thu Jan 1 00:00:00 1970 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 ED344C433EF for ; Tue, 25 Jan 2022 14:02:49 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Oan4PAO5sQ2vUfSbFRkGiVikM4mRkvmwDIevA8NFXBk=; b=johfgsMOhevxb2 s+eOBgf1nQ1PQG9na/oCMyZ2ykA8mYq07tYHiSgpGF5ntkAopjko9czQpIC4pMVVrVPp32NGmnv20 R7lBzJoSCIxf9gXs0A5TNEeVO6UYYOnDKNnAfihbYSxauzPCO+cDS6bsemVDJTbpqmRAL7hCzR6K1 YnNh+9fbX8pVzi5TFDtgTOlK8TjLDvwYmSLdPnuaKEZQZJbHVHYbudDiU7OnbCDCP+qluQaJmNrjW QI9aDtbV1mQTYSUVpV7jm/Odce7WCWtAo3LrO5cJe5cRend47/J2AWtessn7FPVQp6tcPGsDPNlqh y+b/yKyMpA1b5AnQ9y1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCMNg-00835C-BU; Tue, 25 Jan 2022 14:01:08 +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 1nCMNZ-00833Y-Im for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 14:01:05 +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 698EFD6E; Tue, 25 Jan 2022 06:01:00 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.1.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 418743F793; Tue, 25 Jan 2022 06:00:59 -0800 (PST) Date: Tue, 25 Jan 2022 14:00:56 +0000 From: Mark Rutland To: Andre Przywara Cc: linux-arm-kernel@lists.infradead.org, Jaxson.Han@arm.com, robin.murphy@arm.com, vladimir.murzin@arm.com, Wei.Chen@arm.com Subject: Re: [bootwrapper PATCH v2 12/13] Rework bootmethod initialization Message-ID: References: <20220114105653.3003399-1-mark.rutland@arm.com> <20220114105653.3003399-13-mark.rutland@arm.com> <20220117174300.0a91fcf6@donnerap.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220117174300.0a91fcf6@donnerap.cambridge.arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_060103_845014_32300E12 X-CRM114-Status: GOOD ( 28.33 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 17, 2022 at 05:43:00PM +0000, Andre Przywara wrote: > On Fri, 14 Jan 2022 10:56:52 +0000 > Mark Rutland wrote: > > Hi Mark, > > > We currently initialize the bootmethod late, in assembly code. This > > requires us to maintain the el3/no_el3 distintion late into the boot > > process, and means we cannot produce any helpful diagnostic when booted > > at an unexpected exception level. > > > > Rework things so that we initialize the bootmethod early, with a warning > > when things are wrong. The el3/no_el3 distinction is now irrelevant to > > the bootmethod code, and can be removed in subsequent patches. > > > > When a boot-wrapper configured for PSCI is entered at EL2, a warning is > > looged to the serial console as: > > > > | Boot-wrapper v0.2 > > | Entered at EL2 > > | Memory layout: > > | [0000000080000000..0000000080001f90] => boot-wrapper > > | [000000008000fff8..0000000080010000] => mbox > > | [0000000080200000..00000000822af200] => kernel > > | [0000000088000000..0000000088002857] => dtb > > | > > | WARNING: PSCI could not be initialized. Boot may fail > > > > Signed-off-by: Mark Rutland > > diff --git a/arch/aarch64/include/asm/psci.h b/arch/aarch64/include/asm/psci.h > > new file mode 100644 > > index 0000000..491e685 > > --- /dev/null > > +++ b/arch/aarch64/include/asm/psci.h > > @@ -0,0 +1,28 @@ > > +/* > > + * arch/aarch64/include/asm/psci.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 __ASM_AARCH64_PSCI_H > > +#define __ASM_AARCH64_PSCI_H > > + > > +#include > > +#include > > + > > +extern char psci_vectors[]; > > + > > +static inline bool cpu_init_psci_arch(void) > > +{ > > + if (mrs(CurrentEL) != CURRENTEL_EL3) > > + return false; > > + > > + msr(VBAR_EL3, (unsigned long)psci_vectors); > > + isb(); > > + > > + return true; > > +} > > + > > +#endif > > Is there any particular reason that needs to live as a static inline in a > header file? Can't we have the prototype in, say include/boot.h, and then > have this in a proper C file, for instance arch/aarch/init.c? At the time I originally wrote it, I had thought that this was the simplest option, but you're right that it's cleaner to place this in the relevant init.c file -- done. :) Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel