Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1143262pxb; Wed, 6 Apr 2022 09:43:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsIBi2Jq5qeIakwvymXaAUXyjLoib5H+nQlHytz0sVRFVasmNVDS8h4ddGAceaKFsyCe44 X-Received: by 2002:a17:90b:4c09:b0:1c6:f64a:dd0 with SMTP id na9-20020a17090b4c0900b001c6f64a0dd0mr10884987pjb.45.1649263392481; Wed, 06 Apr 2022 09:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649263392; cv=none; d=google.com; s=arc-20160816; b=cjYDZ7POXIFFv5oY1fg89EV9bp16NHqxz7sL8km/LDXrKEitfrfl7aSEALkAxGsGGE /skNzdsdOHh9aW5O4oKZ+fI4Ll03oEgLHHf6mWzBVSeRAPLrJ/YsZ/arBeiTxidvk2zH PP8KHA7xphkaUDilSGSemixF+XCbdgdoV+Ljpdb6S3cA780M7j1OaVhOEiBZgrVqtC+k lZCvIcGqyzRhr9UvsCpgyT1oYGxcaSKxF95aFWuWhkqrjqo6lsQ5RqtqI1HuTynNHAQc JxchrPtZJ77O/e8QqtGR96NmIghEMsZ73MPc18uKt1hA7K55cH4aA7kZDQykESmtsDzj sNMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=5LuAczd2b/W4LDsu+kAdzTdDLCnMqCkNz9A14qJceTE=; b=kbTTwP+v5gFR07Rt3xTNDp7GD6ZZfE1zj2e8C3AnoEKS896FAWH5gfZ9e7HwlPsWMY 9K8Ta0jkuJ8Ixqq6SeQGr+dVfxOCjm6C9BBnde9c/RXHARM9/qPbYPy0Pjr+2wfWpBQP bdWcunYn88j+HX9+OOMhe2E5uEJJyljEVNIB2vy8unw+rbFWFRrI2xTWUfdMGK4m3QSg SyssP1HYA7pgXLUyPnhpif5Ns0vVS1R9KmRM8iOu24n7jvsKJriAZgiE6XhDnZv7epSa 0FEvF2uC2UBBn76DY42vkiJSn8VNHy9MI09lTcLYDDabBnLMiLkLOj4K5u6m/9piFV5c nRzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=km+QpWek; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d70-20020a636849000000b003816043f089si16398114pgc.638.2022.04.06.09.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 09:43:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=km+QpWek; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 700EF22510; Wed, 6 Apr 2022 09:26:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237710AbiDFQ2c (ORCPT + 99 others); Wed, 6 Apr 2022 12:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237924AbiDFQ1p (ORCPT ); Wed, 6 Apr 2022 12:27:45 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F6EBC90E3; Tue, 5 Apr 2022 19:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649210782; x=1680746782; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=S3UMWP9q80xjVbra32L/7bYAr7VRtOKCeQYbmk+BjJ4=; b=km+QpWekPUsnPEV94iFlmdKv2jxCV8ubdo76XqqW/geNwqOG3dEYtJ8B Hx5puTdmARC1dGjy0I6HLXZFrOAjrW7RfBg0I3l+Rf0cVo8uExP0qOAtO DQnQXytNQu8STNiZhaFF36nbjOVjpUjN66QbPhj1v9YAzbWV5yKYEnor4 RfiL2BpFjVQU+tQBK09wXPHHX4yFPPyqFf6gwtrPiSWMpqir0kM7OrKvh BM7WAO4EBa6Rzzg2MvIJwT9jaHCD+ql+UC4pD6UwmnRVLaeRljsGY6bUG c/AYTV8egg9/ncQmX+ayLLCC1XQt8B9P0iU8E3lYt4F5IOSTESV5ymlP2 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10308"; a="258512925" X-IronPort-AV: E=Sophos;i="5.90,238,1643702400"; d="scan'208";a="258512925" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 19:06:21 -0700 X-IronPort-AV: E=Sophos;i="5.90,238,1643702400"; d="scan'208";a="570287264" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.249.175.134]) ([10.249.175.134]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 19:06:18 -0700 Message-ID: <36df723c-4794-69a8-8d12-ea371a7865df@intel.com> Date: Wed, 6 Apr 2022 10:06:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.7.0 Subject: Re: [RFC PATCH v5 027/104] KVM: TDX: initialize VM with TDX specific parameters Content-Language: en-US To: Paolo Bonzini , Kai Huang , isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@gmail.com, Jim Mattson , erdemaktas@google.com, Connor Kuehl , Sean Christopherson References: <509fb6fb5c581e6bf14149dff17d7426a6b061f2.camel@intel.com> <6e370d39-fcb6-c158-e5fb-690cd3802150@redhat.com> From: Xiaoyao Li In-Reply-To: <6e370d39-fcb6-c158-e5fb-690cd3802150@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 4/5/2022 9:01 PM, Paolo Bonzini wrote: > On 3/31/22 06:55, Kai Huang wrote: >>> +struct kvm_tdx_init_vm { >>> +    __u32 max_vcpus; >>> +    __u32 tsc_khz; >>> +    __u64 attributes; >>> +    __u64 cpuid; >> Is it better to append all CPUIDs directly into this structure, >> perhaps at end >> of this structure, to make it more consistent with TD_PARAMS? >> >> Also, I think somewhere in commit message or comments we should >> explain why >> CPUIDs are passed here (why existing KVM_SET_CUPID2 is not sufficient). >> > > Indeed, it would be easier to use the existing cpuid data in struct > kvm_vcpu, because right now there is no way to ensure that they are > consistent. > > Why is KVM_SET_CPUID2 not enough?  Are there any modifications done by > KVM that affect the measurement? Then we get the situation that KVM_TDX_INIT_VM must be called after 1 vcpu is created. It seems illogical that it has chance to fail the VM scope initialization after 1 vcpu is successfully created. > Thanks, > > Paolo >