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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD352ECAAD3 for ; Fri, 9 Sep 2022 17:28:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229490AbiIIR2o (ORCPT ); Fri, 9 Sep 2022 13:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230407AbiIIR2l (ORCPT ); Fri, 9 Sep 2022 13:28:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0787511B772 for ; Fri, 9 Sep 2022 10:28:41 -0700 (PDT) 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 97FDF62071 for ; Fri, 9 Sep 2022 17:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 619F1C433D6; Fri, 9 Sep 2022 17:28:38 +0000 (UTC) Date: Fri, 9 Sep 2022 18:28:34 +0100 From: Catalin Marinas To: Elliot Berman Cc: Will Deacon , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu Subject: Re: [PATCH v2] KVM: arm64: Only set KVM_MODE_PROTECTED if is_hyp_mode_available() Message-ID: References: <20220909144552.3000716-1-quic_eberman@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220909144552.3000716-1-quic_eberman@quicinc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 09, 2022 at 07:45:52AM -0700, Elliot Berman wrote: > Do not switch kvm_mode to KVM_MODE_PROTECTED if hypervisor mode is not > available. This prevents "Protected KVM" cpu capability being reported > when Linux is booting in EL1 and would not have KVM enabled. > > Signed-off-by: Elliot Berman > --- > arch/arm64/kvm/arm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index 8fe73ee5fa84..861f4b388879 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -2272,7 +2272,9 @@ static int __init early_kvm_mode_cfg(char *arg) > return -EINVAL; > > if (strcmp(arg, "protected") == 0) { > - if (!is_kernel_in_hyp_mode()) > + if (!is_hyp_mode_available()) > + kvm_mode = KVM_MODE_DEFAULT; I think kvm_mode is already KVM_MODE_DEFAULT at this point. You may want to print a warning instead. -- Catalin