Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp1436568rwj; Sun, 30 Oct 2022 00:17:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5m6iRx6/3ybNL5y8NnKsphWmgHbAf3z3KCeatV882uaeOXamdP65giC+hcnnK9ERMC/eFr X-Received: by 2002:a17:902:e74e:b0:186:f3f4:f7fc with SMTP id p14-20020a170902e74e00b00186f3f4f7fcmr7952573plf.130.1667114278957; Sun, 30 Oct 2022 00:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667114278; cv=none; d=google.com; s=arc-20160816; b=skSwkWhNgPPMbjGfY62xrKeXcM3dE9F+dgUsA9WfjGpTig9FjQlqaGZdDE6faSqWgX yg0YrW+FoFHUAyWP44HrZSuTbcazAI+fiBMgCCiTe9HxSTQydHdaDfoGVcPMHrOhoSnL pD5ktacsbfwCTZTxil+oduC/2OMi+0oOm4j1dfahEBQ/BP6z8AczHXJwJtf1l+YykGga uplhLp7uwbOggwUlEfaZ6osstQhzOaVgVwAZmxQqkfRUKa70foY1ICX9g8IpL9q1YjYu dY8gT0Zv32XtwIei9ncwvqruURYrsJWxXM5uw3eIiWBfLmXsSzNsedHBIMsMlAPAPXF/ ch0Q== 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=gLgifD5DDchsxWUHF0oC+bY/MIvnlzIVqZyRaDLwRVE=; b=hL/bOD5LclnlNRL+Dk6PBvmeh16OjPhxDNiLtjIKwXngc+U9SPqBkcbluXl2k5qCiz mOi77p7MaLjwERgqwLWi38kSpNddc0HPqpQsjDkFJgcWG+BWOCWjRY7tACc9iPeI4/yk KnPiuI5QGZ553DFz3TrGRClU7wZjOV4/izQGmTeX53SQ6TzuiBvOSoU/22VuGX8JyPu7 jFESe8C/4cWGOlV9UA4mfaPm1J3LA2JbCMx1JxOqC0OnnIdT/wJDuTEbTM8Sp2mieFAi AHXoBuV/HhQSL88MoslfeZFyUy+JOOk9mfvDQqdO+nTOGGg5s/UztKFKw+wX1JV4opya fbYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C4L1RMV2; 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 l4-20020a17090270c400b0017fdef6a46fsi3821158plt.281.2022.10.30.00.17.46; Sun, 30 Oct 2022 00:17:58 -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=C4L1RMV2; 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 S230196AbiJ3GZc (ORCPT + 99 others); Sun, 30 Oct 2022 02:25:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbiJ3GYI (ORCPT ); Sun, 30 Oct 2022 02:24:08 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3809106; Sat, 29 Oct 2022 23:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667111046; x=1698647046; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3Jh8nljoKLt6zY7RQFbcFy85RXbREQjhP5gORZY8yN4=; b=C4L1RMV2LCP33zq6TM/YXDGG5g0hd1+BTXyR4K9Q1vFkkFSG597aoAj0 B0iyynqQQ9SlpiNKn+uKY/4PoBy8auKflpksl72SIG7oSy1NXq5cAXLGh Fip+fviDnBpyuPvLcyjcK+NMcC8oBys6oWfaBNlkktCh/hRArnIiqwS/i FnpgY3GW4ip0lg1DzWfbKVy+8g5Opmwne0aDIBb7oTvEBwxFxEZcxUZRg kQg3qy+hwhbjj8agzCSBE2mD9+vKt4uokordt8afj2DLetNRQx4Gx4J84 ywU7kmBOJm93EvJz8lWwmXr8y0sBRFkfkaGdmLsswNYwIovYKl/kRxTRK Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="395037138" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="395037138" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:01 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="878392918" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="878392918" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:01 -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 , David Matlack , Chao Peng Subject: [PATCH v10 026/108] KVM: TDX: Use private memory for TDX Date: Sat, 29 Oct 2022 23:22:27 -0700 Message-Id: <009f75283b0d7084c9eecd0e712d18818d005170.1667110240.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.9 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 a811d643f71c..ba4a9ce0ee80 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -13862,6 +13862,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