Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934887AbcDMLQb (ORCPT ); Wed, 13 Apr 2016 07:16:31 -0400 Received: from foss.arm.com ([217.140.101.70]:33560 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932793AbcDMLQa (ORCPT ); Wed, 13 Apr 2016 07:16:30 -0400 Subject: Re: [PATCH 2/2] arm64: vhe: Verify CPU Exception Levels To: Christoffer Dall References: <1460472361-28419-1-git-send-email-suzuki.poulose@arm.com> <1460472361-28419-2-git-send-email-suzuki.poulose@arm.com> <20160413111424.GA17696@cbox> Cc: linux-arm-kernel@lists.infradead.org, marc.zyngier@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com From: Suzuki K Poulose Message-ID: <570E2A8A.5050504@arm.com> Date: Wed, 13 Apr 2016 12:16:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20160413111424.GA17696@cbox> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1162 Lines: 37 On 13/04/16 12:14, Christoffer Dall wrote: > On Tue, Apr 12, 2016 at 03:46:01PM +0100, Suzuki K Poulose wrote: >> With a VHE capable CPU, kernel can run at EL2 and is a decided at early >> boot. If some of the CPUs didn't start it EL2 or doesn't have VHE, we >> could have CPUs running at different exception levels, all in the same >> kernel! This patch adds an early check for the secondary CPUs to detect >> such situations. >> >> For each non-boot CPU add a sanity check to make sure we don't have >> different run levels w.r.t the boot CPU. We save the information on >> whether the boot CPU is running in hyp mode or not and ensure the >> remaining CPUs match it. >> >> Applies on 4.6-rc3. >> +#ifdef CONFIG_ARM64_VHE >> + >> +extern bool boot_cpu_hyp_mode; >> +static inline bool is_boot_cpu_in_hyp_mode(void) >> +{ >> + return boot_cpu_hyp_mode; >> +} > > would it make sense to move this to smp.c to avoid exporting > boot_cpu_hyp_mode? Sure, we can. > > Note that boot_cpu_hyp_mode is never set without CONFIG_SMP, but that > shouldn't matter I suppose. Right. The check will be invoked only by the secondary CPUs. I will respin it. Cheers Suzuki