Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3428594iog; Mon, 27 Jun 2022 16:11:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vVjWrVJx/ikLUFyoj+CVpP89kmGazmRP9SqhsnwxLh6VFr3pqyDGHL+x9V+2/srmV7u9f9 X-Received: by 2002:a17:907:3e08:b0:726:2af1:1d5f with SMTP id hp8-20020a1709073e0800b007262af11d5fmr15312593ejc.235.1656371495376; Mon, 27 Jun 2022 16:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656371495; cv=none; d=google.com; s=arc-20160816; b=fuDdP9kK/ZNiO/INTL1AuKJBSHkzAd0AWLxBz3fRPqBTx9z5BReKSDF9cRtMpxzERq FT80WrCnr7AiOVBoHUAGidELTQFvyr2tdaryqj99Z/VabU+UW7zkawowpDIQcfifoRQr +FegD7hmnSNFW5z1yOXwvfUny7UsNpRN2mpmur+npgf/FtyXBHM4XKF2Qy2oVfQh7Pwa MzwJiNRN4M7Z5JUWVaitW1tI+P8nQk7TAJkCGajcsXO0HEhp6KZ8YF0u52rx6I5oyRTN 5LAkaEc2moofab7iVrht0OgztbO91cJpNsJXSYrSKgUAEfbW1EhFJ02MdbHP0H2vwZvI iY3Q== 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=LOBQgSNbD7DfA3NnKaY7IdT47RrNhEpu59K+dE0RF1w=; b=VXEs71WrVPFaSvoBicAah9jk2b7Y9YsSSXHnt0vkEhPxKb85iKLhnpfjmBC9Mp/DWF 8heDO0wsMuPbwsV0mHZl1xdszDqUcYNvu+eIbMaqh8m5Zcr6Mbs6Ru86R/jRTrfWV4R2 BQ1xvaRlyzqFrj3jPgP2p5skbyWPkEnH+2ydX14zyA6dA3hM4rb/r212nCp6SxUDnGU7 LFAVwCMjtBLZHPgAqnbeenfBVG+kl60jllmiKMk/mHpDrovRjcP4x7eBGweqME/vvQUJ 6yHKIY0/7q4t0e+/pIDIwdkNAPfjEGrJG/kbYDvF+UO+OfbuecbaAchAWX1RdgUXfuPF rsTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="VcPwh/r+"; 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 a7-20020aa7d907000000b004353fbbd63csi11665986edr.426.2022.06.27.16.11.11; Mon, 27 Jun 2022 16:11:35 -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="VcPwh/r+"; 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 S241953AbiF0V61 (ORCPT + 99 others); Mon, 27 Jun 2022 17:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241428AbiF0VzK (ORCPT ); Mon, 27 Jun 2022 17:55:10 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6BFB6332; Mon, 27 Jun 2022 14:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656366898; x=1687902898; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tyjTv6Pj07vg3EU6zQKqvLE1RD7lHcTTEeGjBabiGlY=; b=VcPwh/r+2d33jBoAAxbWJ+NRTJo9TVIKzS2J2bmLzmrciemu7lulOZKz Xe2XE+phqXcqGYjcKartdhPHTxRmXLRgTNDrRnYsKxiHWwwWz5uXF0Iiy KCgWr9VqF5lqsGRTZJbweimVp2uVUVSKdmTgLxPPx8+LdEVCvR/LGBH9/ m+Ra9Lq0J7ZzmVWUK/jy6Rgp+PDfdfnH+5HGfyTAhG0it9zeeJ4Bu/Ffa VDD2QgRrW1rpUQfd4VgbvG1Equ+0JoM6/pBX6s/KleqUYJ8NWtDAXYnPg qOnEraGtYUm4zSgssCYZnQfxPy7KCubmp2gs9/SU+nkPOsLmkFKqBoYHT g==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="281609559" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="281609559" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:53 -0700 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="657863574" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:53 -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 Subject: [PATCH v7 043/102] KVM: x86/mmu: Focibly use TDP MMU for TDX Date: Mon, 27 Jun 2022 14:53:35 -0700 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=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 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 82f1bfac7ee6..7eb41b176d1e 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