From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: [PATCH 01/13] arm/arm64: Add new is_kernel_in_hyp_mode predicate Date: Thu, 16 Jul 2015 19:08:03 +0100 Message-ID: <20150716180802.GS26390@arm.com> References: <1436372356-30410-1-git-send-email-marc.zyngier@arm.com> <1436372356-30410-2-git-send-email-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A728A58B36 for ; Thu, 16 Jul 2015 13:56:12 -0400 (EDT) Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J12tc-cmQ4Cw for ; Thu, 16 Jul 2015 13:56:12 -0400 (EDT) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by mm01.cs.columbia.edu (Postfix) with ESMTP id EB5F758B35 for ; Thu, 16 Jul 2015 13:56:11 -0400 (EDT) Content-Disposition: inline In-Reply-To: <1436372356-30410-2-git-send-email-marc.zyngier@arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: Marc Zyngier Cc: "kvm@vger.kernel.org" , Catalin Marinas , "linux-kernel@vger.kernel.org" , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" List-Id: kvmarm@lists.cs.columbia.edu On Wed, Jul 08, 2015 at 05:19:04PM +0100, Marc Zyngier wrote: > With ARMv8.1 VHE extension, it will be possible to run the kernel > at EL2 (aka HYP mode). In order for the kernel to easily find out > where it is running, add a new predicate that returns whether or > not the kernel is in HYP mode. > > For completeness, the 32bit code also get such a predicate (always > returning false) so that code common to both architecture (timers, > KVM) can use it transparently. > > Signed-off-by: Marc Zyngier > --- > arch/arm/include/asm/virt.h | 5 +++++ > arch/arm64/include/asm/virt.h | 10 ++++++++++ > 2 files changed, 15 insertions(+) [...] > +static inline bool is_kernel_in_hyp_mode(void) > +{ > + u64 el; > + > + asm("mrs %0, CurrentEL" : "=r" (el)); > + return el == CurrentEL_EL2; Missing mask? Will