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 3EA55C433F5 for ; Mon, 14 Feb 2022 17:18: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: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zxZD9Eq5VE5JgLeMxaocDATMIw3gnMkCW08ndHeSWqo=; b=gA3peeMdnzOGPE we3Jx+Kb7ijh5t+Y98B+tAweILZbNoy4wP8B1FXnQ2mKepLWyCSKtXEWkUwEeHEIPB6lvddOdqWgt PKCYKF9DTdBnZEEcwNTaKxKaZSSnb2MOHk1PrkiTOZKic6/KzTria679DQkuTK47gbdQqZzTfEJd+ dLasuuLzAPKrSgwtPxdCCjcrPSTyvoATQdeMKFagUCFFZy0tcFzTaPvHi7jhuGRPZsjaFKS9zn231 iUp6SVBss3Dh1VwU84dXuRgE0QeCNHjarkUBNf8NCHoRkHoPwHVy4z8PgRXiKOdaA0jOeGIAq6Pm+ hseufWfec8tX2+cJRkeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJey9-00GLKh-FI; Mon, 14 Feb 2022 17:16:57 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJey5-00GLJ2-5Y for linux-arm-kernel@lists.infradead.org; Mon, 14 Feb 2022 17:16:54 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD7E2B80C6D; Mon, 14 Feb 2022 17:16:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 840A7C340E9; Mon, 14 Feb 2022 17:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644859010; bh=NEmvyMn+bnJuC0TLAapMAQPXtu/PeT11ZqOStyovBFg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=APC3JyidxomThAX6eR/MfZjDLbWLYgWfWmBdmtDoMfuOEXkiAS38bx6E9oWQ+oPrB DCFMPGN6GVAwBdw77c1KU2gIBWhk9rVJjSnIXllfUkUsJAY6PUbk8UX3NxuMI4wzXl 8U05ACiyd+dBJpJ3FizBT1DRDiwpqncXZRdbq0c7w8jeQUzwxu0WjJ6gyOQ3LHGIfJ j6ft9DpgDByG5D73Hh0ITjHVmIPl5OBjZT2dvmUgbHXWMnuxR69PTEWiiN8A4trr21 NIPT26nUbLO8PKBKxiZI5v5awh1pw15esnNUpmkilHG66NMVLt9dQav0cTYUfHl+Ur vPG4MP3HxuQyA== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nJey0-007qPj-Cz; Mon, 14 Feb 2022 17:16:48 +0000 Date: Mon, 14 Feb 2022 17:16:48 +0000 Message-ID: <87ilth4bcv.wl-maz@kernel.org> From: Marc Zyngier To: Joakim Tjernlund Cc: "mark.rutland@arm.com" , "linux-arm-kernel@lists.infradead.org" Subject: Re: Buggy branch in __init_el2_gicv3? In-Reply-To: <90b6eafea02ad5534da194676abf20da2e7ad1b7.camel@infinera.com> References: <90b6eafea02ad5534da194676abf20da2e7ad1b7.camel@infinera.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: Joakim.Tjernlund@infinera.com, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220214_091653_544609_8CA871DD X-CRM114-Status: GOOD ( 29.12 ) 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, 14 Feb 2022 15:14:41 +0000, Joakim Tjernlund wrote: > > On Mon, 2022-02-14 at 14:56 +0000, Mark Rutland wrote: > > On Mon, Feb 14, 2022 at 12:34:12PM +0000, Joakim Tjernlund wrote: > > > In init_el2_state calls __init_el2_gicv3 which looks: > > > > > > /* GICv3 system register access */ > > > .macro __init_el2_gicv3 > > > mrs x0, id_aa64pfr0_el1 > > > ubfx x0, x0, #ID_AA64PFR0_GIC_SHIFT, #4 > > > cbz x0, .Lskip_gicv3_\@ > > > > > > mrs_s x0, SYS_ICC_SRE_EL2 > > > orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1 > > > orr x0, x0, #ICC_SRE_EL2_ENABLE // Set ICC_SRE_EL2.Enable==1 > > > msr_s SYS_ICC_SRE_EL2, x0 > > > isb // Make sure SRE is now set > > > mrs_s x0, SYS_ICC_SRE_EL2 // Read SRE back, > > > tbz x0, #0, 1f > > > // tbz x0, #0, .Lskip_gicv3_\@ // and check that it sticks > > > msr_s SYS_ICH_HCR_EL2, xzr // Reset ICC_HCR_EL2 to defaults > > > .Lskip_gicv3_\@: > > > .endm > > > > > > Note the tbz x0, #0, 1f, this instruction causes my A53 CPU to jump far out of the macro and make the > > > CPU go into EL0, failing with an exception a bit later. I believe the 1f is a bug and if I replace it with > > > tbz x0, #0, .Lskip_gicv3_\@ > > > the CPU continue too boot. > > > > You're right, that should be targetting `.Lskip_gicv3_\@`. It looks like that > > was left behind in commit: > > > > 114945d84a30a5fe ("arm64: Fix labels in el2_setup macros") > > > > Marc? > > > > > Why this is trigged is still a mystery to me, any pointers welcome :) > > > > I believe this happens if EL3 has ICC_SRE_EL3.SRE == 0b0; in that > > case ICC_SRE_EL2.SRE is RAZ/WI. i.e. your EL3 firmware isn't using > > GICv3 and hasn't enabled it for lower ELs. > > Correct, I am now trying to enable GIC but I thing I note is that we > have a GIC500v4 and u-boot(my EL3 FW) only has GICV3 as far as I can > see. Will that be a problem or is GICv3 and v4 compatible as in this > respect ? Hmmm. There is no such thing as a GIC500v4. GIC500 is a GICv3 implementation, and the most recent revision seems to be r1p1. Note that it doesn't matter much, as GICv3 and GICv4 have programming models that are largely identical, and the differences are only meaningful to a hypervisor. Linux has support for both anyway. Are you actually using u-boot as your EL3 firmware? That's... an interesting choice. Last time I checked, the GICv3 support was pretty bad (as in totally broken). Something like TF-A would seem like a better choice when it comes to architectural support). Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel