Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2264003rwn; Fri, 9 Sep 2022 10:47:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR4VlW8hKkgWDV1iOWR7pQsKDSJ2GQsysbeduOo36y68VdgXJRxNO9rC+cqk5ELBPMJOBz5I X-Received: by 2002:a17:902:694a:b0:16e:e270:1f84 with SMTP id k10-20020a170902694a00b0016ee2701f84mr14829366plt.89.1662745669433; Fri, 09 Sep 2022 10:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662745669; cv=none; d=google.com; s=arc-20160816; b=dxTvqRXd7YkmRYJHgDD4X1EP74zYh9uM6U3MuIvqsqg8DFwzpvYlk9JF4HLFi3+lgI Z7C7aj636caE3cJS7ffQ3CR7FLwiEti6YXyqUu8JGxP1jkO5Y+4dPQUqfaafJ7IC4XVR WYJ3kxvEIh3Hy0HUFeHNlTryEwIbvDPyg5/Zd1p7yopMw23Mf0gwiERa+sKzSwEawUJ6 7yL4h8JzmdXySUQSKLQqBC9tsKVzL/SZILIh1k4A+wqeUdDahgWjn040m9PyYtaxMdYK PedygWA95wTf8wi/R/4pyTYRpxO0v/VQDzFpQrFWhVkoWdfwP0koZtJver8tCO9oHPOx 2PZA== 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=daB/wwckOCekisjcFcrT0fEo1nEFwBBQlAhIoJce+q4=; b=iXC4xEQ2q1P2OaUXOi08Yx0BbiMUqPJk8vNQr3CV+p8SEQudSR4jSvnuWClVogs2Xv jTlmdaIsCT0Mub7M4xelPAc5apcZRCk/qZlsl4310XPVmVBh4oU+PaRmkPqn4wHEnF3X oJm3pxy1uhWxpjfMjlub2NFvn5YpXtEvAQo1YmujRl3wDA6A1skTZKbsivGAOA1XcAzk huARCyUPho2U/t5qG0wqR7rGxlJNfK4vtdKCoJveWBW2+WAu1XXnCG4MfWTX/DYZJOMo QCScuQVtPBwC9jl/g+QczvevOjsnvuOoaFjdpft5LHPyMjXM5TZeblkeZx+olQJ1FjRj eJYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020a62e90c000000b0053e321ce53esi9381pfh.127.2022.09.09.10.47.37; Fri, 09 Sep 2022 10:47:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231513AbiIIR2n (ORCPT + 99 others); Fri, 9 Sep 2022 13:28:43 -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> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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