Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3451513rwb; Fri, 30 Sep 2022 03:56:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4T0fADlRwipKKjAup5sEytr1OJ2epWtc1w9DPZvIa3ujkclQxJB6tRIMHmxIj44h+4LJQ8 X-Received: by 2002:a17:90a:fc1:b0:205:e537:91cf with SMTP id 59-20020a17090a0fc100b00205e53791cfmr9182728pjz.171.1664535400384; Fri, 30 Sep 2022 03:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664535400; cv=none; d=google.com; s=arc-20160816; b=AxLw8H3atUU+PAS6z1clhKZSScF88SFSp/s+oTsLXXt7nbRRfzw12Dz96TfdNlKfWR v3G4QGAZtcQunf+Dnr4ccnQmBu6FiX6W16KfMonoKtp+SpIrc1ZmCByK3rhQpxMgRzYB 6R+vyvwunVDduJTuBqIMMlgPCX4sodsYnfFwwOQC/0Q5s8oY8L5lxhVO9nw7agGiIgSb ppHzNzsCHWZ3Ngut0XEcX/FoassX630ZnILJmgAlE4+qOMfyi9pOuRItf+r1quZCgCYi OKDt17ycT5apMR+1smBCv5JWB80iCUILXrRxkoyGmO5QRLRThGZEBAGTgBl7UoTSdp5m SF6A== 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=hhZ5VCWHj+avCzTj+9U2vdG3DYYmtkWVqJZuUlW+4Uo=; b=hntRVC/6+EhV+ffMIwz/In7sImK4GtJaH+92GB9DY0kEuR7dIlhV+6uBTkzDloNjn8 tmVJ49BI+Nmjgg8b7o86rZff496wmMY2uATJlGJ9OAEwvW6BlwGbboFU/5SV5EFsDrtX 8vtNQcduP0Rg4AuUPAk8tCxa31CqiT5aIDf8AfgLeRkQxIpe+kftHWua4629JMTC89lR Dw9UCCGQJ3wUBKijO1UnOB3IAI7aqxPX6EWNnpXOZJL9gTsSqBbxqnvSvwkDj3Jb61PY p+lI/xUdeLzNOSB7zmfNI6pcfX84UR/KsgZlyFEh4JKYzwlKa6kA+Og+hiAVe+AmWVf6 TvbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F2SUyS7f; 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 on1-20020a17090b1d0100b00205f1a25a31si2374581pjb.161.2022.09.30.03.56.29; Fri, 30 Sep 2022 03:56:40 -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=F2SUyS7f; 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 S231972AbiI3KXH (ORCPT + 99 others); Fri, 30 Sep 2022 06:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231573AbiI3KTH (ORCPT ); Fri, 30 Sep 2022 06:19:07 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9109F1822E9; Fri, 30 Sep 2022 03:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664533145; x=1696069145; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ETYhmV4ggDyJkx64nnGBESEDJmnFJiUzMUdZ17hT8mE=; b=F2SUyS7foBvFRIQp4hjuPZsnEAZ7q98WCVkHjQc4DlybZcE47jTTlRZd GkH5PuYqvkF1PuLCLrt2ls9kI+dReGLAWIoMZwMaaM6vH0V6WbwHyNVe0 WZTZu9l1L6pXIbE+rd7DzmRYf/APlntoPxlAJRoKMTUH4R6JBZcOu23d+ t+rBjoE6EkRH2Q/7c0dYJkbAgjx7AdnmZNLY05ub+0ZzL2pjUTRENXVvc PUYbBtDAjCKT/9qrP1Y0IgLkrQLosWQQmclDa4zjcwUuVNjdX3FHUxRdf X12zGRK8E4XIjVoe/oOc0LolLSh5nr0N1sf0p/mhXMbnWvMVaM6amlaDG w==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="281870099" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="281870099" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 03:18:58 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="726807637" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="726807637" 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; 30 Sep 2022 03:18:58 -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 v9 042/105] KVM: x86/mmu: Require TDP MMU for TDX Date: Fri, 30 Sep 2022 03:17:36 -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=-4.5 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_PASS,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 ef8b0c929944..8f20c3857397 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