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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F73CC433FE for ; Tue, 11 Oct 2022 20:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229594AbiJKU7S (ORCPT ); Tue, 11 Oct 2022 16:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbiJKU7R (ORCPT ); Tue, 11 Oct 2022 16:59:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4F109F766 for ; Tue, 11 Oct 2022 13:59:16 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 59881612CE for ; Tue, 11 Oct 2022 20:59:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA530C433C1; Tue, 11 Oct 2022 20:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665521955; bh=WDo7TGKL3wdUVXktG1Ud6ocgH2ZnNiVxM3UyUdlDECc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ke+sNRqK7PE3/xFvxADXu/qe+KbCTRkR0BxLz1btUnknJZgyM4ekS9tob+pkCvhs2 Icg12WveyWOwGN6iuyt/biq+f6iXDYHU3QwLNFGXx5ImYf6JoUvs1OsFNZPd/rGthL PJDvQiyIKwPRUuuiD8IEFi5V9oSncigd5LLu709bJD63+oIYT4EbwALvsb/tHfLzFI 0zuVX09Ss7iN7GkS86KOZv/52ANIBsjqfeArwhB3tGd1cQwY1QU8i5Kv8/lhb+nSMc OPQDzn72FDLOqeTpMYdZFoQkldEK9ihPTGEJ3+CLaxDRVrFrbp18sJw3ci8VMftclB IygljItW34ovA== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oiMLJ-00FuhW-Bb; Tue, 11 Oct 2022 21:59:13 +0100 Date: Tue, 11 Oct 2022 21:58:22 +0100 Message-ID: <87pmeygjrl.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Alexandru Elisei , Quentin Perret , Will Deacon , Vincent Donnefort Subject: Re: [PATCH] KVM: arm64: pkvm: Fixup boot mode to reflect that the kernel resumes from EL1 In-Reply-To: References: <20221011165400.1241729-1-maz@kernel.org> 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") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, qperret@google.com, will@kernel.org, vdonnefort@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, 11 Oct 2022 19:48:39 +0100, Oliver Upton wrote: > > On Tue, Oct 11, 2022 at 05:54:00PM +0100, Marc Zyngier wrote: > > The kernel has an awfully complicated boot sequence in order to cope > > with the various EL2 configurations, including those that "enhanced" > > the architecture. We go from EL2 to EL1, then back to EL2, staying > > at EL2 if VHE capable and otherwise go back to EL1. > > > > Here's a paracetamol tablet for you. > > Heh, still have a bit of a headache from this :) > > I'm having a hard time following where we skip the EL2 promotion based > on __boot_cpu_mode. > > On the cpu_resume() path it looks like we take the return of > init_kernel_el() and pass that along to finalise_el2(). As we are in EL1 > at this point, it seems like we'd go init_kernel_el() -> init_el1(). > > What am I missing? That I'm an idiot. This is only necessary on pre-6.0, before 005e12676af0 ("arm64: head: record CPU boot mode after enabling the MMU"), as this code-path *used* to reload the boot mode from memory. Now, this is directly passed as a parameter, making this patch useless. The joys of looking at too many code bases at the same time... I'll see how we can add it to 5.19. Thanks, M. -- Without deviation from the norm, progress is not possible.