Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2468051pxb; Sun, 24 Jan 2021 08:03:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHfsR+P8ZKGJ38xMT31aWorLH0vfnpsBc+YmfhYACqiJi3s4Tl4XzeiW3JuGnZSKWMjpB9 X-Received: by 2002:a17:906:1689:: with SMTP id s9mr295435ejd.500.1611504229975; Sun, 24 Jan 2021 08:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611504229; cv=none; d=google.com; s=arc-20160816; b=v/uokJ8RXxie0wbZ5/jugxALLQZ22jOC0pz2X8DLMHvl/eW5vpFsahxW9J+PKG0BoD nk/hRdwex+ab2WVqbJfy+wZtyAVlRBK4nykylWuFIT6VQ6BO9EkDO0XC4aPw/rhOhjOa z+SfP8Y5muqFsvoOMbPMtTMIFsdXfPRvEWhvndY73vxtqLqdCGA3zPjmVoE9lsiAxFXU YgXiPgfF4eG+2CKFjNQJd9HE46tCRv+lCYekaPOaElATe2cCkoPrkgjXblORVY2A+lBj TzVBBHWtKqTRnSF7KAncNy2GeX842QvP8KVHZlMn4kmXcNd3su4vANAV3mDxYSG6o4nz tc1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=LSwozp5wQAdoFiNXbS2ymCX94GGmx74UjgBGV9aBM2Y=; b=eQBuVVMrB3OxWC/vGQaVdJnhLEKEHVEsCDbHnNW7dr6FecdltWCfku5Y9/jQomzmDL 4bDAOJoIgRCqSbEgnofQmoJTvjxUgEB+Z8VLNq/dSDVBuPozNvTx/6iTzBBCPUTVRTVj a0MfdZepQ4hWG1YgFm9BFI3xcBFZOxsmEfSXwCSS4cdakTB2lPs6CbzHsixeuJ2J7ntj pWHlnoZr6rWIIAJWSfzUwpA5zfpiIl18mUp1LiF2T7J/sF29WGX9kRGXjWaonBl1GXy7 koHujFQ98IBqgXGhQe1CB0+s5qImGgvPAqlU0ohQweL1mWfw2waKze1cXnu4pjVlFcU1 xHfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si5227241eje.581.2021.01.24.08.03.24; Sun, 24 Jan 2021 08:03:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725986AbhAXP7x (ORCPT + 99 others); Sun, 24 Jan 2021 10:59:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:41890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbhAXP7v (ORCPT ); Sun, 24 Jan 2021 10:59:51 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9CDCB225A9; Sun, 24 Jan 2021 15:59:10 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] 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.94) (envelope-from ) id 1l3hnA-009kUq-H1; Sun, 24 Jan 2021 15:59:08 +0000 Date: Sun, 24 Jan 2021 15:59:07 +0000 Message-ID: <87wnw2jph0.wl-maz@kernel.org> From: Marc Zyngier To: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Will Deacon , Mark Rutland , David Brazdil , Alexandru Elisei , Ard Biesheuvel , Jing Zhang , Ajay Patil , Prasad Sodagudi , Srinivas Ramana , James Morse , Julien Thierry , Suzuki K Poulose , kernel-team@android.com Subject: Re: [PATCH v4 14/21] arm64: Honor VHE being disabled from the command-line In-Reply-To: References: <20210118094533.2874082-1-maz@kernel.org> <20210118094533.2874082-15-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: 62.31.163.78 X-SA-Exim-Rcpt-To: catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, will@kernel.org, mark.rutland@arm.com, dbrazdil@google.com, alexandru.elisei@arm.com, ardb@kernel.org, jingzhangos@google.com, pajay@qti.qualcomm.com, psodagud@codeaurora.org, sramana@codeaurora.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kernel-team@android.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: linux-kernel@vger.kernel.org On Sat, 23 Jan 2021 14:07:53 +0000, Catalin Marinas wrote: > > On Mon, Jan 18, 2021 at 09:45:26AM +0000, Marc Zyngier wrote: > > diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S > > index 59820f9b8522..bbab2148a2a2 100644 > > --- a/arch/arm64/kernel/hyp-stub.S > > +++ b/arch/arm64/kernel/hyp-stub.S > > @@ -77,13 +77,24 @@ SYM_CODE_END(el1_sync) > > SYM_CODE_START_LOCAL(mutate_to_vhe) > > // Sanity check: MMU *must* be off > > mrs x0, sctlr_el2 > > - tbnz x0, #0, 1f > > + tbnz x0, #0, 2f > > > > // Needs to be VHE capable, obviously > > mrs x0, id_aa64mmfr1_el1 > > ubfx x0, x0, #ID_AA64MMFR1_VHE_SHIFT, #4 > > - cbz x0, 1f > > + cbz x0, 2f > > > > + // Check whether VHE is disabled from the command line > > + adr_l x1, id_aa64mmfr1_val > > + ldr x0, [x1] > > + adr_l x1, id_aa64mmfr1_mask > > + ldr x1, [x1] > > + ubfx x0, x0, #ID_AA64MMFR1_VHE_SHIFT, #4 > > + ubfx x1, x1, #ID_AA64MMFR1_VHE_SHIFT, #4 > > + cbz x1, 1f > > + and x0, x0, x1 > > + cbz x0, 2f > > +1: > > I can see the advantage here in separate id_aa64mmfr1_val/mask but we > could use some asm offsets here and keep the pointer indirection simpler > in C code. You'd just need something like 'adr_l mmfr1_ovrd + VAL_OFFSET'. > > Anyway, if you have a strong preference for the current approach, leave > it as is. I've now moved over to a structure containing both val/mask, meaning that we only need to keep a single pointer around in the various feature descriptors. It certainly looks better. Thanks, M. -- Without deviation from the norm, progress is not possible.