Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2649375pxb; Sun, 24 Apr 2022 22:13:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOGLl45ZS24qaRMn462yTmTPtOK98IPEvZEgaikNk0edbQ2ZE55ePy2wkhXFwqj7gV42I4 X-Received: by 2002:a05:6402:11c9:b0:425:ef56:a1dd with SMTP id j9-20020a05640211c900b00425ef56a1ddmr1190946edw.143.1650863591394; Sun, 24 Apr 2022 22:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650863591; cv=none; d=google.com; s=arc-20160816; b=rEpoe0CcG/93h0jPLvBe+joAAD86wSabMfs0m3zeAatgMlPnF/DM5vavHwoO0gaQnS ucvz/xiksp3xnuci1J9PArCKNWyKmBGP7YYLw0cpyFjYMnP64TdZPEg+IAsqhOUcBKYC uIIWV2p4m7yYH8faRNgwHYP3Wq6WdW7IelPiHFmZBvZyHAf1rGdLIJ3+zJVy/4qjcYjU oWhfpPNDTcWSzYHHXCfTWNLOigDOpDCaineTbVkCpPlYSIjdQ9V8UEn5xYEvYzVtjdr0 vD0dTV2SgR1oR4axul9mPtjGbQKhLK1mYbBD/2C8nOotUdDVIgLu78T73Gi/M+b5+Ofi KNFQ== 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=+wupUUxXIr3AzA4xLa+X9asIWDSF9PqZg0Hzt4hA5t8=; b=IUC5M7UWLriuzNdxFkhQ1xeOZlmOhbyMKOqumsezctT7LxI5lKQkC9dbJ1T/Z6hp1X CTJvR/WJGS5RSlXp69rHdf6hjJ1TDFtUoR1s1ZstznNY6Eska8O43L0rM+9cXik8QoWj EdwzoExZqYqnofLj/2PG1Jmj0lAY44Dl3VPtQbyEIgZnJn5Gqraxp1LIu3Lh5z+viwOS 8Pva0l2g4gu6fSszRTChviOVd73IKyNTAG60ydSCxShpsM7gh/Br2jK5E2iZ2My58lQ5 g2oB2jO6uahjmJdTbD1f3Zl7ZomNap5WUExx+PWQH8tfHLFZYy+gXtsviHREkMxIs0Mq MbEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cOC+J7B5; 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 j18-20020a170906475200b006f384307fc0si3652942ejs.343.2022.04.24.22.12.46; Sun, 24 Apr 2022 22:13:11 -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=cOC+J7B5; 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 S237490AbiDXBaq (ORCPT + 99 others); Sat, 23 Apr 2022 21:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbiDXBap (ORCPT ); Sat, 23 Apr 2022 21:30:45 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D247760AB2; Sat, 23 Apr 2022 18:27:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650763666; x=1682299666; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=IA1Lmj4ocO6/xXKqNHTWqrt9z5lmz4IZWJmRXxw1fbk=; b=cOC+J7B5gLiZDso6hMbROPhzRNuHxAL7gvSWHZ+1c22tFB8Nnci2pfKn gUbKQ9F9bwjF9P9wXLeINcas19aaiHz4bpqwQZpw9KXJ8G3xfHVBHp4bh V0Q67YQUGt4wk2JCqxZg/dNL5TnWZ1dp0smjZPySqGF8n1IMikwypm5hl swZ2ksRQHSWPtM7UFWSQgdDSW39TiT8yxwEopD5j0zG/qxem9uvYuDrXl WoB6Gp2ZMz7PT93zj0k2Sy/aQdKA8SmiBPA9Mr20q+nSryCFvwhZpaaXh /5r0eWQ8hZ2o07Z5olOhFcnrJ+7CDaj7FiyNnZFRbw/5uNesT3qyfW6Nf w==; X-IronPort-AV: E=McAfee;i="6400,9594,10326"; a="265144118" X-IronPort-AV: E=Sophos;i="5.90,285,1643702400"; d="scan'208";a="265144118" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2022 18:27:46 -0700 X-IronPort-AV: E=Sophos;i="5.90,285,1643702400"; d="scan'208";a="729114400" Received: from mhammack-mobl1.amr.corp.intel.com (HELO [10.212.213.135]) ([10.212.213.135]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2022 18:27:44 -0700 Message-ID: <4bff50c3-4065-65a3-b698-28f2391bb776@linux.intel.com> Date: Sat, 23 Apr 2022 18:27:43 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.7.0 Subject: Re: [PATCH v3 08/21] x86/virt/tdx: Do logical-cpu scope TDX module initialization Content-Language: en-US To: Kai Huang , 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 References: <35081dba60ef61c313c2d7334815247248b8d1da.1649219184.git.kai.huang@intel.com> From: Sathyanarayanan Kuppuswamy In-Reply-To: <35081dba60ef61c313c2d7334815247248b8d1da.1649219184.git.kai.huang@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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 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? > 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. > > 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? -- Sathyanarayanan Kuppuswamy Linux Kernel Developer