Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp513586rwb; Thu, 12 Jan 2023 08:48:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXtyBFfLexp6KSAheT+T/o1BrLEA31NzQXU7S7+p5+h6x0nYC3LTSHtqKzUvn0fpSYg04BO9 X-Received: by 2002:aa7:c046:0:b0:499:c343:30e5 with SMTP id k6-20020aa7c046000000b00499c34330e5mr9610556edo.3.1673542107383; Thu, 12 Jan 2023 08:48:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673542107; cv=none; d=google.com; s=arc-20160816; b=KTw3c7UvCLcuvSH9Ju6lU/cM1MRXcs/MbMzNJG8mxA7yCtV9GHdPR3nWHhOgkiiCDl tznSVB/L7sDjOMfEImG95OpLa9Dmvz05yzUf/Pp4wQLRjpV8IX8IW/heZNiPW0/na8ch /PGOoN2kK9WUVG2ck9TM+OFvcDYvpygm7LYIfo4C+Pf+Jw88v73YKqXPhnMQ1Uza9xt/ Riu6cXeuuNswZhf52b+x+QOOHc+EEicyRBRQGx3GhCbbvcbOw2wLWvPZYZQyxq281Ufi Ax8+UFWotU/diwS39hffqSx0vbWD9q5fcjkrPPfl6/bDKCp+qGBRI3FZNHj4Y13pMGzH h6BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KHtGJ9nGgp9oegnI5qH2BTRDc9QRil6AfBMu2nOukeA=; b=aRvqLxOzpjgiuhCrY2MWA5qzBDbr8Scl2/NwbCrNus3mpjKdmcINXfqtYB/AkEJsXB fRLS5zQFK7yJMdunED9qD4vAcqua7e9Rw53RcG09pXJ9FOlkROwai4lHrfLqdLoSCNiz taTLws8hFksPmWOqlyP6BJ2GhnMFxlS0CVkfuXqAJ6TQttm7ezVUyZfrIVs1OadmKVu2 ++G5N6h89CSx0fnD79CnWm0F9IoPRQW83rPcvvbTGHxmxg3kd9rOr30hTJoXppJ7hkZD fSa5ufoTmyECTH+GGgDxHGdpb+Z1cBPbsfpEOSRBr6a5iCyAGPMEjDXRof6dWyqg8Dhi XMjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m8a0iLpB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020aa7d3cf000000b0048461eff750si15160132edr.563.2023.01.12.08.48.14; Thu, 12 Jan 2023 08:48:27 -0800 (PST) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=m8a0iLpB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240812AbjALQpt (ORCPT + 50 others); Thu, 12 Jan 2023 11:45:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240173AbjALQi1 (ORCPT ); Thu, 12 Jan 2023 11:38:27 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CCC11A83E; Thu, 12 Jan 2023 08:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541242; x=1705077242; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kf558c4eCLwp5ypIKzt7alAtawhZgod3QvZLUM8K0+8=; b=m8a0iLpBrlUoLmcOo79tq6tGJjxxUjDtw84/P6csgfCmBE3eWhOUMMrU 4R7ezXZKDZbdKldq9+6hHL8V08x4JECNPvB5UL5hsbB6FBfzrbsX7cUUy KFowVsJRaPtFD4sYGHTHFpNiM4MZ8Um8H5n+fFQdNP6LpO/EvtYD7LTXb hp0lPnRIk7cYpt0uVHXFpz2uj2Nmpi8OTEsRt13VGtpN+zJicKHwU+Y6B CSf4wOhwenPXnyi95QEyml5GB3sfT7ZQMSA9ZhmzDMZAmK2qavRQupEfc lKhj82Gtt/WGmXMHwHSKDU6m/7/BmxXo29Nf8NTF9LZ5VwoW+6thzdUgh A==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="323811837" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="323811837" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:26 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="721151765" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="721151765" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:26 -0800 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack Subject: [PATCH v11 039/113] KVM: x86/mmu: Require TDP MMU for TDX Date: Thu, 12 Jan 2023 08:31:47 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 From: Isaku Yamahata Require the TDP MMU for guest TDs, the so called "shadow" MMU does not support mapping guest private memory, i.e. does not support Secure-EPT. Signed-off-by: Isaku Yamahata --- arch/x86/kvm/mmu/tdp_mmu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index fdcff390ebc2..6c3ce4121a46 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -27,6 +27,13 @@ int kvm_mmu_init_tdp_mmu(struct kvm *kvm) if (kvm->arch.vm_type == KVM_X86_TDX_VM && !enable_mmio_caching) return -EOPNOTSUPP; + /* + * Because only the TDP MMU supports TDX, require the TDP MMU for guest + * TDs. + */ + if (kvm->arch.vm_type == KVM_X86_TDX_VM && !tdp_enabled) + return -EOPNOTSUPP; + if (!tdp_enabled || !READ_ONCE(tdp_mmu_enabled)) return 0; -- 2.25.1