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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9B58ECAAD3 for ; Fri, 9 Sep 2022 12:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aEVRIbZWk8EkZf0LB31G0xeJwKivBEE1wo6BoBfTadU=; b=VfdOLoDQdhU8CIQl/Ba9B1RLO+ MfmLyeNHNKOKrUD/7VtLhjUW+Nrh8GCWnzluKJ8OeVv+ZJpbWiA5m4yu9LRw4JLt009u5taSyU5Cz DAqbv17CWTNk2MuK/KYDkoUuxof+ztL9kcGjqk4t+yz7JkI9AZtY96Mv59TWPobOtmDNMUYIV//aj IWEZ+wX/Osulm8k8KBw7RRARucmMfxBB1qOBV15Ze0dm1Pecr/DMAm65gPnhMOj6AlNM9B77d1EB7 qbZNzroWBIMTS/iSTgCT394R30k6suxfd2ZtluRT0njBRJKBeeU7tS62/v7bdX+9tQ9PesjFePdAk TpphBwzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWdQ5-00G7nN-PR; Fri, 09 Sep 2022 12:47:41 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWdQ1-00G7hN-TG for linux-arm-kernel@lists.infradead.org; Fri, 09 Sep 2022 12:47:39 +0000 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 4469B61FD9; Fri, 9 Sep 2022 12:47:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 012B9C433D7; Fri, 9 Sep 2022 12:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662727657; bh=8Iwo+623tVRzD2r3vitAeyrtiK1yPqT3anVJSO2QxeU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HVMWq27rMWjzFRjQBSNAD3qRkTHd7Y0T6effGiKvHeS8XFp2qBogFa96RrHaXuD4N ydUipwlHUvfHcKeE4v0ZAdfdtD+zqnKJGbLhwXRRPEMTRRbWtNOMp5A8vqqBv2CLc9 +NC6pQ3udz//0LQNMphNEw3QxFY+5Kni2XA99rKRVtW8xcTu7RwUqtc9GqBMMQy7v7 PZBy/SsvEogbP9A6d6qbMBYsmj/vHK5XLK4qibz99ycfSwDr4Olzod7NxZ6b3t0oIT EmPyzHkuMih687aiVYMJF9IkXJq2slByeQv56EWavPfEnLPs2yYACqvOPppCWjiqfI UjCT1NnFUeEWg== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oWdPy-009BXu-Pl; Fri, 09 Sep 2022 13:47:34 +0100 MIME-Version: 1.0 Date: Fri, 09 Sep 2022 13:47:34 +0100 From: Marc Zyngier To: Catalin Marinas Cc: Elliot Berman , Will Deacon , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, David Brazdil Subject: Re: [PATCH] KVM: arm64: Report Protected KVM cap only if KVM is enabled In-Reply-To: References: <20220902040122.346654-1-quic_eberman@quicinc.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <485617e0d3635c1961ab30c1ad930c81@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: catalin.marinas@arm.com, quic_eberman@quicinc.com, will@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, dbrazdil@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220909_054738_057394_A37DA574 X-CRM114-Status: GOOD ( 18.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-09-09 13:44, Catalin Marinas wrote: > On Thu, Sep 01, 2022 at 09:01:22PM -0700, Elliot Berman wrote: >> If "kvm-arm.mode=protected" is present on kernel command line, but the >> kernel doesn't actually support KVM because it booted from EL1, the >> ARM64_KVM_PROTECTED_MODE capability is misleadingly reported as >> present. >> Fix this by adding a check whether we booted from EL2. >> >> Cc: Will Deacon >> Cc: David Brazdil >> Cc: Marc Zyngier >> Signed-off-by: Elliot Berman >> --- >> arch/arm64/kernel/cpufeature.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/arm64/kernel/cpufeature.c >> b/arch/arm64/kernel/cpufeature.c >> index 8d88433de81d..866667be0651 100644 >> --- a/arch/arm64/kernel/cpufeature.c >> +++ b/arch/arm64/kernel/cpufeature.c >> @@ -1974,7 +1974,7 @@ static void cpu_enable_mte(struct >> arm64_cpu_capabilities const *cap) >> #ifdef CONFIG_KVM >> static bool is_kvm_protected_mode(const struct arm64_cpu_capabilities >> *entry, int __unused) >> { >> - return kvm_get_mode() == KVM_MODE_PROTECTED; >> + return is_hyp_mode_available() && kvm_get_mode() == >> KVM_MODE_PROTECTED; >> } >> #endif /* CONFIG_KVM */ > > Could we not fix this in early_kvm_mode_cfg()? That's be indeed preferable. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel