Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3438561ioa; Tue, 26 Apr 2022 03:45:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhjd9OfwfNo/zGpa78BbI0AdkAW8ZVU/S8j+sWvOZH1l91gilYwvuHT9Hiy1W/G+2d3Y8m X-Received: by 2002:a63:cc48:0:b0:3ab:77b8:54e0 with SMTP id q8-20020a63cc48000000b003ab77b854e0mr4726959pgi.90.1650969957887; Tue, 26 Apr 2022 03:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650969957; cv=none; d=google.com; s=arc-20160816; b=qi9V4bymLBh5x57mI/DFwrSrxuLMXmBbpV1Ykpmds8QjhmKxGZcU6vSETfqcbHcERp Ha+mNCUvdJhNqQUNewXDnb9Gypj4ZBTHwUbUV/pQ6uTtTcqMVl9WyqGClHERjYI8tqFs JBW/FKhF6XqV0VJV9ad1NvjzqI3B0HeowtTmoYaZRQCtEhHROScdSKjKi86CIsSSYLW9 HuvTKOrFN8hzgJ4zBIA6WKyBpnZglOvZQWfkPDgf2HvA/tg7MMwsxBdTLzpXXJh/hMAs fOq6dKwTz3Nc5IGX3XODrGGhlUj9S7nl7uaCWLztcvK21rHfe15/QUJJTUKMLfRLUM6Y zOrg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=aulqzD46GtdMZpyvw07hlVI4R7LnzaRgSoYg/h5GzU0=; b=ugZMdu6HZOygiA4YqacQStB+PTkhJWUI/ozppxUOt9+XL9iLonMfEqrwflBLENXzwk IMESQcRlISpLUTvfrLtjtQ328ClH7LMSarbigem/9zR5OnZFaZcWCeKI9qnwkpJ7/OWg LIXIoE8VecKVOXPKHJ3zKbqpYuvZRpsvbnPruf6tJbEl17nWAiPqCjdtrMBZoJM0qPXD /M3C658Yr2XTAkM5qRMrUdfuuRpp6HG/fgEzI6owcPDxZ3vQ8NZ8+AatBavGXouFhRae 5hxJOSdwAD6dj7+W1f9vjlHH1cXewa02vCytFPHHfDXmrcSgVnrnraHmZbYknFxoyeFJ 8ZAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CcfA8Ml3; 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 f13-20020a17090aa78d00b001c361252184si1841475pjq.141.2022.04.26.03.45.42; Tue, 26 Apr 2022 03:45:57 -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=CcfA8Ml3; 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 S236559AbiDYX7K (ORCPT + 99 others); Mon, 25 Apr 2022 19:59:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232287AbiDYX7I (ORCPT ); Mon, 25 Apr 2022 19:59:08 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB2073617B; Mon, 25 Apr 2022 16:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650930962; x=1682466962; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=YgyLdwQrVsKHBENgBPm8VoS4B39KEAnWuzWUPVQAhsU=; b=CcfA8Ml3F4zB3aY94WC3eHhOPZoAo5/7b4KptPcEYc4grjeyjmOBYCBw IfF115dcm0Hvr6EsaW9ojNmQ5oYAPK3QTJPb7BEsgWBShNzl5CNFfAwU0 sTWDe158AreUoV7N6emAAim0tKoP3oWh6yLNYbFe6pUlA9YJ5Frk5aOIc j5Pw4RGn2v1uBTXU2043bbNEcEZvVGmZZkchduv3XWcG9LzsShLTJRZXm +sgyGhQMAOV9pCfQuZ99HQryxKVGTvQX5os547Gsnv9eopXhC7nM7/Qxu JhqOvQBJ2pvN5kZKhzEomPLHWaJys1t/LH1UYKEf7CH8XC06+yxTGYvaQ Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10328"; a="245961211" X-IronPort-AV: E=Sophos;i="5.90,289,1643702400"; d="scan'208";a="245961211" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2022 16:56:02 -0700 X-IronPort-AV: E=Sophos;i="5.90,289,1643702400"; d="scan'208";a="729971766" Received: from begriffi-mobl2.amr.corp.intel.com (HELO khuang2-desk.gar.corp.intel.com) ([10.254.0.169]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2022 16:55:48 -0700 Message-ID: <6097c0afdffd714e4a6aa349dfc7f9a009e2718f.camel@intel.com> Subject: Re: [PATCH v3 08/21] x86/virt/tdx: Do logical-cpu scope TDX module initialization From: Kai Huang To: Sathyanarayanan Kuppuswamy , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: seanjc@google.com, pbonzini@redhat.com, dave.hansen@intel.com, len.brown@intel.com, tony.luck@intel.com, rafael.j.wysocki@intel.com, reinette.chatre@intel.com, dan.j.williams@intel.com, peterz@infradead.org, ak@linux.intel.com, kirill.shutemov@linux.intel.com, isaku.yamahata@intel.com Date: Tue, 26 Apr 2022 11:55:46 +1200 In-Reply-To: <4bff50c3-4065-65a3-b698-28f2391bb776@linux.intel.com> References: <35081dba60ef61c313c2d7334815247248b8d1da.1649219184.git.kai.huang@intel.com> <4bff50c3-4065-65a3-b698-28f2391bb776@linux.intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 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 On Sat, 2022-04-23 at 18:27 -0700, Sathyanarayanan Kuppuswamy wrote: > > On 4/5/22 9:49 PM, Kai Huang wrote: > > Logical-cpu scope initialization requires calling TDH.SYS.LP.INIT on all > > BIOS-enabled cpus, otherwise the TDH.SYS.CONFIG SEAMCALL will fail. > > IIUC, this change handles logical CPU initialization part of TDX module > initialization. So why talk about TDH.SYS.CONFIG failure here? Are they > related? They are a little bit related but I think I can remove it. Thanks. > > > TDH.SYS.LP.INIT can be called concurrently on all cpus. > > IMO, if you move the following paragraph to the beginning, it is easier > to understand "what" and "why" part of this change. OK. > > > > Following global initialization, do the logical-cpu scope initialization > > by calling TDH.SYS.LP.INIT on all online cpus. Whether all BIOS-enabled > > cpus are online is not checked here for simplicity. The caller of > > tdx_init() should guarantee all BIOS-enabled cpus are online. > > Include specification reference for TDX module initialization and > TDH.SYS.LP.INIT. > > In TDX module spec, section 22.2.35 (TDH.SYS.LP.INIT Leaf), mentions > some environment requirements. I don't see you checking here for it? > Is this already met? > Good catch. I missed it, and I'll look into it. Thanks. -- Thanks, -Kai