Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4679957iob; Sun, 8 May 2022 21:45:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuyCf25d9dw3tEx1rSBYOzEgOGvhwvRCDlENKUZ7/UYgpKtci3QXHQyEzGzxggazBQkm0i X-Received: by 2002:a17:902:c7d3:b0:15b:78cb:be79 with SMTP id r19-20020a170902c7d300b0015b78cbbe79mr14231220pla.166.1652071520202; Sun, 08 May 2022 21:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652071520; cv=none; d=google.com; s=arc-20160816; b=HcyLK+MFKZglWVf7N/5rQSuF/VNhtpn8Kg7UkNjU5Yfhv+9tuk36UqDThRfAZQ1JcD 5qKdVsAbeN+gwYw11ZzpGokpU6Db81TJ977X39bZ39B657iv8URCbqH8ZDAIh+xcuoJ9 n+eIbt2apiiWpZafoe9wR8fVINt0eKMk/J9KBFe8A2nGlThQ6D4kBXxpr/MaAd7NVJTl H35WAgrAcMdVGTLj3S14ZQxCxLOqbeuG/PlF5ETXF8ix7AjWctS70T38YI7nnejVgmjW jybnnTZoUup7OyGDDoXMF5mW/gtQ2cTmj+kTEk8MLIjXpVzOoC3V7j8L3Z/pOusZYo4/ QfNA== 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=R80KTATB3zmtKAEvRFLhOzj/po5+gT4HhoWtomjoxSw=; b=B3YA8Pmh9Z+5jBhtgxqMq0MHY+LkGbNwmbGpu03uXIH18tNjBzp9ChUw681zBXnMiQ 3SZYPDzStmLXbrnVobbRAl2zeqda3rfk3sCppOUrRwB55pED8WwxV6Gn2sJqi0mRh6BU EWoA9hJU3y5dXwvbGUH/CRFq3oK4ovB3Rdlze9vpliyyhJIm2K2EIM3Mq+wiqz4zsUgN mX47Yjgx4W56OIOSL6nwbfd5L2UJ1GIQudxChhBK9xF6dUoU16dgjDYHDg2B4K07yFEt PDWMcm5FeePZ612P4abFJKUMt81VSKdOY5rSW1LkflHuq/zX1ffpvM2z4CCQjJ5r28rn 6hBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AL2XsOYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w15-20020a170902d70f00b00158e7ff4c26si9463532ply.514.2022.05.08.21.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AL2XsOYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5ADCEA7765; Sun, 8 May 2022 21:45:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384044AbiEES2t (ORCPT + 99 others); Thu, 5 May 2022 14:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382880AbiEESTl (ORCPT ); Thu, 5 May 2022 14:19:41 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D9B0443E1; Thu, 5 May 2022 11:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651774553; x=1683310553; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dqWkE2oXMmA/xSffMn3L9CacObWffok44u2yasFRPjk=; b=AL2XsOYxNXAT7CXCx0JPkVLfc+EGCmyGXnDDAsyvZXWqD146S3PV8s9+ W/gJCdnWzojuNxTAHNj1fTAbcP6lf/7PqN7fRBlOQE7zGErtCeLnmtzxK p0ZwYtKucn26WF1F28dj7n7Qg8wvt/LtuZxaNWmBDex0mpE4yCrt7373V l5Gye2FGMUiocH8DD+tCm5/lxFwmv+Rg6Y/SSvpnUk/di4SCHKGLROhjG eX3A7O/e3So4eXjR1wOjzCA4XfRiOOwO3+7xbo/mv4mOmy6pipeZS+ZKv IvixtnMVt2i5TBZZvi3P/RI/JzbvSkBiAzNJ7p+BRqbeqPxKlSRujw+mM Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="328746281" X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="328746281" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 11:15:46 -0700 X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="665083290" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 11:15:46 -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: [RFC PATCH v6 044/104] KVM: x86/mmu: Focibly use TDP MMU for TDX Date: Thu, 5 May 2022 11:14:38 -0700 Message-Id: <74ed344d1ee81bc378dcd0339278b0c3b7d675e9.1651774250.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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 In this patch series, TDX supports only TDP MMU and doesn't support legacy MMU. Forcibly use TDP MMU for TDX irrelevant of kernel parameter to disable TDP MMU. Signed-off-by: Isaku Yamahata --- arch/x86/kvm/mmu/tdp_mmu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index f8c1824d85a5..b8850a0ceb15 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -18,8 +18,13 @@ int kvm_mmu_init_tdp_mmu(struct kvm *kvm) { struct workqueue_struct *wq; - if (!tdp_enabled || !READ_ONCE(tdp_mmu_enabled)) - return 0; + /* + * Because TDX supports only TDP MMU, forcibly use TDP MMU in the case + * of TDX. + */ + if (kvm->arch.vm_type != KVM_X86_TDX_VM && + (!tdp_enabled || !READ_ONCE(tdp_mmu_enabled))) + return false; wq = alloc_workqueue("kvm", WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 0); if (!wq) -- 2.25.1