From patchwork Sun Oct 30 06:22:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 12843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1665680wru; Sat, 29 Oct 2022 23:26:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56PgD03ZuSnDtmno/bojHtrYWAVXULfUG8WZB2yxhbaQvqlzbkZOJ6lgarfMawheeBA19r X-Received: by 2002:a50:a406:0:b0:463:4fe5:67d1 with SMTP id u6-20020a50a406000000b004634fe567d1mr226836edb.151.1667111214359; Sat, 29 Oct 2022 23:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667111214; cv=none; d=google.com; s=arc-20160816; b=iLGjGqoCVf/b3mou+/mGUeuY+a92C+DbYwF4m5xILKQrLYPlF+EU8U5/YHYfrNUYPG irbJuGQMDXHRbWB4gPj5rCwdjEgfu/sLG/TRiK+rv51YfZEu1u/WW1MSftHIsTB1FoFM a4HRJI1i2m6SSgwlWWS4aasP6cjHHsQBryu2iN1puOXCPJOwexxneEN08Emdot+mks22 DZdQZCfe5MMHN5gTgVT3gJD+zuwyhHXvIyxbzAK17c0W+J1xavOagDk+NWd0diWh+Bmc spveUDQNINQz3t6alCehq7KkYTQKLrOw619r8a/eGAc0+fOYr113DPLbrCIC/eQbCKcJ JCtQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a1709063e5200b0079330b37fb6si2586605eji.880.2022.10.29.23.26.29; Sat, 29 Oct 2022 23:26:54 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748092808538276762?= X-GMAIL-MSGID: =?utf-8?q?1748092808538276762?= 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);