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 X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33862C47097 for ; Thu, 3 Jun 2021 18:36:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0619A613D7 for ; Thu, 3 Jun 2021 18:36:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0619A613D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lkrZP6N196boz/bokj2DKPnJP4KplCRhk3zS/o2ttFA=; b=NQD4ufVnwiwLN/ WLocUFhyTj2f0W1uZP4O2l7fwVZ360Dsfktn5e9FyoN/+ZjnKY4/YmOjpuc4Y5GZrdaXSSmzZC6/h g07O3fIMROebTrtfC0tfG+vBbKJfLJG8VL+IEyhs+b4sl7WQDfCaOi7u1IharHobZv1fCyChCwfWB V6CWW7ZsrHqf7nPBXsDKBPoN8ya+czTAvffGiTFF/1MDfaZ86Kid4gmsO/P2uEkHH8QqYTJeIeoPg EVInTLC+NLEEWd5AgGFo2H7fdiSU+Zcr4G5Gu/sBQcAkF7kqqhk6uN7nNH7yBCK+CeRJUPi4Uz7fU BYFQ/UDf6NUDaGaZHbZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1losAW-00ACIR-6n; Thu, 03 Jun 2021 18:34:12 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1losAK-00ACGE-9u for linux-arm-kernel@lists.infradead.org; Thu, 03 Jun 2021 18:34:01 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B51D613DC; Thu, 3 Jun 2021 18:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622745240; bh=8rzvn6RTUZ+Fwle5zCQTw7SSxwCeA8VzLr8wda4TNzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=knMwvqEDfg1TqKq+8mJzto8ZkP9NHA83kO8aFVRApvuOlPy9xFn72QrTIAgylo6Ma 3v6ZqrpoCULuBEn8DmxDjf1InP1TggNgxD1zfvlh8Om1ATNdLqijRLa+F4MVdQsQEC d1Dud6Nte9sawAg+6/fFb37Y2xITBxlb7HbBFoZi/ouDnQglK6DIiH4fs2oAmIFIQ4 KYlAhqnNYpCVRKpKMJrwt0K02poML1UyEJASdpEsCJe5m9sdWJiY9UcOl5iaJn3U/d 899ah8ctyb0RvqKAFoXKS0tbkSuiTzr+JVK4q7wbodfJ+ZkAetwAykwg9/9knRGtUK 8alKJHF/yy/2A== From: Will Deacon To: kvmarm@lists.cs.columbia.edu Cc: Will Deacon , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Mark Rutland , Christoffer Dall , Paolo Bonzini , Fuad Tabba , Quentin Perret , Sean Christopherson , David Brazdil , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4] KVM: arm64: Ignore 'kvm-arm.mode=protected' when using VHE Date: Thu, 3 Jun 2021 19:33:44 +0100 Message-Id: <20210603183347.1695-2-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210603183347.1695-1-will@kernel.org> References: <20210603183347.1695-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210603_113400_381024_40ECAD9A X-CRM114-Status: GOOD ( 13.91 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ignore 'kvm-arm.mode=protected' when using VHE so that kvm_get_mode() only returns KVM_MODE_PROTECTED on systems where the feature is available. Cc: David Brazdil Signed-off-by: Will Deacon --- Documentation/admin-guide/kernel-parameters.txt | 1 - arch/arm64/kernel/cpufeature.c | 10 +--------- arch/arm64/kvm/arm.c | 6 +++++- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index cb89dbdedc46..e85dbdf1ee8e 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2300,7 +2300,6 @@ protected: nVHE-based mode with support for guests whose state is kept private from the host. - Not valid if the kernel is running in EL2. Defaults to VHE/nVHE based on hardware support. diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index efed2830d141..dc1f2e747828 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1773,15 +1773,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) { - if (kvm_get_mode() != KVM_MODE_PROTECTED) - return false; - - if (is_kernel_in_hyp_mode()) { - pr_warn("Protected KVM not available with VHE\n"); - return false; - } - - return true; + return kvm_get_mode() == KVM_MODE_PROTECTED; } #endif /* CONFIG_KVM */ diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 1cb39c0803a4..8d5e23198dfd 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -2121,7 +2121,11 @@ static int __init early_kvm_mode_cfg(char *arg) return -EINVAL; if (strcmp(arg, "protected") == 0) { - kvm_mode = KVM_MODE_PROTECTED; + if (!is_kernel_in_hyp_mode()) + kvm_mode = KVM_MODE_PROTECTED; + else + pr_warn_once("Protected KVM not available with VHE\n"); + return 0; } -- 2.32.0.rc0.204.g9fa02ecfa5-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel