Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1490942rbb; Mon, 26 Feb 2024 10:53:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWXv8FCxRxcGtnUDz1o93Cy040W1j9XHaBf2bg6WtV+jyPuQfb7LBV60gJhNeyc861coHLRVoUNW2MxFz3TqHwRwEGdPmZLMLJniAfp6w== X-Google-Smtp-Source: AGHT+IFx0ok+SUSVdRgLcJP+HX5JZHz/TcnYPD3QSOJbw813Tli9AH2CIKmyKnpp25RGmKuADr3M X-Received: by 2002:a05:620a:14ad:b0:785:d95d:dda0 with SMTP id x13-20020a05620a14ad00b00785d95ddda0mr8409519qkj.41.1708973592698; Mon, 26 Feb 2024 10:53:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708973592; cv=pass; d=google.com; s=arc-20160816; b=hN4TApOMuN7wP5xzsxLsKRAOZ9iUyAO7EtC0kYpmMQIM++KBS6NI4UEnThc8AzHS1/ dA9jdDZHjBPhJ1z39ml5cQ/FtqoKFMs8dM+ra3T064/YHQXP0tBUuu4zbhx9Ow7feG/7 ZP2q4t+VXNuFE7uzw1OQtC5Akh0xDcWF+eC8SouSfRnMAcbpzpUxf9yvmH8LKtRBwKl7 Hl4L8F1dSMWrdJT+tfRfJBO5NR34nMWZDVO0UVN24fcvaFFU6ft+Bz1Irp5eA3zhHCFi 16068xuXRSzcsUgZVX0qvVwTe3EkXXBx9eiK/c7YE+3SdGbmrlUkb0+jSovjZwwVO0Os Vz5w== 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=FFSHBCFGRLzqGGMEHgyHxkQxa10p96oURfGpyVGEOIw=; fh=o/WauvpIhGJtrVX5TDpK6/6OAgcQwvY4oi2ZkSmnvxQ=; b=pt0wliAv21ukWj2VIfJjHT5iHvyYp7t+sWl9yOKymKeO+I4utI94ZzO3OgsU770vyv QcTW+e7xEdvSV7EAzVlIO/+cWGZabb7igoJBbO0WOWwqiXp1ETLxKrggHiMQgl9pJtu3 F1DTASIJ178rZhjX43knRMj+l9VbzO70p85R9PBMWErQUCloqTg/0/3gZy1FC3fbtMkl 3HHHFJk0+FR59wlAUNf8jlh4ndRnsWXjjtMYsNYdakWDTvNkUTq4O826BAZ5JO83fzNd uo8bw7nmbBPGJozggReLaQJYr7wNR2+PC9wocVY3cDoU9Ec3Vay7qKpf1oV2kn154Vtf 7cPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kGrLDHPE; 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-82164-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82164-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u5-20020a05620a120500b00787d1b9fb38si2977329qkj.276.2024.02.26.10.53.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:53:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82164-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kGrLDHPE; 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-82164-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82164-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 764E61C21E20 for ; Mon, 26 Feb 2024 18:53:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C47CF12F583; Mon, 26 Feb 2024 18:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kGrLDHPE" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 2F62E12C815; Mon, 26 Feb 2024 18:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973583; cv=none; b=mv7Oa39e0x5gEfxg7SAyEaijyokLBmO4P68EvgjM7zhmRl/GsdX35j4DE/a4GQp1SC6J/D6LcYuEb4KcUBQ7EeU65g8hWqvuD5PpLpwZdalm1zVRMKJ1bOhQlmLx9Z4GVfOKgOQKkwtRvI93f9NOBdHglFQsMM9dB8463KxD3P8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973583; c=relaxed/simple; bh=TQGEDSxegQC2Btgob0OA36fZXfP0iz4CRPI3r14mRR0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YsDaRDmc2BMo+wZ18HTEQOuQLzcwlvVDmNJnyKuyXUEUHpBlsmYVVbBQdVaSM7M7q5gkZv6BFIva8RLhgz3e+whj/XNTWOLTvQ0KKONWrgEElWQAMc8DXpGo1oCLoDZD4CwrZm/TSfz2UILOxoKsk4XcphWvAiNmFngPytP19RM= 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=kGrLDHPE; arc=none smtp.client-ip=198.175.65.15 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=1708973581; x=1740509581; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=TQGEDSxegQC2Btgob0OA36fZXfP0iz4CRPI3r14mRR0=; b=kGrLDHPEp4cTflXAncxJWmLPLQghpIsp7BG0xInTzahLJyl8isQw6/fl qLd4ON661O1bh4Q9AbuhDEg+pY1Y6dDByrmPhDqdmkEemR5+qGm7Z0qgC iKkx5F0FUTlpkiM1pLmPniMJFQzfviRsyAH0mJxK2Ftr/nBzETlw6E6j1 cx/6JnlyXqssRSM7liTJVM2b37DqdFa/ML6gTWyq3+bdY4K/8TB9ql+yy zQtiAa/ytFm+HJmfiG9HQT+AQ9U0rRf4VP93NHjcVwccrWChiGXncrPBO mPjuDkA2e5bMQNre3flMB4rQ6jfENtITe3ChIkJ0dwksunLnCK24rJO+U g==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="7104712" X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="7104712" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 10:53:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="6789615" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 10:53:00 -0800 Date: Mon, 26 Feb 2024 10:52:59 -0800 From: Isaku Yamahata To: Binbin Wu Cc: Yuan Yao , 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 023/121] KVM: TDX: Make KVM_CAP_MAX_VCPUS backend specific Message-ID: <20240226185259.GI177224@ls.amr.corp.intel.com> References: <7cc28677-f7d1-4aba-8557-66c685115074@linux.intel.com> <20240201061622.hvun7amakvbplmsb@yy-desk-7060> <33ef0842-f91f-4c70-821c-0fa41b1d5e6e@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: <33ef0842-f91f-4c70-821c-0fa41b1d5e6e@linux.intel.com> On Sun, Feb 04, 2024 at 10:00:45AM +0800, Binbin Wu wrote: > > > On 2/1/2024 2:16 PM, Yuan Yao wrote: > > On Wed, Jan 24, 2024 at 09:17:15AM +0800, Binbin Wu wrote: > > > > > > On 1/23/2024 7:52 AM, isaku.yamahata@intel.com wrote: > > > > From: Isaku Yamahata > > > > > > > > TDX has its own limitation on the maximum number of vcpus that the guest > > > > can accommodate. Allow x86 kvm backend to implement its own KVM_ENABLE_CAP > > > > handler and implement TDX backend for KVM_CAP_MAX_VCPUS. user space VMM, > > > > e.g. qemu, can specify its value instead of KVM_MAX_VCPUS. > > > For legacy VM, KVM just provides the interface to query the max_vcpus. > > > Why TD needs to provide a interface for userspace to set the limitation? > > > What's the scenario? > > I think the reason is TDH.MNG.INIT needs it: > > > > TD_PARAMS: > > MAX_VCPUS: > > offset: 16 bytes. > > type: Unsigned 16b Integer. > > size: 2. > > Description: Maximum number of VCPUs. > Thanks for explanation. > > I am also wondering if this info can be passed via KVM_TDX_INIT_VM. > Because userspace is allowed to set the value no greater than > min(KVM_MAX_VCPUS, TDX_MAX_VCPUS), providing the extra cap KVM_CAP_MAX_VCPUS > doesn't make more restriction comparing to providing it in KVM_TDX_INIT_VM. It's better for the API to be common, not specific to TDX. Also I don't want to play with max_vcpu in multiple places. -- Isaku Yamahata