Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp512012rwb; Thu, 12 Jan 2023 08:47:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYklTFSGCQTz9VvtuQ1BYVC1nxtIGtoRHl6/9z5eQyiVGAZIGOmtdHe2pWXq0SHIJvWSxW X-Received: by 2002:a17:907:2056:b0:84d:44dd:e03a with SMTP id pg22-20020a170907205600b0084d44dde03amr14746719ejb.57.1673542041376; Thu, 12 Jan 2023 08:47:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673542041; cv=none; d=google.com; s=arc-20160816; b=K74HJihajgeubVrZc4u1EpKozq/BnMVK+QUOiXUUztTYBF3OtCVhDe1krsWq1reF+0 /dNYczQ8tRkqKSPe3z+9WCAmXWY3yD4XfOtI2grUcWHRFhdLLgRcvdZkpApgnO2k+TuU Pjk9gqFwMirvjUYxoFvKLH5yiCif8VjquDHPjrGp0764NpQDLn5lxbUlrcMq/0oYSqIj Nn6ePOBG4AMFKvuO/PstuY4Qjgdfe9/2LzX7+r+vpG1NfexQzM/CPEhoNisLhgo9c5rj i/vUZACzA3qvfMjx4ZMpnA/xFfvJu2cOpmnGTLG1KiGQori/TW5VrwpXIL47vNky0mEf 0XYg== 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=6rg8n4VbV9UZ5YPoyFEGKGRCyZn6kyzYrDreTsQYQwk=; b=OWAjXFs1iGQkI9gNakdgqpqTfSNLDvgEg2I/lCh60VzRcdK+ALX9N1sOdA3q7zQ1OJ Z42UM8C0Qb5sGk+LBb90cLC/dCReQM//pJLV5XVvxqpL+Bv69FCTQDE7akAocQ4uVfRG YaTS71/8kFqgg0HW2yrPWjCMWHZvbmA/I6sW1SoekWCMUGEJ6cS0AeVkaVt7W8+zrAmZ KillvlEnMhdDdS9RkiWTVNMyM2m4cxtB0g56RXX3VJtHE9NBH4bA1N/BIVAkSoTB7g// Q/2lxxG7w7HT5XFsD0vB4DUUdPoXJ0Fbq7luw8HJX1M5dp3QfRJS30a1TMCn1wqRL+k4 rU7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WEOI22TB; 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 cr19-20020a170906d55300b008366ae33ec2si21447466ejc.595.2023.01.12.08.47.09; Thu, 12 Jan 2023 08:47:21 -0800 (PST) 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=WEOI22TB; 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 S241145AbjALQoU (ORCPT + 50 others); Thu, 12 Jan 2023 11:44:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239924AbjALQhl (ORCPT ); Thu, 12 Jan 2023 11:37:41 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36D0F17E0F; Thu, 12 Jan 2023 08:33:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541238; x=1705077238; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aDh8l8QyBzPvoJNnJExVhMJrYHchkrlMThnHKBSIbWE=; b=WEOI22TBIQxbdNTVNPMOCOqjVKySkAoQHs5WGTokTuxt4fmc2xnALg+4 o0wlDQVHITFgpvXiWM9Xbu1UP4VMs/GI9nmYBczcmQwr6LyODHno8Lj+U jXF1wGjh3k/jooR3KpbPPysRTzPs/7CqmLiUCZX94UFMGjQet2wtNKVX/ qgbNzopJtmB+YKBjsWcX/c6wiDoNH4qCWtmVHYO7kSPbYu0UdSUAju24D L4OCl2cY7o3jbV9dH4yrUWm484vXoH7OHACrRkXbDGkeS4L0uTw71cTY+ Cac8MUwAguT4FsrZZ5S//IwUqeaGkZC4ffzx/svwYTKwmqI78MviD1g0X Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="323811769" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="323811769" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:24 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="721151708" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="721151708" 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; 12 Jan 2023 08:33:23 -0800 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 , Chao Peng Subject: [PATCH v11 025/113] KVM: TDX: Use private memory for TDX Date: Thu, 12 Jan 2023 08:31:33 -0800 Message-Id: <4c3f5462852af9fd0957bb7db0b04a6f2d5639ee.1673539699.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.4 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: Chao Peng Override kvm_arch_has_private_mem() to use fd-based private memory. Return true when a VM has a type of KVM_X86_TDX_VM. Signed-off-by: Chao Peng Signed-off-by: Isaku Yamahata --- arch/x86/kvm/x86.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d548d3af6428..a8b555935fd8 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -13498,6 +13498,11 @@ int kvm_sev_es_string_io(struct kvm_vcpu *vcpu, unsigned int size, } EXPORT_SYMBOL_GPL(kvm_sev_es_string_io); +bool kvm_arch_has_private_mem(struct kvm *kvm) +{ + return kvm->arch.vm_type == KVM_X86_TDX_VM; +} + EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_entry); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_fast_mmio); -- 2.25.1