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 9F690CFD341 for ; Fri, 11 Oct 2024 11:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3XqxTDXlzjyfav36NbEPkDEUaN+a2Z1MfVJ8sakaiJw=; b=oGg1G19VHKnFRMQHDbniaTQ/xr 8eOEP9AfAdmZa2wFpmCMza1FfysxBW3Sjel67nCnaOEzv3JysClyg4mg6fZVCREJG2hX8sDvYcZ33 mliCIeBW4uib08f/z4NEW0tv3SkQD4BjXDjSmSYgTxPmysm+XB696MFy+5vF2a+fnn9KJ7GiqE1ya ELTUI2xkwIY9nhpvLM0bZfIjI9WSw5ArSIh3Se7iG5DikfVXQeh808olJZuPNm8I+OxBsyrEpFz4F SlHeEiLUVHC/bpWY4nseHbPw5rkst5Y8aehRbdZ7ZkrGtA9m8r+v/Fw39rL+QVQgMYbTRMQyTTMoT bz4h/RHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szDNp-0000000G527-3jpx; Fri, 11 Oct 2024 11:00:33 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szDIi-0000000G47O-48TM for linux-arm-kernel@bombadil.infradead.org; Fri, 11 Oct 2024 10:55:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=3XqxTDXlzjyfav36NbEPkDEUaN+a2Z1MfVJ8sakaiJw=; b=bx35nwK77Rf/td8mKBY2vNCQDi DqqUCHg8BqJlqCV9JeIpnUki9zlRmlAFjQhp6WZ+fYN1APlwHKXWw5Meg/SQm0UYuGdj4NNZZjBSM 64anwJ6pxbDfcMxtxQChFV9Drhu1QCnZOjYzn51sfqcCa/f4xgGnqasy7X404U9wMu5ZVRGBTETqb kVPEwBkE1uUrJsWxXMDxwFIFi8lcqO1PIXhcuAdUf88DFKBY/x59ta3aU2LoGOkh00HvWWoLhhbYT PxW5eFrCeZpBrwzzjbmi56knfG5AS7KjEcIyzodliLC2eGxHS9VeCIfRr3QaiySjXInxEHGxo1NVd WLo6CxWg==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szDIf-00000005riI-18KI for linux-arm-kernel@lists.infradead.org; Fri, 11 Oct 2024 10:55:15 +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 ABECE497; Fri, 11 Oct 2024 03:55:39 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 53BE93F73F; Fri, 11 Oct 2024 03:55:09 -0700 (PDT) Date: Fri, 11 Oct 2024 11:55:06 +0100 From: Mark Rutland To: Luca Fancellu Cc: andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org Subject: Re: [boot-wrapper v3 3/4] aarch64: Implement PSCI for Armv8-R Message-ID: References: <20240731141103.2559706-1-luca.fancellu@arm.com> <20240731141103.2559706-4-luca.fancellu@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240731141103.2559706-4-luca.fancellu@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_115513_733308_25A262D4 X-CRM114-Status: GOOD ( 20.52 ) 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 On Wed, Jul 31, 2024 at 03:11:02PM +0100, Luca Fancellu wrote: > Armv8-R doesn't have EL3, so the PSCI vector needs to be > installed in VBAR_EL2 and the conduit needs to be 'hcv' > instead of 'smc'. > > Implement the modifications needed when --with-bw-arch is > 'aarch64-r'. > > Signed-off-by: Luca Fancellu > --- > Changes from v2: > - Major rework, reason in the cover letter. > --- > Makefile.am | 2 +- > arch/aarch64/init.c | 14 +++++++++++--- > configure.ac | 3 +++ > 3 files changed, 15 insertions(+), 4 deletions(-) > > diff --git a/Makefile.am b/Makefile.am > index bf97b989d5d7..62e2988c0dd3 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -57,7 +57,7 @@ ARCH_OBJ += psci.o > COMMON_OBJ += psci.o > PSCI_NODE := psci { \ > compatible = \"arm,psci\"; \ > - method = \"smc\"; \ > + method = \"$(PSCI_METHOD)\"; \ > cpu_on = <$(PSCI_CPU_ON)>; \ > cpu_off = <$(PSCI_CPU_OFF)>; \ > }; > diff --git a/arch/aarch64/init.c b/arch/aarch64/init.c > index b0abde11ebd6..d8cf390dce20 100644 > --- a/arch/aarch64/init.c > +++ b/arch/aarch64/init.c > @@ -211,12 +211,20 @@ extern char psci_vectors[]; > > static void cpu_init_psci_arch(unsigned int cpu) > { > - if (mrs(CurrentEL) != CURRENTEL_EL3) { > + switch (mrs(CurrentEL)) { > +#if !defined(BOOTWRAPPER_64R) > + case CURRENTEL_EL3: > + msr(VBAR_EL3, (unsigned long)psci_vectors); > + break; > +#else > + case CURRENTEL_EL2: > + msr(VBAR_EL2, (unsigned long)psci_vectors); > + break; > +#endif > + default: > print_cpu_warn(cpu, "PSCI could not be initialized (not booted at EL3).\r\n"); > return; > } > - > - msr(VBAR_EL3, (unsigned long)psci_vectors); > isb(); As on the prior patch, I'd like to aovid hte ifdeffery here; can we make this: if (!bootwrapper_is_r_class() && mrs(CurrentEL) == CURRENTEL_EL3) { msr(VBAR_EL3, (unsigned long)psci_vectors); isb(); return; } if (bootwrapper_is_r_class() && mrs(CurrentEL) == CURRENTEL_EL2) { msr(VBAR_EL2, (unsigned long)psci_vectors); isb(); return; } print_cpu_warn(cpu, "PSCI could not be initialized from this EL.\r\n"); Otherwise this looks good to me. Mark. > } > #else > diff --git a/configure.ac b/configure.ac > index 88dbf9ba4f08..381f82612434 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -107,6 +107,9 @@ AC_ARG_ENABLE([psci], > [USE_PSCI=$enableval], [USE_PSCI="yes"]) > AM_CONDITIONAL([PSCI], [test "x$USE_PSCI" = "xyes"]) > AS_IF([test "x$USE_PSCI" = "xyes"], [], [USE_PSCI=no]) > +AS_IF([test "x$USE_ARCH" = "xaarch64-r"], > + AC_SUBST([PSCI_METHOD], [hvc]), AC_SUBST([PSCI_METHOD], [smc]) > +) > > AS_IF([test "x$USE_PSCI" != "xyes" -a "x$KERNEL_ES" = "x32"], > [AC_MSG_ERROR([With an AArch32 kernel, boot method must be PSCI.])] > -- > 2.34.1 >