Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1492951rbb; Mon, 26 Feb 2024 10:58:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUw5rHfcvwAGPGsfWMiyqhY8GMXzLnRKtAjyNTlK49JMhV9pWgLiR+w0ddX3RfX5LZ2z552Fw8+c+S7DjlPBYiecjK2qZSmS/mosnlNKw== X-Google-Smtp-Source: AGHT+IFrifDUXbHkQjBucIuW8JRB0ZWE4qDpCUktZCJu7ThatkG+AsO+dXuLdGtyIfSzeL8kGjCN X-Received: by 2002:a17:90a:9b02:b0:299:7b37:9221 with SMTP id f2-20020a17090a9b0200b002997b379221mr5185765pjp.12.1708973904519; Mon, 26 Feb 2024 10:58:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708973904; cv=pass; d=google.com; s=arc-20160816; b=iy1An4Emf+Bx/Z1gNn6Jk+9azOxLgN3EYf/uydPyX3ogtD3MsXZHk/4XFq8HKvlYpm ZkUtIofZqSVZo22pT9ibM2bOapuj3OoI7+alJg6OXgM9qcLI4n5JEhui5Z30/8rTM5gH MYsuvNPL5m8O1AM6t4wiDIko1WwcB9zFNSFkrnQZRa/BXqWbq59j4nWmoGP3H55Uqxad OTtM+lGMwQmYYN+d+nyOCBaFQlTwoLCVihAkLs4ZgUbTE1xGoYgsSa+e/WWzZo5tP1U3 XxNYTnogn/JlU6P4qZTNbdHnq8bfJBo9+R8z55zceB9Z3rxP0+MCI7VsZH2625Hrvj4z 4UIQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=n8mHyDK8oAvj81dlXBY97FVSZ9cEfbEx3rq+1h++kjQ=; fh=P/quV/w7uXmndbL78FtEpLTNkJRPx4LJS51PzREvtL8=; b=vEYKUlV19JmYqJZCFX0ZqCpK5RLJvLVbS0Ed38DFgvq2wW5Jo5anUi7jluMUITUe19 nu6i88JKzhScmu/7GdmoELbBcPmhxbUGozHE2s+MhR/4RI47hKeRxDsbcIjVOyR1BaXl qnItC9htvST0siOVxtLvo4OahoVGtq/0UHxBfO7BYTprH2EMgFB/ovFYF2bTE8FRJ8JB oxMR6yOLTf8PJo+o98b0phPic26W2stsGQEnfkcHgaHgMz9IQ+9X0BWMYE9mBhb+a1P/ FjeL964nPWq3Egif3LmOUOxV228yLqkNpjVHwl7DiS1jVbRMorZyCWNbUUyTCtDAV8cL 1fVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PzAEqCYP; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82173-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id il17-20020a17090b165100b0029acc0f3b56si1549385pjb.50.2024.02.26.10.58.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82173-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PzAEqCYP; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82173-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EBE9828FA30 for ; Mon, 26 Feb 2024 18:58:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E699412F58B; Mon, 26 Feb 2024 18:58:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PzAEqCYP" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A5BA12E1F0; Mon, 26 Feb 2024 18:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973896; cv=none; b=qZ0Krel7g4PJY8z3Z/wUrUWPTxBpDAO9xDQw+Hrtn401YtP8ZpmaAp8f33bB14Tl3R8/ytrtEkWRt8Kjtyy07TL/p5bcK2iuAVz0f3wbP16vR7GopAMPYZZ1++A6Cihwr+K+F9XULyNqrgJh/GtlxbBCghmH+8beKY7X/02JGpI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973896; c=relaxed/simple; bh=98GfyHFMzpKrK23mnt5GV5fD+sLh8aFquLTB/LhXPe8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UQSeZlvLhf2wJ7wFSXJ88tAMF0GmDqhyTRFqQivebtxwutDBQ/Uv/LZaCi5qac94Mhl+kfBIFX58MB11HZFPbxeWmB6GQAwF83/ZY3jMiCqg44w9TErNExl+FmCMicV0GHRMeO1avQ5GeqMMeW+Y0gCngSSZ/xeRW4wn22lzMGg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PzAEqCYP; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708973894; x=1740509894; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=98GfyHFMzpKrK23mnt5GV5fD+sLh8aFquLTB/LhXPe8=; b=PzAEqCYPRLRVCcmqASVH01a7NHu80Pn2bYG4atkMmmoYX01MHaId4vAP GeReg6h/2zuqh1BRtKsTxrUNkIrzpFAMwHy+BQX351botYmqzg2y3KcFq bJweg/g4KTakZLe24if26JIwUn1Q/JpdF9dPzYbBXxz5bVUlANOP7T99F cfBMm/+sv7fbvoFpghEYX6fp8VWTSNUL8HSo3NG6DizNjuuw3zaU++MgJ 7n6S93HNXDiuGwpvuqSvxZFumYlDpQNCddAt39oXtjv82Cn5XMSHWOsKV 2U55rgwMvlnfpG3X28bNP36aU4DWkpb8svHJDxC6QzJ2qJT0BPdpG0KbD g==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="3409124" X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="3409124" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 10:58:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="7302804" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 10:58:14 -0800 Date: Mon, 26 Feb 2024 10:58:13 -0800 From: Isaku Yamahata To: Binbin Wu Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, isaku.yamahata@linux.intel.com Subject: Re: [PATCH v18 029/121] KVM: TDX: create/free TDX vcpu structure Message-ID: <20240226185813.GL177224@ls.amr.corp.intel.com> References: <49f044a1-e5ab-4a3d-8d73-67fa913e2948@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <49f044a1-e5ab-4a3d-8d73-67fa913e2948@linux.intel.com> On Thu, Jan 25, 2024 at 11:06:22AM +0800, Binbin Wu wrote: > > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c > > index 1c6541789c39..8330f448ab8e 100644 > > --- a/arch/x86/kvm/vmx/tdx.c > > +++ b/arch/x86/kvm/vmx/tdx.c > > @@ -411,6 +411,55 @@ int tdx_vm_init(struct kvm *kvm) > > return 0; > > } > > +int tdx_vcpu_create(struct kvm_vcpu *vcpu) > > +{ > > + struct kvm_tdx *kvm_tdx = to_kvm_tdx(vcpu->kvm); > > + > > + /* > > + * On cpu creation, cpuid entry is blank. Forcibly enable > > + * X2APIC feature to allow X2APIC. > > This comment is a bit confusing. > Do you mean force x2apic here or elsewhere? > So far, in this patch, x2apic is not forced yet. > > > + * Because vcpu_reset() can't return error, allocation is done here. > > What do you mean "allocation" here? Now this comment is stale, I removed it as Yuan pointed out. -- Isaku Yamahata