Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4118899rwb; Sun, 7 Aug 2022 15:35:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR6gntLNKfnQdpRXlvsrHiK0HUEHvZRdkXhiIgAwF0IwbmRHuYfVh2RnoViWWRAUG1hRf8p7 X-Received: by 2002:a17:902:d509:b0:16f:1e1:2067 with SMTP id b9-20020a170902d50900b0016f01e12067mr16067030plg.140.1659911723915; Sun, 07 Aug 2022 15:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659911723; cv=none; d=google.com; s=arc-20160816; b=ggfQx5aEr8KV02HOJd+jKstiyMpXtnGKr0u6ooL2QSKDon43AiHpGxjghEj2i9S1K9 w1S544/rkcSQc0Ys0IRahjiT0K/PsZ6vOcK24/9Q5YpY5n057ZEzB1p2Zq8j8AGtfyCt 7UB09uIiTT6xMaJgjlPcQiVKQ5x2wwlUPqWOOvgI6MSUFQ2sq7kmQ1eB+BqJfh/mWpx3 jJMmZO6WQx20RsolZ16w4HKEzoDcmFEa6iwfhA3n2lGhM0ykcgI/hzWQSZBNOi1oCRcl j6t/veiqyl0FIr29wHGMWeuxlkavgQloEL+U21/XVcEn550NV2pJlBThKLS7cLGLR1d4 I7BA== 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=YVNiZpCcUAvUON4ReDH7ppHzu0zs8TUbdxj7AIfaNw0=; b=TB1qnYTy/vu7Vn9/joF8/CNOUoztiHJFOyDG/wtzlptVX6KDG+xgTUl8X5wTi9lFxP 2+LIfi9ySaVPwI1sZn39nJ2KLxs4ZI4PzxpeqJxISSIcSOC2G3O/H8PBDLnytpFU7SNt 8UG6YD1f4sCh+yvWvMwFeH+Si2sramtrJTbefp6rm+kQnbodFlt5lTAbR6jjcGqybxtq ID5qrWPejrxhxe2S0zcXxQz/rCZ7UpVeMs3AOSGOdNyWFY67X/yp/YYAU1U7+bZ5qeYE x3IbBnQkIFXIYqJoRlNZ40R0zIxi1maXwXuPRECRTBe8iiazyw9wWtZaUSHaGzUt/KXT 2CuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hEMpLkhD; 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 d15-20020a17090ad98f00b001f4fd4bc900si4728267pjv.137.2022.08.07.15.35.10; Sun, 07 Aug 2022 15:35:23 -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=hEMpLkhD; 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 S242127AbiHGWJY (ORCPT + 99 others); Sun, 7 Aug 2022 18:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237072AbiHGWFM (ORCPT ); Sun, 7 Aug 2022 18:05:12 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9C29B7DA; Sun, 7 Aug 2022 15:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659909781; x=1691445781; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lKCVk5eYfArj0BKao6F/kBoR6PoZK+1iJmdh6WDEfmI=; b=hEMpLkhDCkZMW5BYXalAMfLy7FuKFNQxQxC75mM7p/tNDUmp7FgnYJOY FaMdwizye2t87oUgcIaTBQopBv+V6vR8qdG79zFlgnAzsRH6bvnhvU6xw OQDjP8p9WGpDyJpn6wnxShTXx5aEB+vFMkQnuURP88pxIroiF9nOcJO4D CIa8inXxCWe+iDoEVuYJaWo0NqixO/yygovHdMP1iIqL5I30c/ZJArr44 ZlBkUXuQ7IK88/9wsp28keKE8X7HVbsIRHl03wQQ1ngJVLIVSx8+oY9uu CfEpZDzo4cDrH86zGk4XxFLRN1O85X3h8jFu8HSYbLhV1FpGZjNj7tNjA A==; X-IronPort-AV: E=McAfee;i="6400,9594,10432"; a="289224127" X-IronPort-AV: E=Sophos;i="5.93,220,1654585200"; d="scan'208";a="289224127" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2022 15:02:35 -0700 X-IronPort-AV: E=Sophos;i="5.93,220,1654585200"; d="scan'208";a="663682570" 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; 07 Aug 2022 15:02:35 -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 Subject: [PATCH v8 040/103] KVM: x86/mmu: Require TDP MMU for TDX Date: Sun, 7 Aug 2022 15:01:25 -0700 Message-Id: <38ed5eb0302a4b7e47844e2546694da8093927d0.1659854790.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=-5.0 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,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 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 ce69535754ff..823c1ef807eb 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