Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1804318pxb; Sat, 23 Jan 2021 06:12:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFXzTUX0a/V6EBYPXxInzutILmxLSvz6Zl98EEetre5nuCmyFh/buQkJx5fKAXiidTsjLv X-Received: by 2002:a05:6402:2d2:: with SMTP id b18mr87654edx.228.1611411164461; Sat, 23 Jan 2021 06:12:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611411164; cv=none; d=google.com; s=arc-20160816; b=KcE1OYXBfwHll3u7YfLV/VdL29qC2ZAE03oIBf1sqjjHuQdhXKDLaELckbRk3OQy10 8AonxGlsxbJQ90bUH6nxv8Sy1+MpnSt3cYhx8XrFhnLeTcNhgvkfxIJ9IBKkAd1xShKJ vug1IwAr19HoveHY8I4tEHCZ5J02roE/XEvxh+3NCihJVr8FZW8UdfPfYuOgl2yRUmRD f+STISZOS3cjlqh0BPY4p2hod+M2lAZEIFdeiih7NlesAl1etWOb3GjDk11mjOM5xzzY fBZiX037m1/a8sGpGvEzzt05Clw/cBGpARNPfdaQCQ4jwG0ITUs3edrmpd853DrXAWqR KUbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=W524IG6RR5zIz+ZEtw4NZ+Azc6xw/HvXkyXLI5cdi/c=; b=VWJxsvqkXmOPc3A+7Ww7lwfiKSxQBnf6S9kH7K9VLsyFujPQZZWgUe+6ZVw7UPeDjX tarKSk5h7sWSrS1NozItb3YJj/Zdm5kVJDAPVGHukE8NMswyfkyobZrArKWGdul+5sn+ vjQlIeYvehhc1ltiNXE27dL3Yf0YEWXLNVYhdRW1ViamVmHez+n/gZXpxGJXF6bXa+zU /BZZInvHi4MD4tUStYLDhAMtOXasOthAE8wQfv0bjhJ+/h2g8GLQcG7vSwSxxN2CwxIu pAj5r9Xs3yR4VBYYxfbwszeGcSZXE6ChwWEDJfRIn6BztrS36cbpIj4RC3P3jWDY8wg3 z+vQ== 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr15si4092069ejc.287.2021.01.23.06.12.19; Sat, 23 Jan 2021 06:12:44 -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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725968AbhAWOIp (ORCPT + 99 others); Sat, 23 Jan 2021 09:08:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:33512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725889AbhAWOIj (ORCPT ); Sat, 23 Jan 2021 09:08:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2961022B51; Sat, 23 Jan 2021 14:07:56 +0000 (UTC) Date: Sat, 23 Jan 2021 14:07:53 +0000 From: Catalin Marinas To: Marc Zyngier 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 Message-ID: References: <20210118094533.2874082-1-maz@kernel.org> <20210118094533.2874082-15-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210118094533.2874082-15-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Catalin