Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp1399769rwj; Sat, 29 Oct 2022 23:29:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gnD+CWnFkpFmhN6cU1pJi5VAhEDZ59RQOg010IyGk5vtHZ0A4zlSySjjik4U+7qFxljLh X-Received: by 2002:a05:6402:204d:b0:463:153d:6790 with SMTP id bc13-20020a056402204d00b00463153d6790mr4311269edb.293.1667111368159; Sat, 29 Oct 2022 23:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667111368; cv=none; d=google.com; s=arc-20160816; b=otgVFeW9QOCjhiZlbjg7DCq5p96od58z2Qtgxd8cmjWf775aAguqdctmDpTpR47Ww9 CYqoCawLYf3tS3vLDpGbJfK9RIQG/ZLfa5GG7tk1wIW7xNAsT2KyUqvEsUoMn51nSSUD BkM3DtqkqzlyPspyH4wnFjIrvBVv4g50KooLC5oCYPyBI5uOa7H+Aclqonsj915MZwDd gOdi1gnNk6ACiq9kr2xEStSItitrilZyxcOSTv4f9brnHlUc3qonoM6UuhwDVuwf8/a5 drAhwRhFin4diUen8Gg1Jj99Jdi90ZoQcwDceMzqW8wygIRPRM6NTDrHIb1poytl9m8h 7S+Q== 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=8WCbndcoPcpcw4iQf5/2TwIvIv/jZiueYLToK+OicnI=; b=xsnjrk9+mr5gNmr9Eb0To/iWKpTkK4T9+4SbsI52U2PG6Ygnlas6zhnLbZXDpPeT+v 0Pck0qbcQoXUccGVnDqfcv2/jOnpf+WBv5UcMK2ovjEKXkEvu72ArICpS/HDF0V5cFPJ f2GMkcHoDosZPZh3d0d8cyd68OfPOXWpVg59OPfFJWda2EHGXozp7hY4cKxvayMHweCy h0vLO30OsOZijNcL+oAbIrYIQEOaXrNx/qlZHRodUC2qgA4+3kzVnPtUzUTjE52dbv2H KzOxJVcohe+dAWhFVkL0/UgLX5K5mMDHlfiDTwDCLJIgFaDrVwIhS3p/JcGXyCRuX027 wyuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Iw+GFymT; 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 tz10-20020a170907c78a00b0078d40f7ef1fsi3042837ejc.330.2022.10.29.23.29.03; Sat, 29 Oct 2022 23:29:28 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=Iw+GFymT; 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 S230405AbiJ3G1I (ORCPT + 99 others); Sun, 30 Oct 2022 02:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbiJ3GYL (ORCPT ); Sun, 30 Oct 2022 02:24:11 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46F0F13C; Sat, 29 Oct 2022 23:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667111050; x=1698647050; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XTbYY1fmIyEn8RqQg2g2IUB+pcesS3c7XzjHCDTS0FQ=; b=Iw+GFymTIGkx5EbISqnZrHFdmMhH9/fnUdut9U3Axbyqk4q5ud0sC9Sc XQXy00IpbrYaFEJ/EEZ4nvbdWezEKcZKmqqOcwxlbxwn3m9Hg8IuJzySI ynAS40vjzULeTaheKzwF9miog4GnbiLIu/A03UV4MT3Lcy9ijbnzkqjTF 5h7njKv3xJZan3Q/4QgRUw/o2j0/X11eFqFqMUpKCX4xtZHAJx0oYHmBq ELuxLFjQYATwEtw2TxHZnUEz3xw+SWjKOpBCbkkDJIAreog2442Wx5c+/ yc59erGK+4UrTdmSzxJl4fznTixhgT6O7ebZGNOyKcyvjWL2QyHicyaXN Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="395037155" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="395037155" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:04 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="878392985" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="878392985" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:04 -0700 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 v10 043/108] KVM: x86/mmu: Require TDP MMU for TDX Date: Sat, 29 Oct 2022 23:22:44 -0700 Message-Id: <82c25eec5a4c42e4b6a2038c7553bbaf56e87091.1667110240.git.isaku.yamahata@intel.com> 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.9 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index c6be76f9849c..1bf58288ea79 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -18,8 +18,12 @@ int kvm_mmu_init_tdp_mmu(struct kvm *kvm) { struct workqueue_struct *wq; + /* + * Because only the TDP MMU supports TDX, require the TDP MMU for guest + * TDs. + */ if (!tdp_enabled || !READ_ONCE(tdp_mmu_enabled)) - return 0; + return kvm->arch.vm_type == KVM_X86_TDX_VM ? -EOPNOTSUPP : 0; wq = alloc_workqueue("kvm", WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 0); if (!wq) -- 2.25.1